From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/mymoney/mymoneyobject.cpp | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 kmymoney2/mymoney/mymoneyobject.cpp (limited to 'kmymoney2/mymoney/mymoneyobject.cpp') 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 + email : ipwizard@users.sourceforge.net + ***************************************************************************/ + +/*************************************************************************** + * * + * 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); +} -- cgit v1.2.3