summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/mymoneyobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/mymoney/mymoneyobject.cpp')
-rw-r--r--kmymoney2/mymoney/mymoneyobject.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/kmymoney2/mymoney/mymoneyobject.cpp b/kmymoney2/mymoney/mymoneyobject.cpp
new file mode 100644
index 0000000..7939ff0
--- /dev/null
+++ b/kmymoney2/mymoney/mymoneyobject.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+ mymoneyobject.cpp
+ -------------------
+ copyright : (C) 2005 by Thomas Baumagrt
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "mymoneyobject.h"
+#include "mymoneyutils.h"
+#include "mymoneyexception.h"
+
+const QString MyMoneyObject::m_emptyId;
+
+MyMoneyObject::MyMoneyObject(const QString& id)
+{
+ m_id = id;
+}
+
+MyMoneyObject::MyMoneyObject(const QDomElement& el, const bool forceId)
+{
+ m_id = QStringEmpty(el.attribute("id"));
+ if(m_id.length() == 0 && forceId)
+ throw new MYMONEYEXCEPTION("Node has no ID");
+}
+
+MyMoneyObject::MyMoneyObject()
+{
+}
+
+MyMoneyObject::~MyMoneyObject()
+{
+}
+
+void MyMoneyObject::setId(const QString& id)
+{
+ m_id = id;
+}
+
+bool MyMoneyObject::operator == (const MyMoneyObject& right) const
+{
+ return m_id == right.m_id;
+}
+
+void MyMoneyObject::clearId(void)
+{
+ m_id = QString();
+}
+
+const QString& MyMoneyObject::emptyId(void)
+{
+ return m_emptyId;
+}
+
+void MyMoneyObject::writeBaseXML(QDomDocument& document, QDomElement& el) const
+{
+ Q_UNUSED(document);
+
+ el.setAttribute("id", m_id);
+}