Refactoring method VDomDocument::SetAttribute().

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-07-20 18:59:35 +03:00
parent dbcea3a979
commit 8d56b872dc

View File

@ -139,9 +139,7 @@ template <typename T>
*/ */
inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const T &value) const inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
{ {
QString val = QString().setNum(value); domElement.setAttribute(name, QString().setNum(value).replace(QLatin1String(","), QLatin1String(".")));
val = val.replace(",", ".");
domElement.setAttribute(name, val);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -156,16 +154,7 @@ inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const Q
template <> template <>
inline void VDomDocument::SetAttribute<bool>(QDomElement &domElement, const QString &name, const bool &value) const inline void VDomDocument::SetAttribute<bool>(QDomElement &domElement, const QString &name, const bool &value) const
{ {
QString string; domElement.setAttribute(name, value ? QStringLiteral("true") : QStringLiteral("false"));
if (value)
{
string = "true";
}
else
{
string = "false";
}
domElement.setAttribute(name, string);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -173,14 +162,8 @@ template <>
inline void VDomDocument::SetAttribute<MeasurementsType>(QDomElement &domElement, const QString &name, inline void VDomDocument::SetAttribute<MeasurementsType>(QDomElement &domElement, const QString &name,
const MeasurementsType &value) const const MeasurementsType &value) const
{ {
if (value == MeasurementsType::Standard) domElement.setAttribute(name, value == MeasurementsType::Standard ? QStringLiteral("standard") :
{ QStringLiteral("individual"));
domElement.setAttribute(name, "standard");
}
else
{
domElement.setAttribute(name, "individual");
}
} }
#ifdef Q_CC_GNU #ifdef Q_CC_GNU