summaryrefslogtreecommitdiff
path: root/glcdskin/variable.h
blob: 8c6ef6f9ac6fa0a665ce5dc4e601d35062a18425 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * GraphLCD skin library
 *
 * variable.h  -  variable class
 *
 * This file is released under the GNU General Public License. Refer
 * to the COPYING file distributed with this package.
 *
 * based on text2skin
 *
 */

#ifndef _GLCDSKIN_VARIABLE_H_
#define _GLCDSKIN_VARIABLE_H_

#include <string>
#include <vector>

#include "display.h"
#include "object.h"
#include "function.h"

namespace GLCD
{

enum eEvalMode
{
    tevmAlways,
    tevmTick,
    tevmSwitch,
    tevmOnce,
    tevmInterval
};


class cSkin;

class cSkinVariable
{
    friend bool StartElem(const std::string &name, std::map<std::string,std::string> &attrs);
    friend bool EndElem(const std::string &name);

private:
    cSkin * mSkin;
    std::string mId;
    cType mValue;
    cSkinFunction * mCondition;
    cSkinFunction * mFunction;
    cSkinDisplay mDummyDisplay;
    cSkinObject mDummyObject;
    eEvalMode mEvalMode;
    int mEvalInterval;
    uint64_t mTimestamp;

public:
    cSkinVariable(cSkin * Parent);

    bool ParseEvalMode(const std::string & Text);
    bool ParseValue(const std::string & Text);
    bool ParseCondition(const std::string & Text);

    cSkin * Skin(void) const { return mSkin; }
    const std::string & Id(void) const { return mId; }
//    const cType & Value(void) const { return mValue; }
    const cType & Value(void);
    cSkinFunction * Condition(void) const { return mCondition; }
};

class cSkinVariables: public std::vector <cSkinVariable *>
{
public:
    cSkinVariables(void);
    ~cSkinVariables(void);
};

} // end of namespace

#endif