From a0422631a20b555c661c445791f8781b3cde8820 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sat, 7 Jul 2012 19:43:20 -0700 Subject: [PATCH] Add getJson() for STVector256. --- src/SerializedObject.cpp | 13 +++++++++++++ src/SerializedTypes.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/SerializedObject.cpp b/src/SerializedObject.cpp index 8f465936f..6fbd45e63 100644 --- a/src/SerializedObject.cpp +++ b/src/SerializedObject.cpp @@ -1,6 +1,7 @@ #include "SerializedObject.h" +#include #include #include "../json/writer.h" @@ -654,6 +655,18 @@ Json::Value STObject::getJson(int options) const return ret; } +Json::Value STVector256::getJson(int options) const +{ + Json::Value ret(Json::arrayValue); + + BOOST_FOREACH(std::vector::const_iterator::value_type vEntry, mValue) + { + ret.append(vEntry.ToString()); + } + + return ret; +} + static SOElement testSOElements[2][16] = { // field, name, id, type, flags { diff --git a/src/SerializedTypes.h b/src/SerializedTypes.h index 04462f245..5953faed2 100644 --- a/src/SerializedTypes.h +++ b/src/SerializedTypes.h @@ -640,6 +640,8 @@ public: void setValue(const STVector256& v) { mValue = v.mValue; } void setValue(const std::vector& v) { mValue = v; } + + Json::Value getJson(int) const; }; #endif