aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCValue.h
diff options
context:
space:
mode:
authorGravatar DINH Viet Hoa <hoa@sprw.me>2013-01-11 01:08:18 -0800
committerGravatar DINH Viet Hoa <hoa@sprw.me>2013-01-11 01:08:18 -0800
commit739b68a69682d80d8247d4465eae7b182acc9da0 (patch)
tree34c33738bc0761d30c13f7f9b88fdf0d5c8cb4a9 /src/core/basetypes/MCValue.h
parentf83e0e9ba3da2b8887f849483506d5de8f1d2c54 (diff)
first commit
Diffstat (limited to 'src/core/basetypes/MCValue.h')
-rw-r--r--src/core/basetypes/MCValue.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/core/basetypes/MCValue.h b/src/core/basetypes/MCValue.h
new file mode 100644
index 00000000..cc776b24
--- /dev/null
+++ b/src/core/basetypes/MCValue.h
@@ -0,0 +1,81 @@
+#ifndef __MAILCORE_MCVALUE_H_
+
+#define __MAILCORE_MCVALUE_H_
+
+#include <mailcore/MCObject.h>
+
+namespace mailcore {
+
+ class String;
+
+ class Value : public Object {
+ 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:
+ Value(Value * other);
+ virtual ~Value();
+
+ virtual String * description();
+ //virtual String * className();
+
+ virtual bool isEqual(Object * otherObject);
+ virtual unsigned int hash();
+
+ Object * copy();
+
+ 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);
+ };
+
+}
+
+#endif