33 writer->startObject();
35 for (std::pair<std::string, JsonDataPtr> pair : elements)
37 writer->writeKey(pair.first);
38 pair.second->writeJson(writer);
47 if (getKeyIndex(key) >= 0)
49 throw LocalException(
"Key \"") << key <<
"\" exists already in this json object.";
52 elements.push_back(std::make_pair(key,
value));
67 int index = getKeyIndex(key);
71 elements.push_back(std::make_pair(key,
value));
87 int index = getKeyIndex(key);
91 elements.erase(elements.begin() + 1);
99 int index = getKeyIndex(key);
107 return elements.at(
index).second;
113 return elements.size();
130 for (
const std::pair<std::string, JsonDataPtr>& pair : elements)
132 o->add(pair.first, pair.second->clone());
139 std::vector<std::string>
v;
140 for (uint i = 0; i < elements.size(); i++)
142 v.push_back(elements.at(i).first);
147 int JsonObject::getKeyIndex(
const std::string& key)
149 for (uint i = 0; i < elements.size(); i++)
151 if (elements.at(i).first == key)