diff options
author | Radovan Zivkovic <pivonroll@gmail.com> | 2013-10-05 19:10:45 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-03-11 19:54:58 +0100 |
commit | 0f8f92d0655d0236b848fd58570aed17c2b13a09 (patch) | |
tree | 562b4eefa84d2587dec8919f1ff7237a275c2c96 | |
parent | 011edfc569d468ff919c11f915ac6b3fd92ee9ee (diff) | |
download | qt-creator-0f8f92d0655d0236b848fd58570aed17c2b13a09.tar.gz |
DeploymentTool uses GeneralAttributeContainer.
Change-Id: Ia2546260218bc7baaed7473b03baa5e4ed812e82
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
3 files changed, 15 insertions, 35 deletions
diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp index 9dcd1184ee..0afd0da71a 100644 --- a/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp +++ b/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp @@ -336,7 +336,7 @@ QList<DeploymentTool::Ptr> Configuration2005::deploymentTools(const QString &att QList<DeploymentTool::Ptr> deploymentTools; foreach (const DeploymentTool::Ptr &tool, m_deploymentTools) { - if (tool->attributeValue(attributeName) == attributeValue) + if (tool->attributeContainer()->attributeValue(attributeName) == attributeValue) deploymentTools.append(tool); } return deploymentTools; diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.cpp index b2d1fe5fa9..d4d4b4036d 100644 --- a/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.cpp +++ b/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.cpp @@ -28,23 +28,26 @@ ** ****************************************************************************/ #include "deploymenttool.h" +#include "generalattributecontainer.h" namespace VcProjectManager { namespace Internal { DeploymentTool::DeploymentTool() { + m_attributeContainer = new GeneralAttributeContainer; } DeploymentTool::DeploymentTool(const DeploymentTool &tool) { - m_anyAttribute = tool.m_anyAttribute; + m_attributeContainer = new GeneralAttributeContainer; + *m_attributeContainer = *tool.m_attributeContainer; } DeploymentTool &DeploymentTool::operator=(const DeploymentTool &tool) { if (this != &tool) - m_anyAttribute = tool.m_anyAttribute; + *m_attributeContainer = *tool.m_attributeContainer; return *this; } @@ -65,36 +68,13 @@ VcNodeWidget *DeploymentTool::createSettingsWidget() QDomNode DeploymentTool::toXMLDomNode(QDomDocument &domXMLDocument) const { QDomElement toolNode = domXMLDocument.createElement(QLatin1String("DeploymentTool")); - - QHashIterator<QString, QString> it(m_anyAttribute); - - while (it.hasNext()) { - it.next(); - toolNode.setAttribute(it.key(), it.value()); - } - + m_attributeContainer->appendToXMLNode(toolNode); return toolNode; } -QString DeploymentTool::attributeValue(const QString &attributeName) const -{ - return m_anyAttribute.value(attributeName); -} - -void DeploymentTool::setAttribute(const QString &attributeName, const QString &attributeValue) -{ - m_anyAttribute.insert(attributeName, attributeValue); -} - -void DeploymentTool::clearAttribute(const QString &attributeName) -{ - if (m_anyAttribute.contains(attributeName)) - m_anyAttribute.insert(attributeName, QString()); -} - -void DeploymentTool::removeAttribute(const QString &attributeName) +IAttributeContainer *DeploymentTool::attributeContainer() const { - m_anyAttribute.remove(attributeName); + return m_attributeContainer; } void DeploymentTool::processNodeAttributes(const QDomElement &element) @@ -106,7 +86,7 @@ void DeploymentTool::processNodeAttributes(const QDomElement &element) if (domNode.nodeType() == QDomNode::AttributeNode) { QDomAttr domElement = domNode.toAttr(); - m_anyAttribute.insert(domElement.name(), domElement.value()); + m_attributeContainer->setAttribute(domElement.name(), domElement.value()); } } } diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.h b/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.h index 53e397369a..f59552b979 100644 --- a/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.h +++ b/src/plugins/vcprojectmanager/vcprojectmodel/deploymenttool.h @@ -38,6 +38,9 @@ namespace VcProjectManager { namespace Internal { +class IAttributeContainer; +class GeneralAttributeContainer; + class DeploymentTool : public IVcProjectXMLNode { public: @@ -52,15 +55,12 @@ public: VcNodeWidget* createSettingsWidget(); QDomNode toXMLDomNode(QDomDocument &domXMLDocument) const; - QString attributeValue(const QString &attributeName) const; - void setAttribute(const QString &attributeName, const QString &attributeValue); - void clearAttribute(const QString &attributeName); - void removeAttribute(const QString &attributeName); + IAttributeContainer *attributeContainer() const; private: void processNodeAttributes(const QDomElement &element); - QHash<QString, QString> m_anyAttribute; + GeneralAttributeContainer *m_attributeContainer; }; } // namespace Internal |