MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ flush()

bool MayaFlux::IO::XmlWriter::flush ( )
overridevirtual

Save the current document, which must contain one root.

Implements MayaFlux::IO::CompositeWriter.

Definition at line 313 of file XmlWriter.cpp.

314{
315 if (!m_open) {
316 m_last_error = "No XML document is open";
317 return false;
318 }
319
320 if (m_failed)
321 return false;
322
323 if (m_root_count != 1) {
324 m_last_error = "XML document must contain one root element before saving";
325 return false;
326 }
327
328 const bool saved = m_xml->document.save_file(m_filepath.c_str(), "",
329 pugi::format_raw | pugi::format_no_declaration, pugi::encoding_utf8);
330
331 if (!saved) {
332 m_last_error = "Could not save XML document";
333 } else {
334 m_last_error.clear();
335 }
336 return saved;
337}
std::unique_ptr< Impl > m_xml
Definition XmlWriter.hpp:67

References m_failed, m_filepath, m_last_error, m_open, m_root_count, and m_xml.

Referenced by close(), and XmlWriter().

Here is the caller graph for this function: