Rev | Line | |
---|
[182] | 1 | #pragma once
|
---|
[4] | 2 |
|
---|
[406] | 3 | class EnumMember
|
---|
| 4 | {
|
---|
| 5 | std::string name;
|
---|
| 6 | std::string value;
|
---|
| 7 | int sourceIndex;
|
---|
[4] | 8 | public:
|
---|
[406] | 9 | EnumMember( const std::string &name, const std::string &value, int sourceIndex )
|
---|
| 10 | : name( name )
|
---|
| 11 | , value( value )
|
---|
| 12 | , sourceIndex( sourceIndex )
|
---|
| 13 | {
|
---|
| 14 | }
|
---|
| 15 | const std::string &GetName() const
|
---|
| 16 | {
|
---|
| 17 | return name;
|
---|
| 18 | }
|
---|
| 19 | const std::string &GetValueStr() const
|
---|
| 20 | {
|
---|
| 21 | return value;
|
---|
| 22 | }
|
---|
| 23 | int GetSourceIndex() const
|
---|
| 24 | {
|
---|
| 25 | return sourceIndex;
|
---|
| 26 | }
|
---|
[4] | 27 | };
|
---|
| 28 |
|
---|
[406] | 29 | class EnumInfo
|
---|
| 30 | : public Symbol
|
---|
| 31 | {
|
---|
[103] | 32 |
|
---|
[4] | 33 | BOOL bConst;
|
---|
| 34 |
|
---|
[406] | 35 | std::vector<EnumMember> members;
|
---|
[4] | 36 | public:
|
---|
| 37 |
|
---|
[406] | 38 | EnumInfo( const NamespaceScopes &namespaceScopes, const std::string &name )
|
---|
| 39 | : Symbol( namespaceScopes, name )
|
---|
| 40 | {
|
---|
| 41 | }
|
---|
[4] | 42 |
|
---|
[406] | 43 | const std::vector<EnumMember> &GetMembers() const
|
---|
[103] | 44 | {
|
---|
[406] | 45 | return members;
|
---|
[103] | 46 | }
|
---|
[406] | 47 |
|
---|
| 48 | void Collect( const char *buffer, int nowLine );
|
---|
| 49 |
|
---|
| 50 | const EnumMember &GetEnumMember( const std::string &memberName ) const
|
---|
[103] | 51 | {
|
---|
[406] | 52 | BOOST_FOREACH( const EnumMember &member, members )
|
---|
| 53 | {
|
---|
| 54 | if( member.GetName() == memberName )
|
---|
| 55 | {
|
---|
| 56 | return member;
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 | throw;
|
---|
[103] | 60 | }
|
---|
[406] | 61 | };
|
---|
[4] | 62 |
|
---|
[406] | 63 | class EnumInfoCollection
|
---|
| 64 | : public std::vector<EnumInfo>
|
---|
| 65 | {
|
---|
[4] | 66 | public:
|
---|
[406] | 67 | const EnumInfo *Find( const Symbol &symbol ) const
|
---|
| 68 | {
|
---|
| 69 | const EnumInfoCollection &thisEnumInfoCollection = *this;
|
---|
| 70 | BOOST_FOREACH( const EnumInfo &enumInfo, thisEnumInfoCollection )
|
---|
| 71 | {
|
---|
| 72 | if( enumInfo.IsEqualSymbol( symbol ) )
|
---|
| 73 | {
|
---|
| 74 | return &enumInfo;
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 | return NULL;
|
---|
| 78 | };
|
---|
[4] | 79 |
|
---|
[406] | 80 | void InitEnum(void);
|
---|
| 81 | char *GenerateSourceCode(void);
|
---|
[4] | 82 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.