Skip to content
Snippets Groups Projects

GUI: serialization refactoring part 7

Merged Mikhail Svechnikov requested to merge serialization_7 into main
2 files
+ 49
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -19,6 +19,14 @@
#include "GUI/Support/XML/Serialize.h"
#include "GUI/Util/String.h"
namespace {
namespace Tag {
const QString Instrument("Instrument");
} // namespace Tag
} // namespace
InstrumentCollection::~InstrumentCollection()
{
qDeleteAll(m_instruments);
@@ -32,8 +40,44 @@ void InstrumentCollection::clear()
void InstrumentCollection::serialize(Streamer& s)
{
s.assertVersion(0);
Serialize::rwCatalogized<InstrumentItemCatalog>(s, "InstrumentCollection", m_instruments);
// s.assertVersion(0);
// Serialize::rwCatalogized<InstrumentItemCatalog>(s, "InstrumentCollection", m_instruments);
if (s.xmlReader())
readFrom(s.xmlReader());
else if (s.xmlWriter())
writeTo(s.xmlWriter());
}
void InstrumentCollection::writeTo(QXmlStreamWriter *w) const
{
// XML::writeAttribute(w, XML::Attrib::version, uint(1));
// // instruments
// for (const auto& sel : m_instruments) {
// w->writeStartElement(Tag::Instrument);
// sel.writeTo(w);
// w->writeEndElement();
// }
}
void InstrumentCollection::readFrom(QXmlStreamReader *r)
{
// m_particles.clear();
// const uint version = XML::readUIntAttribute(r, XML::Attrib::version);
// Q_UNUSED(version)
// while (r->readNextStartElement()) {
// QString tag = r->name().toString();
// // particle
// if (tag == Tag::Instrument) {
// addInstrument(nullptr).readFrom(r, m_materialModel);
// XML::gotoEndElementOfTag(r, tag);
// } else
// r->skipCurrentElement();
// }
}
InstrumentItem* InstrumentCollection::insertCopy(const InstrumentItem& source)
Loading