STPathElement and STPath classes. Better Json-ization of serialized types.

This commit is contained in:
JoelKatz
2012-05-19 01:09:59 -07:00
parent 99a8fd38cf
commit 567ac3c846
4 changed files with 259 additions and 50 deletions

View File

@@ -42,6 +42,9 @@ std::auto_ptr<SerializedType> STObject::makeDefaultObject(SerializedTypeID id, c
case STI_ACCOUNT:
return std::auto_ptr<SerializedType>(new STAccount(name));
case STI_PATH:
return std::auto_ptr<SerializedType>(new STPath(name));
default:
throw std::runtime_error("Unknown object type");
}
@@ -85,6 +88,9 @@ std::auto_ptr<SerializedType> STObject::makeDeserializedObject(SerializedTypeID
case STI_ACCOUNT:
return STAccount::deserialize(sit, name);
case STI_PATH:
return STPath::deserialize(sit, name);
default:
throw std::runtime_error("Unknown object type");
}
@@ -568,8 +574,8 @@ Json::Value STObject::getJson(int options) const
if (it->getSType() != STI_NOTPRESENT)
{
if (it->getName() == NULL)
ret[boost::lexical_cast<std::string>(index)] = it->getText();
else ret[it->getName()] = it->getText();
ret[boost::lexical_cast<std::string>(index)] = it->getJson(options);
else ret[it->getName()] = it->getJson(options);
}
}
return ret;