D:/Zythum/DinoKod/Common/Command.h

00001 #ifndef __COMMAND_H__
00002 #define __COMMAND_H__
00003 
00004 #include "Common/CommonDll.h"
00005 #include "Common/Types.h"
00006 #include "Common/List.h"
00007 
00008 //---------------------------------------------------------------------------------------------------------------------
00009 class COMMON_API KCommand
00010 {
00011 private:
00012         KStr                            m_sName;
00013         KStr                            m_sDescription;
00014         void*                           m_pBind;
00015         void*                           m_pContext;
00016 
00017 public:
00018         KCommand()
00019         {
00020                 m_pBind         = NULL;
00021                 m_pContext      = NULL;
00022         }
00023 
00024         KCommand( KStr sName, void* pBind, KStr sDescription, void* pContext )
00025         {
00026                 m_sName                 = sName;
00027                 m_pBind                 = pBind;
00028                 m_sDescription  = sDescription;
00029                 m_pContext              = pContext;
00030         }
00031 
00032         KStr                            GetsName()                              { return m_sName;                       }
00033         KStr                            GetsDescription()               { return m_sDescription;        }
00034         void*                           GetpBind()                              { return m_pBind;                       }
00035         void*                           GetpContext()                   { return m_pContext;            }
00036 };
00037 
00038 //---------------------------------------------------------------------------------------------------------------------
00039 class COMMON_API KCommandList
00040 {
00041 private:
00042         KList<KCommand*>        m_CommandList;
00043 
00044 protected:
00045         KCommand*                       GetpCommand( KStr sName );
00046 
00047 public:
00048         KCommandList();
00049         ~KCommandList();
00050 
00051         KCommand*                       GetpFirst()                                                     { return m_CommandList.GetFirst();                      }
00052         KCommand*                       GetpNext( KCommand* pCommand )          { return m_CommandList.GetNext( pCommand );     }
00053 
00054         void                            RegisterCommand( KStr sName, void* pBind, KStr sDescription = "", void* pContext = NULL );
00055         void                            UnregisterCommand( KStr sName );
00056         bool                            ExecCommand( KStr sName, KStr sArgument );
00057 };
00058 
00059 #endif  __COMMAND_H__

Generated on Sun Mar 25 20:02:10 2007 for Zythum Project by  doxygen 1.5.1-p1