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

rename 'name'-->'tag' in readFrom methods

parent 9f797a37
No related branches found
No related tags found
1 merge request!1191GUI: serialization refactoring part 3
......@@ -290,27 +290,27 @@ void DataItem::readFrom(QXmlStreamReader* r)
Q_UNUSED(version)
while (r->readNextStartElement()) {
QString name = r->name().toString();
QString tag = r->name().toString();
// file name
if (name == Tag::FileName) {
if (tag == Tag::FileName) {
XML::readAttribute(r, XML::Attrib::value, &m_fileName);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// axes units
} else if (name == Tag::AxesUnits) {
} else if (tag == Tag::AxesUnits) {
m_axesUnits.readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// x axis
} else if (name == Tag::XAxis) {
} else if (tag == Tag::XAxis) {
m_xAxis->readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// y axis
} else if (name == Tag::YAxis) {
} else if (tag == Tag::YAxis) {
m_yAxis->readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
} else
r->skipCurrentElement();
......
......@@ -345,27 +345,27 @@ void IntensityDataItem::readFrom(QXmlStreamReader* r)
Q_UNUSED(version)
while (r->readNextStartElement()) {
QString name = r->name().toString();
QString tag = r->name().toString();
// parameters from base class
if (name == Tag::BaseData) {
if (tag == Tag::BaseData) {
DataItem::readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// interpolation
} else if (name == Tag::Interpolation) {
} else if (tag == Tag::Interpolation) {
XML::readAttribute(r, XML::Attrib::value, &m_isInterpolated);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// gradient
} else if (name == Tag::Gradient) {
} else if (tag == Tag::Gradient) {
m_gradient.readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// z axis
} else if (name == Tag::ZAxis) {
} else if (tag == Tag::ZAxis) {
m_zAxis->readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
} else
r->skipCurrentElement();
......
......@@ -248,39 +248,39 @@ void SpecularDataItem::readFrom(QXmlStreamReader* r)
Q_UNUSED(version)
while (r->readNextStartElement()) {
QString name = r->name().toString();
QString tag = r->name().toString();
// parameters from base class
if (name == Tag::BaseData) {
if (tag == Tag::BaseData) {
DataItem::readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// line type
} else if (name == Tag::LineType) {
} else if (tag == Tag::LineType) {
XML::readAttribute(r, XML::Attrib::value, &m_lineType);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// color
} else if (name == Tag::Color) {
} else if (tag == Tag::Color) {
QString col;
XML::readAttribute(r, XML::Attrib::value, &col);
m_color = QColor(col);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// thickness
} else if (name == Tag::Thickness) {
} else if (tag == Tag::Thickness) {
XML::readAttribute(r, XML::Attrib::value, &m_thickness);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// scatter type
} else if (name == Tag::ScatterType) {
} else if (tag == Tag::ScatterType) {
XML::readAttribute(r, XML::Attrib::value, &m_scatterType);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// scatter size
} else if (name == Tag::ScatterSize) {
} else if (tag == Tag::ScatterSize) {
XML::readAttribute(r, XML::Attrib::value, &m_scatterSize);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
} else
r->skipCurrentElement();
......
......@@ -106,22 +106,22 @@ void VectorProperty::readFrom(QXmlStreamReader *r)
Q_UNUSED(version)
while (r->readNextStartElement()) {
QString name = r->name().toString();
QString tag = r->name().toString();
// X
if (name == Tag::X) {
if (tag == Tag::X) {
m_x.readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// Y
} else if (name == Tag::Y) {
} else if (tag == Tag::Y) {
m_y.readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// Z
} else if (name == Tag::Z) {
} else if (tag == Tag::Z) {
m_z.readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
} else
r->skipCurrentElement();
......
......@@ -361,20 +361,20 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
}
while (reader.readNextStartElement()) {
QString name = reader.name().toString();
QString tag = reader.name().toString();
if (name == Tag::DocumentInfo) {
if (tag == Tag::DocumentInfo) {
reader.skipCurrentElement();
// simulation options
} else if (name == Tag::SimulationOptions) {
} else if (tag == Tag::SimulationOptions) {
m_simulationOptionsItem.readFrom(&reader);
XML::gotoEndElementOfTag(&reader, name);
XML::gotoEndElementOfTag(&reader, tag);
// samples
} else if (name == Tag::Samples) {
m_sampleItems.readFrom(&reader);
XML::gotoEndElementOfTag(&reader, name);
XML::gotoEndElementOfTag(&reader, tag);
} else if (reader.name() == Tag::Instruments) {
Streamer s(&reader);
......
......@@ -77,12 +77,12 @@ void SampleModel::readFrom(QXmlStreamReader* r)
Q_UNUSED(version)
while (r->readNextStartElement()) {
QString name = r->name().toString();
QString tag = r->name().toString();
// sample
if (name == Tag::Sample) {
if (tag == Tag::Sample) {
addSample()->readFrom(r);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
} else
r->skipCurrentElement();
......
......@@ -157,37 +157,37 @@ void SimulationOptionsItem::readFrom(QXmlStreamReader* r)
Q_UNUSED(version)
while (r->readNextStartElement()) {
QString name = r->name().toString();
QString tag = r->name().toString();
// run immediately?
if (name == Tag::RunImmediately) {
if (tag == Tag::RunImmediately) {
XML::readAttribute(r, XML::Attrib::value, &m_runImmediately);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// number of threads
} else if (name == Tag::NumberOfThreads) {
} else if (tag == Tag::NumberOfThreads) {
XML::readAttribute(r, XML::Attrib::value, &m_numberOfThreads);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// computation method
} else if (name == Tag::Analytical) {
} else if (tag == Tag::Analytical) {
XML::readAttribute(r, XML::Attrib::value, &m_computationMethodAnalytical);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// number of Monte Carlo points
} else if (name == Tag::NumberOfMonteCarloPoints) {
} else if (tag == Tag::NumberOfMonteCarloPoints) {
XML::readAttribute(r, XML::Attrib::value, &m_numberOfMonteCarloPoints);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// use average materials
} else if (name == Tag::UseAverageMaterials) {
} else if (tag == Tag::UseAverageMaterials) {
XML::readAttribute(r, XML::Attrib::value, &m_useAverageMaterials);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
// include specular peak
} else if (name == Tag::IncludeSpecularPeak) {
} else if (tag == Tag::IncludeSpecularPeak) {
XML::readAttribute(r, XML::Attrib::value, &m_includeSpecularPeak);
XML::gotoEndElementOfTag(r, name);
XML::gotoEndElementOfTag(r, tag);
} else
r->skipCurrentElement();
......
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