Start a document using xml_composite_layout().
Implements MayaFlux::IO::CompositeWriter.
Definition at line 90 of file XmlWriter.cpp.
92{
94 m_last_error =
"Close the current XML document before opening another";
95 return false;
96 }
97
101 return false;
102 }
103
105 m_last_error =
"XML output requires xml_composite_layout()";
106 return false;
107 }
108
109 m_xml = std::make_unique<Impl>();
113
114 std::ofstream output(
m_filepath, std::ios::binary | std::ios::trunc);
115 if (!output) {
117 return false;
118 }
119
120 output.close();
121 if (!output) {
123 return false;
124 }
125
131
132 return true;
133}
std::vector< bool > m_content_started
std::unique_ptr< Impl > m_xml
bool can_write(const std::string &filepath) const override
Accept paths with the .xml extension.
std::vector< uint64_t > m_ancestors
std::string resolve_write_path(const std::string &filepath, std::string_view default_directory=Config::OUT_DIR)
Resolve a writable path against the configured output directory.
Kakshya::CompositeLayout xml_composite_layout()
Composite row layout used by the XML reader and writer.
References can_write(), m_ancestors, m_content_started, m_declaration_seen, m_doctype_seen, m_failed, m_filepath, m_last_error, m_open, m_root_count, m_xml, MayaFlux::IO::resolve_write_path(), MayaFlux::Kakshya::CompositeLayout::same_structure(), and MayaFlux::IO::xml_composite_layout().
Referenced by XmlWriter().