diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-12-14 15:34:11 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-12-14 15:34:11 -0800 |
commit | 5fa101759996eaa1063488adc921a217a96ccc0d (patch) | |
tree | 2fa762c9e01c454b8067542b145b28b50e7e5ded | |
parent | ec89707b8ba23242b4da9b1a53882aefd48bddd5 (diff) |
Support for short values
-rw-r--r-- | src/core/basetypes/MCValue.cpp | 16 | ||||
-rw-r--r-- | src/core/basetypes/MCValue.h | 2 | ||||
-rw-r--r-- | src/objc/utils/NSValue+MCO.mm | 6 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/core/basetypes/MCValue.cpp b/src/core/basetypes/MCValue.cpp index 7f12db36..a569fc13 100644 --- a/src/core/basetypes/MCValue.cpp +++ b/src/core/basetypes/MCValue.cpp @@ -135,6 +135,22 @@ Value * Value::valueWithUnsignedCharValue(unsigned char value) /////////////////////// +Value * Value::valueWithShortValue(short value) +{ + Value * result = new Value(); + result->mType = VALUE_TYPE_SHORT_VALUE; + result->mValue.shortValue = value; + return (Value *) result->autorelease(); +} + +Value * Value::valueWithUnsignedShortValue(unsigned short value) +{ + Value * result = new Value(); + result->mType = VALUE_TYPE_UNSIGNED_SHORT_VALUE; + result->mValue.unsignedShortValue = value; + return (Value *) result->autorelease(); +} + Value * Value::valueWithIntValue(int value) { Value * result = new Value(); diff --git a/src/core/basetypes/MCValue.h b/src/core/basetypes/MCValue.h index 41fb6918..835cf6b6 100644 --- a/src/core/basetypes/MCValue.h +++ b/src/core/basetypes/MCValue.h @@ -36,6 +36,8 @@ namespace mailcore { static Value * valueWithBoolValue(bool value); static Value * valueWithCharValue(char value); static Value * valueWithUnsignedCharValue(unsigned char value); + static Value * valueWithShortValue(short value); + static Value * valueWithUnsignedShortValue(unsigned short value); static Value * valueWithIntValue(int value); static Value * valueWithUnsignedIntValue(unsigned int value); static Value * valueWithLongValue(long value); diff --git a/src/objc/utils/NSValue+MCO.mm b/src/objc/utils/NSValue+MCO.mm index 9781534a..d814dff1 100644 --- a/src/objc/utils/NSValue+MCO.mm +++ b/src/objc/utils/NSValue+MCO.mm @@ -72,6 +72,12 @@ else if (strcmp([self objCType], @encode(unsigned char)) == 0) { return mailcore::Value::valueWithUnsignedCharValue([nb unsignedCharValue]); } + else if (strcmp([self objCType], @encode(short)) == 0) { + return mailcore::Value::valueWithShortValue([nb shortValue]); + } + else if (strcmp([self objCType], @encode(unsigned short)) == 0) { + return mailcore::Value::valueWithUnsignedShortValue([nb unsignedShortValue]); + } else if (strcmp([self objCType], @encode(int)) == 0) { return mailcore::Value::valueWithIntValue([nb intValue]); } |