The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame^] | 1 | #ifndef VALUES_H |
| 2 | #define VALUES_H |
| 3 | |
| 4 | #include "Configuration.h" |
| 5 | #include "XMLHandler.h" |
| 6 | |
| 7 | #include <string> |
| 8 | |
| 9 | using namespace std; |
| 10 | |
| 11 | enum { |
| 12 | CURRENT_VERSION, |
| 13 | OLD_VERSION |
| 14 | }; |
| 15 | |
| 16 | struct StringResource |
| 17 | { |
| 18 | StringResource(); |
| 19 | StringResource(const SourcePos& pos, const string& file, const Configuration& config, |
| 20 | const string& id, int index, XMLNode* value, |
| 21 | int version, const string& versionString, const string& comment = ""); |
| 22 | StringResource(const StringResource& that); |
| 23 | |
| 24 | // Compare two configurations |
| 25 | int Compare(const StringResource& that) const; |
| 26 | |
| 27 | inline bool operator<(const StringResource& that) const { return Compare(that) < 0; } |
| 28 | inline bool operator<=(const StringResource& that) const { return Compare(that) <= 0; } |
| 29 | inline bool operator==(const StringResource& that) const { return Compare(that) == 0; } |
| 30 | inline bool operator!=(const StringResource& that) const { return Compare(that) != 0; } |
| 31 | inline bool operator>=(const StringResource& that) const { return Compare(that) >= 0; } |
| 32 | inline bool operator>(const StringResource& that) const { return Compare(that) > 0; } |
| 33 | |
| 34 | string TypedID() const; |
| 35 | static bool ParseTypedID(const string& typed, string* id, int* index); |
| 36 | |
| 37 | SourcePos pos; |
| 38 | string file; |
| 39 | Configuration config; |
| 40 | string id; |
| 41 | int index; |
| 42 | XMLNode* value; |
| 43 | int version; |
| 44 | string versionString; |
| 45 | string comment; |
| 46 | }; |
| 47 | |
| 48 | #endif // VALUES_H |