Fix getJson for STUInt8, 16, 32, 64.

This commit is contained in:
Arthur Britto
2012-10-05 18:02:22 -07:00
parent 2ae5a92fa1
commit 0a6cec34c5
2 changed files with 24 additions and 0 deletions

View File

@@ -64,6 +64,11 @@ std::string STUInt8::getText() const
return boost::lexical_cast<std::string>(value);
}
Json::Value STUInt8::getJson(int) const
{
return value;
}
bool STUInt8::isEquivalent(const SerializedType& t) const
{
const STUInt8* v = dynamic_cast<const STUInt8*>(&t);
@@ -92,6 +97,11 @@ std::string STUInt16::getText() const
return boost::lexical_cast<std::string>(value);
}
Json::Value STUInt16::getJson(int) const
{
return value;
}
bool STUInt16::isEquivalent(const SerializedType& t) const
{
const STUInt16* v = dynamic_cast<const STUInt16*>(&t);
@@ -108,6 +118,11 @@ std::string STUInt32::getText() const
return boost::lexical_cast<std::string>(value);
}
Json::Value STUInt32::getJson(int) const
{
return value;
}
bool STUInt32::isEquivalent(const SerializedType& t) const
{
const STUInt32* v = dynamic_cast<const STUInt32*>(&t);
@@ -124,6 +139,11 @@ std::string STUInt64::getText() const
return boost::lexical_cast<std::string>(value);
}
Json::Value STUInt64::getJson(int) const
{
return strHex(value);
}
bool STUInt64::isEquivalent(const SerializedType& t) const
{
const STUInt64* v = dynamic_cast<const STUInt64*>(&t);

View File

@@ -97,6 +97,7 @@ public:
SerializedTypeID getSType() const { return STI_UINT8; }
std::string getText() const;
Json::Value getJson(int) const;
void add(Serializer& s) const { s.add8(value); }
unsigned char getValue() const { return value; }
@@ -123,6 +124,7 @@ public:
SerializedTypeID getSType() const { return STI_UINT16; }
std::string getText() const;
Json::Value getJson(int) const;
void add(Serializer& s) const { s.add16(value); }
uint16 getValue() const { return value; }
@@ -149,6 +151,7 @@ public:
SerializedTypeID getSType() const { return STI_UINT32; }
std::string getText() const;
Json::Value getJson(int) const;
void add(Serializer& s) const { s.add32(value); }
uint32 getValue() const { return value; }
@@ -175,6 +178,7 @@ public:
SerializedTypeID getSType() const { return STI_UINT64; }
std::string getText() const;
Json::Value getJson(int) const;
void add(Serializer& s) const { s.add64(value); }
uint64 getValue() const { return value; }