diff --git a/src/core/basetypes/MCValue.cpp b/src/core/basetypes/MCValue.cpp index 7f12db36f..a569fc133 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 41fb6918c..835cf6b6a 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 9781534a4..d814dff19 100644 --- a/src/objc/utils/NSValue+MCO.mm +++ b/src/objc/utils/NSValue+MCO.mm @@ -72,6 +72,12 @@ + (NSNumber *) mco_valueWithMCValue:(mailcore::Value *)value 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]); }