summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadovan Zivkovic <pivonroll@gmail.com>2013-10-05 19:04:34 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2014-03-11 19:54:58 +0100
commit011edfc569d468ff919c11f915ac6b3fd92ee9ee (patch)
tree556e20e09b3bbaa03a3c876cd2249ae3bd0fc0e0
parent957b78f69b1a06dd73f86f7116a1462c58ca890c (diff)
downloadqt-creator-011edfc569d468ff919c11f915ac6b3fd92ee9ee.tar.gz
DebuggerTool uses GeneralAttributeContainer.
Change-Id: I86192a3aff0d5c576a614fd83a7bb521c28f1149 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
-rw-r--r--src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp2
-rw-r--r--src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.cpp38
-rw-r--r--src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.h11
-rw-r--r--src/plugins/vcprojectmanager/vcprojectmodel/generalattributecontainer.cpp7
4 files changed, 17 insertions, 41 deletions
diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp
index 56a5131c57..9dcd1184ee 100644
--- a/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp
+++ b/src/plugins/vcprojectmanager/vcprojectmodel/configuration.cpp
@@ -472,7 +472,7 @@ QList<DebuggerTool::Ptr> Configuration2008::debuggerTools(const QString &attribu
QList<DebuggerTool::Ptr> debuggerTools;
foreach (const DebuggerTool::Ptr &tool, m_debuggerTools) {
- if (tool->attributeValue(attributeName) == attributeValue)
+ if (tool->attributeContainer()->attributeValue(attributeName) == attributeValue)
debuggerTools.append(tool);
}
return debuggerTools;
diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.cpp
index f44934d1fe..86f90e4176 100644
--- a/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.cpp
+++ b/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.cpp
@@ -28,23 +28,26 @@
**
****************************************************************************/
#include "debuggertool.h"
+#include "generalattributecontainer.h"
namespace VcProjectManager {
namespace Internal {
DebuggerTool::DebuggerTool()
{
+ m_attributeContainer = new GeneralAttributeContainer;
}
DebuggerTool::DebuggerTool(DebuggerTool &tool)
{
- m_anyAttribute = tool.m_anyAttribute;
+ m_attributeContainer = new GeneralAttributeContainer;
+ *m_attributeContainer = *tool.m_attributeContainer;
}
DebuggerTool &DebuggerTool::operator=(DebuggerTool &tool)
{
if (this != &tool)
- m_anyAttribute = tool.m_anyAttribute;
+ *m_attributeContainer = *tool.m_attributeContainer;
return *this;
}
@@ -69,36 +72,13 @@ VcNodeWidget *DebuggerTool::createSettingsWidget()
QDomNode DebuggerTool::toXMLDomNode(QDomDocument &domXMLDocument) const
{
QDomElement toolNode = domXMLDocument.createElement(QLatin1String("DebuggerTool"));
-
- QHashIterator<QString, QString> it(m_anyAttribute);
-
- while (it.hasNext()) {
- it.next();
- toolNode.setAttribute(it.key(), it.value());
- }
-
+ m_attributeContainer->appendToXMLNode(toolNode);
return toolNode;
}
-QString DebuggerTool::attributeValue(const QString &attributeName) const
-{
- return m_anyAttribute.value(attributeName);
-}
-
-void DebuggerTool::setAttribute(const QString &attributeName, const QString &attributeValue)
-{
- m_anyAttribute.insert(attributeName, attributeValue);
-}
-
-void DebuggerTool::clearAttribute(const QString &attributeName)
-{
- if (m_anyAttribute.contains(attributeName))
- m_anyAttribute.insert(attributeName, QString());
-}
-
-void DebuggerTool::removeAttribute(const QString &attributeName)
+IAttributeContainer *DebuggerTool::attributeContainer() const
{
- m_anyAttribute.remove(attributeName);
+ return m_attributeContainer;
}
void DebuggerTool::processNodeAttributes(const QDomElement &element)
@@ -110,7 +90,7 @@ void DebuggerTool::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/debuggertool.h b/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.h
index 865df21274..cc071f0cbc 100644
--- a/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.h
+++ b/src/plugins/vcprojectmanager/vcprojectmodel/debuggertool.h
@@ -32,12 +32,14 @@
#include "ivcprojectnodemodel.h"
-#include <QHash>
#include <QSharedPointer>
namespace VcProjectManager {
namespace Internal {
+class IAttributeContainer;
+class GeneralAttributeContainer;
+
class DebuggerTool : public IVcProjectXMLNode
{
public:
@@ -52,15 +54,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
diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/generalattributecontainer.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/generalattributecontainer.cpp
index c0ccc50342..6d57e7ccc6 100644
--- a/src/plugins/vcprojectmanager/vcprojectmodel/generalattributecontainer.cpp
+++ b/src/plugins/vcprojectmanager/vcprojectmodel/generalattributecontainer.cpp
@@ -45,12 +45,9 @@ GeneralAttributeContainer &GeneralAttributeContainer::operator=(const GeneralAtt
{
if (this != &attrCont) {
m_anyAttribute.clear();
- for (int i = 0; i < attrCont.getAttributeCount(); ++i) {
- QString attrName = attrCont.getAttributeName(i);
- m_anyAttribute.insert(attrName, attrCont.attributeValue(attrName));
- }
+ for (int i = 0; i < attrCont.getAttributeCount(); ++i)
+ m_anyAttribute.insert(attrCont.getAttributeName(i), attrCont.attributeValue(attrCont.getAttributeName(i)));
}
-
return *this;
}