Skip to content

Commit 5fa1017

Browse files
committed
Support for short values
1 parent ec89707 commit 5fa1017

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/core/basetypes/MCValue.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ Value * Value::valueWithUnsignedCharValue(unsigned char value)
135135

136136
///////////////////////
137137

138+
Value * Value::valueWithShortValue(short value)
139+
{
140+
Value * result = new Value();
141+
result->mType = VALUE_TYPE_SHORT_VALUE;
142+
result->mValue.shortValue = value;
143+
return (Value *) result->autorelease();
144+
}
145+
146+
Value * Value::valueWithUnsignedShortValue(unsigned short value)
147+
{
148+
Value * result = new Value();
149+
result->mType = VALUE_TYPE_UNSIGNED_SHORT_VALUE;
150+
result->mValue.unsignedShortValue = value;
151+
return (Value *) result->autorelease();
152+
}
153+
138154
Value * Value::valueWithIntValue(int value)
139155
{
140156
Value * result = new Value();

src/core/basetypes/MCValue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ namespace mailcore {
3636
static Value * valueWithBoolValue(bool value);
3737
static Value * valueWithCharValue(char value);
3838
static Value * valueWithUnsignedCharValue(unsigned char value);
39+
static Value * valueWithShortValue(short value);
40+
static Value * valueWithUnsignedShortValue(unsigned short value);
3941
static Value * valueWithIntValue(int value);
4042
static Value * valueWithUnsignedIntValue(unsigned int value);
4143
static Value * valueWithLongValue(long value);

src/objc/utils/NSValue+MCO.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ + (NSNumber *) mco_valueWithMCValue:(mailcore::Value *)value
7272
else if (strcmp([self objCType], @encode(unsigned char)) == 0) {
7373
return mailcore::Value::valueWithUnsignedCharValue([nb unsignedCharValue]);
7474
}
75+
else if (strcmp([self objCType], @encode(short)) == 0) {
76+
return mailcore::Value::valueWithShortValue([nb shortValue]);
77+
}
78+
else if (strcmp([self objCType], @encode(unsigned short)) == 0) {
79+
return mailcore::Value::valueWithUnsignedShortValue([nb unsignedShortValue]);
80+
}
7581
else if (strcmp([self objCType], @encode(int)) == 0) {
7682
return mailcore::Value::valueWithIntValue([nb intValue]);
7783
}

0 commit comments

Comments
 (0)