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

◆ write_rows()

bool MayaFlux::IO::XmlWriter::write_rows ( const Kakshya::CompositeSlice & rows)
overridevirtual

Append preorder rows whose parent indices are global.

Returns
False on invalid structure or a field value that cannot be represented as XML; earlier accepted rows remain in the DOM.

Implements MayaFlux::IO::CompositeWriter.

Definition at line 135 of file XmlWriter.cpp.

136{
137 if (!m_open) {
138 m_last_error = "No writable XML document is open";
139 return false;
140 }
141
142 if (m_failed)
143 return false;
144
145 if (!rows.layout().same_structure(xml_composite_layout())) {
146 m_last_error = "Composite slice layout differs from the XML layout";
147 m_failed = true;
148 return false;
149 }
150
151 for (size_t i = 0; i < rows.size(); ++i) {
152 const auto row = rows.at(i);
153 if (!row || !write_row(*row)) {
154 if (m_last_error.empty())
155 m_last_error = "Could not access XML row";
156
157 m_failed = true;
158 return false;
159 }
160 }
161
162 m_last_error.clear();
163 return true;
164}
bool write_row(const Kakshya::Composite &row)
Kakshya::CompositeLayout xml_composite_layout()
Composite row layout used by the XML reader and writer.
Definition XmlReader.cpp:13

References MayaFlux::Kakshya::CompositeSlice::at(), MayaFlux::Kakshya::CompositeSlice::layout(), m_failed, m_last_error, m_open, MayaFlux::Kakshya::CompositeLayout::same_structure(), MayaFlux::Kakshya::CompositeSlice::size(), write_row(), and MayaFlux::IO::xml_composite_layout().

Referenced by XmlWriter().

Here is the call graph for this function:
Here is the caller graph for this function: