2014-09-27 09:25:14 +02:00
|
|
|
#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>
|
2016-01-26 18:32:38 +01:00
|
|
|
#include <algorithm>
|
2014-09-27 09:25:14 +02:00
|
|
|
#include <vdr/plugin.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
typedef uint32_t tColor;
|
|
|
|
|
|
|
|
// --- cGlobals -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cGlobals {
|
|
|
|
private:
|
2015-06-05 14:48:45 +02:00
|
|
|
time_t customTokenChange;
|
|
|
|
time_t lastCustomTokenQuery;
|
2014-09-27 09:25:14 +02:00
|
|
|
string language;
|
|
|
|
string DoTranslate(string token);
|
2016-01-26 18:32:38 +01:00
|
|
|
void DeleteCurledBrackets(string &token);
|
2014-09-27 09:25:14 +02:00
|
|
|
map <string, tColor> colors;
|
2015-01-24 10:47:47 +01:00
|
|
|
map <string, string> fonts;
|
2014-09-27 09:25:14 +02:00
|
|
|
map <string, int> intVars;
|
2014-10-10 15:32:38 +02:00
|
|
|
map <string, double> doubleVars;
|
2014-09-27 09:25:14 +02:00
|
|
|
map <string, string> stringVars;
|
|
|
|
map <string, map< string, string > > translations;
|
2016-01-26 18:32:38 +01:00
|
|
|
map <int, string> customStringTokens;
|
|
|
|
map <int, int> customIntTokens;
|
2015-01-24 10:47:47 +01:00
|
|
|
public:
|
|
|
|
cGlobals(void);
|
|
|
|
virtual ~cGlobals(void) {};
|
2014-09-27 09:25:14 +02:00
|
|
|
bool ReadFromXML(void);
|
2015-01-24 10:47:47 +01:00
|
|
|
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);
|
2016-01-26 18:32:38 +01:00
|
|
|
bool GetString(string name, string &value);
|
2015-01-24 10:47:47 +01:00
|
|
|
bool AddTranslation(string name, map < string, string > transl);
|
2014-09-27 09:25:14 +02:00
|
|
|
bool Translate(string text, string &translation);
|
2016-01-26 18:32:38 +01:00
|
|
|
void AddCustomInt(int num, int value);
|
|
|
|
void AddCustomString(int num, string &value);
|
|
|
|
bool GetCustomInt(int num, int &val);
|
|
|
|
bool GetCustomString(int num, string &val);
|
|
|
|
map <int, string> GetCustomStringTokens(void);
|
|
|
|
map <int, int> GetCustomIntTokens(void);
|
2015-06-05 14:48:45 +02:00
|
|
|
bool CustomTokenChange(void);
|
2016-01-26 18:32:38 +01:00
|
|
|
void ResetCustomTokenChange(void);
|
2015-01-24 10:47:47 +01:00
|
|
|
void ListCustomTokens(void);
|
2014-09-27 09:25:14 +02:00
|
|
|
void Debug(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__XMLGLOBALS_H
|