00001 /*! \file 00002 \author victorien ferry & www.m4nkind.com 00003 \brief This file applies the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 , read file COPYING. 00004 */ 00005 #ifndef COM_M4NKIND_PackULong_Flags_H 00006 #define COM_M4NKIND_PackULong_Flags_H 00007 00008 #include "PackULong.h" 00009 00010 /*! 00011 \class PackULong_Flags 00012 \ingroup BaseSerializableClass 00013 \brief PackULong_Flags specialize PackULong to define from 1 to 28 bit bitfield 00014 where each bit stands as a boolean value with a given meaning. 00015 */ 00016 // if we are in editable mode: 00017 class PackULong_Flags : public PackULong 00018 { 00019 /*================================================================== 00020 PUBLIC 00021 ==================================================================*/ 00022 public: 00023 /*! 00024 \brief Constructor. 00025 */ 00026 PackULong_Flags(void); 00027 #ifdef _ENGINE_EDITABLE_ 00028 /*! 00029 \brief Destructor. 00030 */ 00031 virtual ~PackULong_Flags(void); 00032 #endif 00033 #ifdef _ENGINE_EDITABLE_ 00034 /*! 00035 \brief Each BaseType's inherited classes must explicit an ID for their 00036 class, or let use one of the super class at least through this virtual method. 00037 This is needed by GUIs to detect the types of each sub-members, and shape 00038 an interface for each Object according to their member list. 00039 \return a const character string, that must be unique and unchanged for all serializable base type. 00040 */ 00041 virtual const char *GetClassID() const { return "PackULong::PackULong_Flags"; }; 00042 #endif 00043 #ifdef _ENGINE_EDITABLE_ 00044 /*! 00045 \brief convert the value of this object to an explicit string. The object manages the string privately, 00046 so just read it or copy it. the string would be destroyed with the objects, and changed when using Set() methods. 00047 Note: this is not virtual, but each class can manage m_pValueString or not. 00048 \return the value as a const string. 00049 */ 00050 virtual const char *ValueToString(); 00051 #endif 00052 /*! 00053 \brief test if some flags are all switched on in in the value. 00054 \param _bitFlagsToTest bits to test. 00055 */ 00056 inline bool TestFlags( unsigned int _bitFlagsToTest ) const {return ((m_value&_bitFlagsToTest)!=0);}; 00057 00058 #ifdef _ENGINE_EDITABLE_ 00059 /*! 00060 \brief add flags without changing the others. 00061 \param _FlagsToAdd flags to add. 00062 */ 00063 inline void AddFlags( unsigned int _FlagsToAdd ){ Set(Get()|_FlagsToAdd); }; 00064 #endif 00065 #ifdef _ENGINE_EDITABLE_ 00066 /*! 00067 \brief remove flags without changing the others. 00068 \param _FlagsToRemove flags to remove. 00069 */ 00070 inline void RemoveFlags( unsigned int _FlagsToRemove ){Set( Get() &(~_FlagsToRemove) );}; 00071 #endif 00072 #ifdef _ENGINE_EDITABLE_ 00073 /*! 00074 \brief set an infostring for the bitfield meaning. 00075 \param _meaning a string looking like: "bit0.bit1.bit2" 00076 */ 00077 virtual void SetBitFieldInfo( const char *_meaning ); 00078 #endif 00079 #ifdef _ENGINE_EDITABLE_ 00080 /*! 00081 \brief get an infostring for the bitfield meaning. 00082 \return a string looking like: "bit0.bit1.bit2" 00083 */ 00084 const char *GetBitFieldInfo( ){ return m_Bitfield_Meaning_MemberName; }; 00085 #endif 00086 /*================================================================== 00087 PROTECTED 00088 ==================================================================*/ 00089 protected: 00090 #ifdef _ENGINE_EDITABLE_ 00091 //! the BitFieldInfo string 00092 const char *m_Bitfield_Meaning_MemberName; 00093 #endif 00094 00095 }; 00096 #ifdef _ENGINE_EDITABLE_ 00097 /*! 00098 \def REGISTER_MEMBER_FLAG 00099 00100 \brief This macro is used for member registration and to specify the meaning of each bit in editable mode: 00101 */ 00102 #define REGISTER_MEMBER_FLAG(_object,_MemberName,_DefaultVal,_InfoBitFiled) \ 00103 REGISTER_MEMBER(_object,_MemberName)\ 00104 _object.Set(_DefaultVal);\ 00105 _object.SetBitFieldInfo( _InfoBitFiled ); 00106 00107 #else 00108 /*================================================================== 00109 WHEN NON EDITABLE: 00110 ==================================================================*/ 00111 /*! 00112 \def REGISTER_MEMBER_FLAG 00113 00114 \brief This macro is used for member registration and to specify the meaning of each bit in editable mode: 00115 */ 00116 00117 #define REGISTER_MEMBER_FLAG(_object,_MemberName,_DefaultVal,_InfoBitFiled) \ 00118 REGISTER_MEMBER(_object,_MemberName) 00119 00120 // end of editable mode test : 00121 #endif 00122 00123 // end of file: 00124 #endif
/\/\ 4 N k ! N D _______ _ __ ___ _____ ___ _ _ ____ ___________ __//___ /________ |/ / ___________\_______/ \ / _ _ \/ _ / _ / _/_/____/ _ __ / / / / / / / \ \/ / / \ \ / \\___/___/___/ ¯ _____/_____/ ______\___/_____/\________\\ \________/_ ___ __ l____\ /elD! http://www.m4nkind.com \____/