StringId.h
Go to the documentation of this file.00001 00038 #ifndef __StringId_H__ 00039 #define __StringId_H__ 00040 00041 // Includes 00042 00043 // Forward declares 00044 00045 // StringId 00046 class StringId 00047 { 00048 public: 00053 StringId(); 00054 00062 StringId( 00063 const char* idString 00064 ); 00065 00071 const char* GetString() const; 00072 00073 00083 unsigned int GetHash() const; 00084 00085 00090 StringId( 00091 const StringId& stringId 00092 ); 00093 00098 const StringId& operator=( 00099 const StringId& stringId 00100 ); 00101 00106 bool operator==( 00107 const StringId& stringId 00108 ) const; 00109 00114 bool operator!=( 00115 const StringId& stringId 00116 ) const; 00117 00118 00119 private: 00120 const char* idString_; 00121 unsigned int hash_; 00122 }; 00123 00124 00125 //*** Helper macros for working with StringIds *** 00126 00168 #define strSwitch(stringId) StringId _multiple_strSwitch_not_allowed_within_one_code_block_=stringId; 00169 00170 00178 #define strCase(stringId) \ 00179 static StringId _duplicate_strCase_statement_##stringId(#stringId); \ 00180 if (_duplicate_strCase_statement_##stringId==_multiple_strSwitch_not_allowed_within_one_code_block_) \ 00181 00182 00183 #endif /* __StringId_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
