| 172 | } |
| 173 | |
| 174 | int WriteDefaultConfigFile(const std::string& fileName) { |
| 175 | if (fileName.empty()) { |
| 176 | return -1; |
| 177 | } |
| 178 | |
| 179 | XMLDocument doc; |
| 180 | XMLDeclaration* decl = doc.NewDeclaration("xml version=\"1.0\" encoding=\"utf-8\""); |
| 181 | doc.InsertFirstChild(decl); |
| 182 | |
| 183 | XMLElement* root = doc.NewElement("pag-exporter"); |
| 184 | doc.InsertEndChild(root); |
| 185 | |
| 186 | ConfigParam defaultConfig; |
| 187 | WriteCommonConfig(root, &defaultConfig); |
| 188 | WriteBitmapConfig(root, &defaultConfig); |
| 189 | |
| 190 | if (doc.SaveFile(std::string(fileName).c_str()) != XML_SUCCESS) { |
| 191 | return -1; |
| 192 | } |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | bool ReadConfigFile(ConfigParam* configParam) { |
| 197 | if (!configParam) { |
no test coverage detected