The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | #ifndef CONFIGURATION_H |
| 2 | #define CONFIGURATION_H |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | using namespace std; |
| 7 | |
| 8 | struct Configuration |
| 9 | { |
| 10 | string locale; |
| 11 | string vendor; |
| 12 | string orientation; |
| 13 | string density; |
| 14 | string touchscreen; |
| 15 | string keyboard; |
| 16 | string navigation; |
| 17 | string screenSize; |
| 18 | |
| 19 | // Compare two configurations |
| 20 | int Compare(const Configuration& that) const; |
| 21 | |
| 22 | inline bool operator<(const Configuration& that) const { return Compare(that) < 0; } |
| 23 | inline bool operator<=(const Configuration& that) const { return Compare(that) <= 0; } |
| 24 | inline bool operator==(const Configuration& that) const { return Compare(that) == 0; } |
| 25 | inline bool operator!=(const Configuration& that) const { return Compare(that) != 0; } |
| 26 | inline bool operator>=(const Configuration& that) const { return Compare(that) >= 0; } |
| 27 | inline bool operator>(const Configuration& that) const { return Compare(that) > 0; } |
| 28 | |
| 29 | // Parse a directory name, like "values-en-rUS". Return the first segment in resType. |
| 30 | bool ParseDiectoryName(const string& dir, string* resType); |
| 31 | |
| 32 | string ToString() const; |
| 33 | }; |
| 34 | |
| 35 | bool split_locale(const string& in, string* language, string* region); |
| 36 | |
| 37 | |
| 38 | #endif // CONFIGURATION_H |