| 229 | } |
| 230 | |
| 231 | bool XMLSerializationArchive::write(const UString &path, bool pack, bool pretty) |
| 232 | { |
| 233 | // warning! data provider must be freed when this method ends, |
| 234 | // so code calling this method may override archive |
| 235 | auto dataProvider = getProvider(pack); |
| 236 | if (!dataProvider->openArchive(path, true)) |
| 237 | { |
| 238 | LogWarning("Failed to open archive at \"%s\"", path); |
| 239 | return false; |
| 240 | } |
| 241 | |
| 242 | for (auto &root : this->docRoots) |
| 243 | { |
| 244 | std::stringstream ss; |
| 245 | unsigned int flags = pugi::format_default; |
| 246 | const char *indent = " "; |
| 247 | if (pretty == false) |
| 248 | { |
| 249 | flags = pugi::format_raw; |
| 250 | indent = ""; |
| 251 | } |
| 252 | root.second.save(ss, indent, flags); |
| 253 | if (!dataProvider->saveDocument(root.first, ss.str())) |
| 254 | { |
| 255 | return false; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | return dataProvider->finalizeSave(); |
| 260 | } |
| 261 | |
| 262 | SerializationNode *XMLSerializationNode::addNode(const char *name, const UString &value) |
| 263 | { |
no test coverage detected