From 8d56b872dce230a571fac24ea33bc88788f30d78 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 20 Jul 2016 18:59:35 +0300 Subject: [PATCH] Refactoring method VDomDocument::SetAttribute(). --HG-- branch : develop --- src/libs/ifc/xml/vdomdocument.h | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h index 4972d7796..6c51cacee 100644 --- a/src/libs/ifc/xml/vdomdocument.h +++ b/src/libs/ifc/xml/vdomdocument.h @@ -139,9 +139,7 @@ template */ inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const T &value) const { - QString val = QString().setNum(value); - val = val.replace(",", "."); - domElement.setAttribute(name, val); + domElement.setAttribute(name, QString().setNum(value).replace(QLatin1String(","), QLatin1String("."))); } //--------------------------------------------------------------------------------------------------------------------- @@ -156,16 +154,7 @@ inline void VDomDocument::SetAttribute(QDomElement &domElement, const Q template <> inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const bool &value) const { - QString string; - if (value) - { - string = "true"; - } - else - { - string = "false"; - } - domElement.setAttribute(name, string); + domElement.setAttribute(name, value ? QStringLiteral("true") : QStringLiteral("false")); } //--------------------------------------------------------------------------------------------------------------------- @@ -173,14 +162,8 @@ template <> inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const MeasurementsType &value) const { - if (value == MeasurementsType::Standard) - { - domElement.setAttribute(name, "standard"); - } - else - { - domElement.setAttribute(name, "individual"); - } + domElement.setAttribute(name, value == MeasurementsType::Standard ? QStringLiteral("standard") : + QStringLiteral("individual")); } #ifdef Q_CC_GNU