Skip to content
Snippets Groups Projects
Commit b65fbe3a authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

XML --> StreamerXML to avoid conflicts

parent e5a3abfb
No related branches found
No related tags found
1 merge request!1180GUI: change serialization namespace
......@@ -74,14 +74,14 @@ void Serialize::rwProperty(Streamer& s, const QString& tag, DoubleProperty& d)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
GUI::Session::XML::writeAttribute(w, XML::Tags::Value, d.value());
w->writeAttribute(XML::Tags::Id, d.uid());
GUI::Session::XML::writeAttribute(w, StreamerXML::Tags::Value, d.value());
w->writeAttribute(StreamerXML::Tags::Id, d.uid());
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
d.setValue(r->attributes().value(XML::Tags::Value).toDouble());
d.setUid(r->attributes().value(XML::Tags::Id).toString());
d.setValue(r->attributes().value(StreamerXML::Tags::Value).toDouble());
d.setUid(r->attributes().value(StreamerXML::Tags::Id).toString());
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......
......@@ -20,12 +20,12 @@ void Serialize::rwValue(Streamer& s, const QString& tag, bool& val)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
w->writeAttribute(XML::Tags::Value, val ? "1" : "0");
w->writeAttribute(StreamerXML::Tags::Value, val ? "1" : "0");
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
val = r->attributes().value(XML::Tags::Value).toUInt() > 0;
val = r->attributes().value(StreamerXML::Tags::Value).toUInt() > 0;
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......@@ -35,12 +35,12 @@ void Serialize::rwValue(Streamer& s, const QString& tag, int& val)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
w->writeAttribute(XML::Tags::Value, QString::number(val));
w->writeAttribute(StreamerXML::Tags::Value, QString::number(val));
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
val = r->attributes().value(XML::Tags::Value).toInt();
val = r->attributes().value(StreamerXML::Tags::Value).toInt();
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......@@ -50,12 +50,12 @@ void Serialize::rwValue(Streamer& s, const QString& tag, uint& val)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
w->writeAttribute(XML::Tags::Value, QString::number(val));
w->writeAttribute(StreamerXML::Tags::Value, QString::number(val));
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
val = r->attributes().value(XML::Tags::Value).toInt();
val = r->attributes().value(StreamerXML::Tags::Value).toInt();
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......@@ -65,12 +65,12 @@ void Serialize::rwValue(Streamer& s, const QString& tag, double& val)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
GUI::Session::XML::writeAttribute(w, XML::Tags::Value, val);
GUI::Session::XML::writeAttribute(w, StreamerXML::Tags::Value, val);
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
val = r->attributes().value(XML::Tags::Value).toDouble();
val = r->attributes().value(StreamerXML::Tags::Value).toDouble();
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......@@ -80,12 +80,12 @@ void Serialize::rwValue(Streamer& s, const QString& tag, QString& val)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
w->writeAttribute(XML::Tags::Value, val);
w->writeAttribute(StreamerXML::Tags::Value, val);
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
GUI::Session::XML::readAttribute(r, XML::Tags::Value, &val);
GUI::Session::XML::readAttribute(r, StreamerXML::Tags::Value, &val);
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......@@ -95,12 +95,12 @@ void Serialize::rwValue(Streamer& s, const QString& tag, QColor& col)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
w->writeAttribute(XML::Tags::Value, col.isValid() ? col.name(QColor::HexArgb) : "");
w->writeAttribute(StreamerXML::Tags::Value, col.isValid() ? col.name(QColor::HexArgb) : "");
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
r->readNextStartElement();
s.assertCurrentTag(tag);
QString colName = r->attributes().value(XML::Tags::Value).toString();
QString colName = r->attributes().value(StreamerXML::Tags::Value).toString();
col = QColor(colName);
s.gotoEndElementOfTag(tag);
} else
......@@ -127,11 +127,11 @@ void Serialize::rwValue(Streamer& s, const QString& tag, R3& val)
{
if (QXmlStreamWriter* w = s.xmlWriter()) {
w->writeStartElement(tag);
GUI::Session::XML::writeAttribute(w, XML::Tags::Value, val);
GUI::Session::XML::writeAttribute(w, StreamerXML::Tags::Value, val);
w->writeEndElement();
} else if (QXmlStreamReader* r = s.xmlReader()) {
s.gotoStartElementOfTag(tag);
GUI::Session::XML::readAttribute(r, XML::Tags::Value, &val);
GUI::Session::XML::readAttribute(r, StreamerXML::Tags::Value, &val);
s.gotoEndElementOfTag(tag);
} else
ASSERT(0);
......
......@@ -20,7 +20,7 @@ void Streamer::writeVersion(unsigned version) const
{
if (!m_w)
return;
m_w->writeAttribute(XML::Tags::Version, QString::number(version));
m_w->writeAttribute(StreamerXML::Tags::Version, QString::number(version));
}
void Streamer::assertVersion(unsigned expectedVersion) const
......@@ -28,7 +28,7 @@ void Streamer::assertVersion(unsigned expectedVersion) const
if (!m_r)
return;
const auto foundAsStr = m_r->attributes().value(XML::Tags::Version);
const auto foundAsStr = m_r->attributes().value(StreamerXML::Tags::Version);
const unsigned found = foundAsStr.isEmpty() ? 0 : foundAsStr.toUInt();
if (found < expectedVersion)
throw DeserializationException::tooOld();
......
......@@ -20,7 +20,7 @@
#include <functional>
#include <heinz/Vectors3D.h>
namespace XML {
namespace StreamerXML {
namespace Tags {
constexpr auto Id("id");
constexpr auto Value("value");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment