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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#ifndef __MAILCORE_MCVALUE_H_
#define __MAILCORE_MCVALUE_H_
#include <MailCore/MCObject.h>
#ifdef __cplusplus
namespace mailcore {
class String;
enum {
ValueTypeNone,
ValueTypeBool,
ValueTypeChar,
ValueTypeUnsignedChar,
ValueTypeShort,
ValueTypeUnsignedShort,
ValueTypeInt,
ValueTypeUnsignedInt,
ValueTypeLong,
ValueTypeUnsignedLong,
ValueTypeLongLong,
ValueTypeUnsignedLongLong,
ValueTypeFloat,
ValueTypeDouble,
ValueTypePointer,
ValueTypeData,
};
class Value : public Object {
public:
virtual ~Value();
static Value * valueWithBoolValue(bool value);
static Value * valueWithCharValue(char value);
static Value * valueWithUnsignedCharValue(unsigned char value);
static Value * valueWithIntValue(int value);
static Value * valueWithUnsignedIntValue(unsigned int value);
static Value * valueWithLongValue(long value);
static Value * valueWithUnsignedLongValue(unsigned long value);
static Value * valueWithLongLongValue(long long value);
static Value * valueWithUnsignedLongLongValue(unsigned long long value);
static Value * valueWithFloatValue(float value);
static Value * valueWithDoubleValue(double value);
static Value * valueWithPointerValue(void * value);
static Value * valueWithData(const char * value, int length);
virtual bool boolValue();
virtual char charValue();
virtual unsigned char unsignedCharValue();
virtual short shortValue();
virtual unsigned short unsignedShortValue();
virtual int intValue();
virtual unsigned int unsignedIntValue();
virtual long longValue();
virtual unsigned long unsignedLongValue();
virtual long long longLongValue();
virtual unsigned long long unsignedLongLongValue();
virtual float floatValue();
virtual double doubleValue();
virtual void * pointerValue();
virtual void dataValue(const char ** p_value, int * p_length);
public: // subclass behavior
Value(Value * other);
virtual String * description();
virtual bool isEqual(Object * otherObject);
virtual unsigned int hash();
Object * copy();
private:
int mType;
union {
bool boolValue;
char charValue;
unsigned char unsignedCharValue;
short shortValue;
unsigned short unsignedShortValue;
int intValue;
unsigned int unsignedIntValue;
long longValue;
unsigned long unsignedLongValue;
long long longLongValue;
unsigned long long unsignedLongLongValue;
float floatValue;
double doubleValue;
void * pointerValue;
struct {
char * data;
int length;
} dataValue;
} mValue;
Value();
public: // private
virtual int type();
};
}
#endif
#endif
|