summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/mymoneyobject.cpp
blob: a415a7c5151d1ef69ae206641de0b35c0567cc50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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 TQString MyMoneyObject::m_emptyId;

MyMoneyObject::MyMoneyObject(const TQString& id)
{
  m_id = id;
}

MyMoneyObject::MyMoneyObject(const TQDomElement& el, const bool forceId)
{
  m_id = TQStringEmpty(el.attribute("id"));
  if(m_id.length() == 0 && forceId)
    throw new MYMONEYEXCEPTION("Node has no ID");
}

MyMoneyObject::MyMoneyObject()
{
}

MyMoneyObject::~MyMoneyObject()
{
}

void MyMoneyObject::setId(const TQString& id)
{
  m_id = id;
}

bool MyMoneyObject::operator == (const MyMoneyObject& right) const
{
  return m_id == right.m_id;
}

void MyMoneyObject::clearId(void)
{
  m_id = TQString();
}

const TQString& MyMoneyObject::emptyId(void)
{
  return m_emptyId;
}

void MyMoneyObject::writeBaseXML(TQDomDocument& document, TQDomElement& el) const
{
  Q_UNUSED(document);

  el.setAttribute("id", m_id);
}