Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

cmd_generic.hpp

00001 /*****************************************************************************
00002  * cmd_generic.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: cmd_generic.hpp 12207 2005-08-15 15:54:32Z asmax $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef CMD_GENERIC_HPP
00026 #define CMD_GENERIC_HPP
00027 
00028 #include "../src/skin_common.hpp"
00029 #include "../utils/pointer.hpp"
00030 
00031 #include <string>
00032 
00033 
00035 #define DEFINE_COMMAND( name, type ) \
00036 class Cmd##name: public CmdGeneric \
00037 { \
00038     public: \
00039         Cmd##name( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {} \
00040         virtual ~Cmd##name() {} \
00041         virtual void execute(); \
00042         virtual string getType() const { return type; } \
00043 \
00044 };
00045 
00046 
00048 #define DEFINE_CALLBACK( parent, action ) \
00049 class Cmd##action: public CmdGeneric \
00050 { \
00051     public: \
00052         Cmd##action( parent *pParent ): \
00053             CmdGeneric( pParent->getIntf() ), m_pParent( pParent ) {} \
00054         virtual ~Cmd##action() {} \
00055         virtual void execute(); \
00056         virtual string getType() const { return "Cmd" #parent #action; } \
00057     private: \
00058         parent *m_pParent; \
00059 \
00060 } m_cmd##action; \
00061 friend class Cmd##action;
00062 
00063 
00065 class CmdGeneric: public SkinObject
00066 {
00067     public:
00068         virtual ~CmdGeneric() {}
00069 
00071         virtual void execute() = 0;
00072 
00074         virtual string getType() const { return ""; }
00075 
00076     protected:
00077         CmdGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
00078 };
00079 
00080 
00081 typedef CountedPtr<CmdGeneric> CmdGenericPtr;
00082 
00083 
00084 #endif

Generated on Tue Dec 20 10:14:41 2005 for vlc-0.8.4a by  doxygen 1.4.2