summaryrefslogtreecommitdiff
path: root/libtemplate/globals.h
blob: d566fac6139ced51d341a931b8689ea36d1641c7 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef __XMLGLOBALS_H
#define __XMLGLOBALS_H

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <vdr/plugin.h>

using namespace std;

typedef uint32_t tColor;

// --- cGlobals -------------------------------------------------------------

class cGlobals {
private:
    time_t customTokenChange;
    time_t lastCustomTokenQuery;
    string language;
    string DoTranslate(string token);
    map <string, tColor> colors;
    map <string, string> fonts;
    map <string, int> intVars;
    map <string, double> doubleVars;
    map <string, string> stringVars;
    map <string, map< string, string > > translations;
    map <string, string> customStringTokens;
    map <string, int> customIntTokens;
public:
    cGlobals(void);
    virtual ~cGlobals(void) {};
    bool ReadFromXML(void);
    void AddColor(string &name, tColor &col);
    bool GetColor(string &name, tColor &col);
    void AddFont(string &name, string &font);
    bool GetFont(string name, string &font);
    void AddInt(string &name, int value);
    void ReplaceIntVars(string &value);
    bool GetInt(string name, int &val);
    void AddDouble(string &name, string &value);
    void ReplaceDoubleVars(string &value);
    void AddString(string &name, string &value);
    void ReplaceStringVars(string &value);
    bool AddTranslation(string name,  map < string, string > transl);
    bool Translate(string text, string &translation);
    void AddCustomInt(string &name, int value);
    void AddCustomString(string &name, string &value);
    bool GetCustomInt(string name, int &val);
    map <string, string> GetCustomStringTokens(void);
    map <string, int> GetCustomIntTokens(void);
    bool CustomTokenChange(void);
    void ListCustomTokens(void);
    void Debug(void);
};

#endif //__XMLGLOBALS_H