Begins a new structured section identified by the given key and makes it the current write context
| 48 | |
| 49 | /// Begins a new structured section identified by the given key and makes it the current write context |
| 50 | BOOL ValidateJsonWriter::begin(const std::string& key, ContainerType type) { |
| 51 | if (file == nullptr || stack.empty()) return FALSE; |
| 52 | |
| 53 | Json& current = *stack.back(); |
| 54 | |
| 55 | if (type == ContainerType::Array) { |
| 56 | if (!current.contains(key)) current[key] = Json::array(); |
| 57 | current[key].push_back(Json::object()); |
| 58 | stack.push_back(¤t[key].back()); |
| 59 | } else { |
| 60 | current[key] = Json::object(); |
| 61 | stack.push_back(¤t[key]); |
| 62 | } |
| 63 | |
| 64 | return TRUE; |
| 65 | } |
| 66 | |
| 67 | /// Begins a sub-section within the current section and makes it the active write context |
| 68 | BOOL ValidateJsonWriter::beginsub(const std::string& key, ContainerType type) { |