mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Tie the new serialization code into the Json code.
Small cleanups.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
|
||||
#include "SerializedObject.h"
|
||||
|
||||
#include "boost/lexical_cast.hpp"
|
||||
|
||||
SerializedType* STObject::makeDefaultObject(SerializedTypeID id, const char *name)
|
||||
{
|
||||
switch(id)
|
||||
@@ -455,3 +457,19 @@ void STObject::setValueFieldTL(SOE_Field field, const std::vector<TaggedListItem
|
||||
if(!cf) throw(std::runtime_error("Wrong field type"));
|
||||
cf->setValue(v);
|
||||
}
|
||||
|
||||
Json::Value STObject::getJson(int options) const
|
||||
{
|
||||
Json::Value ret(Json::objectValue);
|
||||
int index=1;
|
||||
for(boost::ptr_vector<SerializedType>::const_iterator it=mData.begin(), end=mData.end(); it!=end; ++it, ++index)
|
||||
{
|
||||
if(it->getType()!=STI_NOTPRESENT)
|
||||
{
|
||||
if(it->getName()==NULL)
|
||||
ret[boost::lexical_cast<std::string>(index)]=it->getText();
|
||||
else ret[it->getName()]=it->getText();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user