-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue.h
More file actions
52 lines (44 loc) · 878 Bytes
/
value.h
File metadata and controls
52 lines (44 loc) · 878 Bytes
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
#ifndef VALUE_H
#define VALUE_H
#include <QString>
class Value
{
public:
int m_mark;
Value();
virtual ~Value(){}
virtual QString ToString() =0 ;
virtual int Size_In_Bytes() =0;
};
class Int: public Value
{
public:
int m_value;
public:
Int(int p_value):m_value(p_value){}
QString ToString()
{
return QString("%1").arg(m_value);
}
Value* Add(Value *p_value);
int ComparTo(Value *p_value);
int Size_In_Bytes(){return sizeof(Int);}
};
class String: public Value
{
public:
QString m_strValue;
public:
String(QString p_strVal):m_strValue(p_strVal){}
QString ToString()
{return m_strValue;}
int Size_In_Bytes(){return sizeof(String);}
};
class Null: public Value
{
public:
static Null *m_nullVal;
QString ToString(){return "null";}
int Size_In_Bytes(){return 0;}
};
#endif // VALUE_H