Changeset 406 in dev for trunk/abdev/BasicCompiler_Common/Enum.h
- Timestamp:
- Mar 2, 2008, 4:36:33 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/Enum.h
r322 r406 3 3 #include <Namespace.h> 4 4 5 class CEnumMember{ 5 class EnumMember 6 { 7 std::string name; 8 std::string value; 9 int sourceIndex; 6 10 public: 7 char *m_name; 8 int m_value; 9 CEnumMember(char *name,int value); 10 ~CEnumMember(); 11 EnumMember( const std::string &name, const std::string &value, int sourceIndex ) 12 : name( name ) 13 , value( value ) 14 , sourceIndex( sourceIndex ) 15 { 16 } 17 const std::string &GetName() const 18 { 19 return name; 20 } 21 const std::string &GetValueStr() const 22 { 23 return value; 24 } 25 int GetSourceIndex() const 26 { 27 return sourceIndex; 28 } 11 29 }; 12 30 13 class CEnumParent{14 NamespaceScopes namespaceScopes;15 string name; 31 class EnumInfo 32 : public Symbol 33 { 16 34 17 35 BOOL bConst; 18 36 19 CEnumMember **ppobj_EnumMember; 20 int iEnumMemberNum; 37 std::vector<EnumMember> members; 21 38 public: 22 39 23 CEnumParent( const NamespaceScopes &namespaceScopes, const char *buffer,int nowLine); 24 ~CEnumParent(); 25 26 const NamespaceScopes &GetNamespaceScopes() const 40 EnumInfo( const NamespaceScopes &namespaceScopes, const std::string &name ) 41 : Symbol( namespaceScopes, name ) 27 42 { 28 return namespaceScopes;29 }30 const string &GetName() const31 {32 return name;33 43 } 34 44 45 const std::vector<EnumMember> &GetMembers() const 46 { 47 return members; 48 } 49 50 void Collect( const char *buffer, int nowLine ); 51 52 const EnumMember &GetEnumMember( const std::string &memberName ) const 53 { 54 BOOST_FOREACH( const EnumMember &member, members ) 55 { 56 if( member.GetName() == memberName ) 57 { 58 return member; 59 } 60 } 61 throw; 62 } 63 }; 64 65 class EnumInfoCollection 66 : public std::vector<EnumInfo> 67 { 35 68 public: 36 static void InitEnum(void); 37 static void DestroyEnum(void); 69 const EnumInfo *Find( const Symbol &symbol ) const 70 { 71 const EnumInfoCollection &thisEnumInfoCollection = *this; 72 BOOST_FOREACH( const EnumInfo &enumInfo, thisEnumInfoCollection ) 73 { 74 if( enumInfo.IsEqualSymbol( symbol ) ) 75 { 76 return &enumInfo; 77 } 78 } 79 return NULL; 80 }; 38 81 39 static char *GenerateSourceCode(void); 82 void InitEnum(void); 83 char *GenerateSourceCode(void); 40 84 }; 41 extern CEnumParent **ppobj_EnumParent;42 extern int iEnumParentNum;
Note:
See TracChangeset
for help on using the changeset viewer.