]> git.sesse.net Git - vlc/commitdiff
Skins2: Refactor string manipulation event handling a bit and replace some static...
authorJP Dinger <jpd@videolan.org>
Sun, 15 Nov 2009 22:24:41 +0000 (23:24 +0100)
committerJP Dinger <jpd@videolan.org>
Sat, 5 Dec 2009 21:25:41 +0000 (22:25 +0100)
modules/gui/skins2/events/evt_input.cpp
modules/gui/skins2/events/evt_input.hpp

index b8f2a3f9d877cf41d868dad80304f75b804d5bde..d56d45e86f0f31f64cb474a14a02ac6169cc2693 100644 (file)
 
 #include "evt_input.hpp"
 
-const int EvtInput::kModNone  = 0;
-const int EvtInput::kModAlt   = 1;
-const int EvtInput::kModCtrl  = 2;
-const int EvtInput::kModShift = 4;
 
-
-EvtInput::EvtInput( intf_thread_t *pIntf, int mod ):
-    EvtGeneric( pIntf), m_mod( mod )
-{
-}
+EvtInput::EvtInput( intf_thread_t *pIntf, int mod )
+    : EvtGeneric( pIntf), m_mod( mod ) { }
 
 
 void EvtInput::addModifier( string &rEvtString ) const
@@ -44,21 +37,14 @@ void EvtInput::addModifier( string &rEvtString ) const
     }
     else
     {
-        string modList = ":";
+        string m = ":";
         if( m_mod & kModAlt )
-        {
-            modList += "alt,";
-        }
+            m += "alt,";
         if( m_mod & kModCtrl )
-        {
-            modList += "ctrl,";
-        }
+            m += "ctrl,";
         if( m_mod & kModShift )
-        {
-            modList += "shift,";
-        }
-        // Remove the last ','
-        modList = modList.substr( 0, modList.size() - 1 );
-        rEvtString += modList;
+            m += "shift,";
+        // Append the result except the last ','
+        rEvtString.insert( rEvtString.end(), m.begin(), m.end()-1 );
     }
 }
index 1656d8fd06c24f29783ade8d10f90477198c0454..a001c0e70c1a5c75e0874859d9d96aca4f8b7687 100644 (file)
@@ -35,10 +35,7 @@ public:
     virtual ~EvtInput() { }
 
     /// Masks for modifier keys
-    static const int kModNone;
-    static const int kModAlt;
-    static const int kModCtrl;
-    static const int kModShift;
+    enum { kModNone=0, kModAlt=1, kModCtrl=2, kModShift=4 };
 
     /// Get the modifiers
     virtual int getMod() const { return m_mod; }