[vlc-devel] commit: Skins2: Cut #define down to size. Should result in identical functionality. (JP Dinger )
git version control
git at videolan.org
Thu Sep 10 10:48:23 CEST 2009
vlc | branch: master | JP Dinger <jpd at videolan.org> | Thu Sep 10 10:47:36 2009 +0200| [5ed93126ce61345f9e97471452c869be0bf3fd41] | committer: JP Dinger
Skins2: Cut #define down to size. Should result in identical functionality.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ed93126ce61345f9e97471452c869be0bf3fd41
---
modules/gui/skins2/commands/cmd_callbacks.hpp | 75 +++++++++++++------------
1 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/modules/gui/skins2/commands/cmd_callbacks.hpp b/modules/gui/skins2/commands/cmd_callbacks.hpp
index 521002f..d3c36dc 100644
--- a/modules/gui/skins2/commands/cmd_callbacks.hpp
+++ b/modules/gui/skins2/commands/cmd_callbacks.hpp
@@ -5,6 +5,7 @@
* $Id$
*
* Author: Erwan Tulou <erwan10 aT videolan doT org >
+ * JP Dinger <jpd (at) videolan (dot) org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,9 +17,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_CALLBACKS_HPP
@@ -27,43 +28,43 @@
#include "cmd_generic.hpp"
#include "../src/vlcproc.hpp"
+class CmdLabeled : public CmdGeneric
+{
+private:
+ vlc_object_t *m_pObj;
+ vlc_value_t m_newVal;
+protected:
+ void execute_on( void (VlcProc::*on_label)(vlc_object_t *,vlc_value_t) )
+ {
+ if( !m_pObj )
+ return;
-#define ADD_COMMAND( label ) \
-class Cmd_##label : public CmdGeneric \
-{ \
- public: \
- Cmd_##label( intf_thread_t *pIntf, \
- vlc_object_t *pObj, vlc_value_t newVal ) \
- : CmdGeneric( pIntf ), m_pObj( pObj ), m_newVal( newVal ) \
- { \
- if( m_pObj ) \
- vlc_object_hold( m_pObj ); \
- } \
- virtual ~Cmd_##label() \
- { \
- if( m_pObj ) \
- vlc_object_release( m_pObj ); \
- } \
- \
- virtual void execute() \
- { \
- if( !m_pObj ) \
- return; \
- \
- VlcProc* p_VlcProc = VlcProc::instance( getIntf() ); \
- p_VlcProc->on_##label( m_pObj, m_newVal ); \
- \
- vlc_object_release( m_pObj ); \
- m_pObj = NULL; \
- } \
- \
- virtual string getType() const { return #label ; } \
- \
- private: \
- vlc_object_t* m_pObj; \
- vlc_value_t m_newVal; \
+ (VlcProc::instance( getIntf() )->*on_label)( m_pObj, m_newVal );
+
+ vlc_object_release( m_pObj );
+ m_pObj = NULL;
+ }
+ CmdLabeled( intf_thread_t *pIntf, vlc_object_t *pObj, vlc_value_t newVal )
+ : CmdGeneric( pIntf ), m_pObj( pObj ), m_newVal( newVal )
+ {
+ if( m_pObj )
+ vlc_object_hold( m_pObj );
+ }
+public:
+ virtual ~CmdLabeled() {
+ if( m_pObj )
+ vlc_object_release( m_pObj );
+ }
};
+#define ADD_COMMAND( label ) \
+ class Cmd_##label : public CmdLabeled \
+ { public: \
+ Cmd_##label( intf_thread_t *I, vlc_object_t *O, vlc_value_t V ) \
+ : CmdLabeled (I, O, V) { } \
+ virtual string getType() const { return #label; } \
+ virtual void execute() { execute_on( &VlcProc::on_##label ); } \
+ };
ADD_COMMAND( item_current_changed )
ADD_COMMAND( intf_event_changed )
More information about the vlc-devel
mailing list