summaryrefslogtreecommitdiffstats
path: root/tools/localize/Values.h
blob: 0a60b6d6f6c407a7fb187532238548140a54e4f6 (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
39
40
41
42
43
44
45
46
47
48
#ifndef VALUES_H
#define VALUES_H

#include "Configuration.h"
#include "XMLHandler.h"

#include <string>

using namespace std;

enum {
    CURRENT_VERSION,
    OLD_VERSION
};

struct StringResource
{
    StringResource();
    StringResource(const SourcePos& pos, const string& file, const Configuration& config, 
                    const string& id, int index, XMLNode* value,
                    int version, const string& versionString, const string& comment = "");
    StringResource(const StringResource& that);

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

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

    string TypedID() const;
    static bool ParseTypedID(const string& typed, string* id, int* index);

    SourcePos pos;
    string file;
    Configuration config;
    string id;
    int index;
    XMLNode* value;
    int version;
    string versionString;
    string comment;
};

#endif // VALUES_H