#include <xml_document.h>
Public Member Functions | |
XmlWriter () | |
~XmlWriter () | |
bool | Create (const std::string &filename, const std::string &root, const std::string &version, const std::string &encoding) |
bool | IsOk () const |
xmlpp::Element * | GetRoot () |
void | WriteElement (xmlpp::Element *x, const std::string &name, const std::string &value) |
bool | Save () |
Protected Attributes | |
xmlpp::Document * | m_doc |
xmlpp::Element * | m_root |
std::string | m_filename |
bool | m_save |
std::string | m_encoding |
Definition at line 81 of file xml_document.h.
XmlWriter::XmlWriter | ( | ) |
XmlWriter::~XmlWriter | ( | ) |
bool XmlWriter::Create | ( | const std::string & | filename, | |
const std::string & | root, | |||
const std::string & | version, | |||
const std::string & | encoding | |||
) |
Definition at line 261 of file xml_document.cpp.
00263 { 00264 delete m_doc; 00265 delete m_root; 00266 m_save = false; 00267 m_filename = filename; 00268 m_encoding = encoding; 00269 m_doc = new xmlpp::Document(version); 00270 m_root = m_doc->create_root_node(root); 00271 assert(m_root != NULL); 00272 return true; 00273 }
Here is the caller graph for this function:
xmlpp::Element * XmlWriter::GetRoot | ( | ) |
bool XmlWriter::IsOk | ( | ) | const |
bool XmlWriter::Save | ( | ) |
Definition at line 281 of file xml_document.cpp.
00282 { 00283 if (m_save) return true; 00284 m_save = true; 00285 try { 00286 m_doc->write_to_file_formatted(m_filename, m_encoding); 00287 } catch (const xmlpp::exception &err) { 00288 return false; 00289 } 00290 return true; 00291 }
Here is the caller graph for this function:
void XmlWriter::WriteElement | ( | xmlpp::Element * | x, | |
const std::string & | name, | |||
const std::string & | value | |||
) |
Definition at line 252 of file xml_document.cpp.
00255 { 00256 xmlpp::Element *elem = x->add_child(name); 00257 elem->add_child_text(value); 00258 m_save = false; 00259 }
Here is the caller graph for this function:
xmlpp::Document* XmlWriter::m_doc [protected] |
Definition at line 84 of file xml_document.h.
std::string XmlWriter::m_encoding [protected] |
Definition at line 88 of file xml_document.h.
std::string XmlWriter::m_filename [protected] |
Definition at line 86 of file xml_document.h.
xmlpp::Element* XmlWriter::m_root [protected] |
Definition at line 85 of file xml_document.h.
bool XmlWriter::m_save [protected] |
Definition at line 87 of file xml_document.h.