summaryrefslogtreecommitdiffstats
path: root/tools/localize/Configuration.h
blob: f91bf043b6530a5edc2af33db855f014e6162555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef CONFIGURATION_H
#define CONFIGURATION_H

#include <string>

using namespace std;

struct Configuration
{
    string locale;
    string vendor;
    string orientation;
    string density;
    string touchscreen;
    string keyboard;
    string navigation;
    string screenSize;

    // Compare two configurations
    int Compare(const Configuration& that) const;

    inline bool operator<(const Configuration& that) const { return Compare(that) < 0; }
    inline bool operator<=(const Configuration& that) const { return Compare(that) <= 0; }
    inline bool operator==(const Configuration& that) const { return Compare(that) == 0; }
    inline bool operator!=(const Configuration& that) const { return Compare(that) != 0; }
    inline bool operator>=(const Configuration& that) const { return Compare(that) >= 0; }
    inline bool operator>(const Configuration& that) const { return Compare(that) > 0; }

    // Parse a directory name, like "values-en-rUS".  Return the first segment in resType.
    bool ParseDiectoryName(const string& dir, string* resType);

    string ToString() const;
};

bool split_locale(const string& in, string* language, string* region);


#endif // CONFIGURATION_H