FML emitter

This commit is contained in:
Eduardo Bart
2011-05-22 00:56:58 -03:00
parent d7bc083014
commit a54f5dd3f9
4 changed files with 281 additions and 396 deletions

View File

@@ -53,11 +53,10 @@ bool Configs::load(const std::string& fileName)
void Configs::save()
{
if(!m_fileName.empty()) {
std::stringstream out;
foreach(auto pair, m_confsMap) {
out << pair.first << ": " << pair.second << std::endl;
}
g_resources.saveFile(m_fileName, out);
FML::Emitter emitter;
FML::Node *doc = emitter.createDocument();
doc->write(m_confsMap);
g_resources.saveFile(m_fileName, emitter.emitDocument());
}
}

View File

@@ -49,6 +49,7 @@ public:
bool loadFile(const std::string& fileName, std::iostream& out);
bool saveFile(const std::string& fileName, const uchar *data, uint size);
bool saveFile(const std::string& fileName, const std::string& data) { return saveFile(fileName, (const uchar*)data.c_str(), data.size()); }
bool saveFile(const std::string& fileName, std::istream& in);
bool deleteFile(const std::string& fileName);