MyMoneyKeyValueContainer Class Reference

#include <mymoneykeyvaluecontainer.h>

Inheritance diagram for MyMoneyKeyValueContainer:

KOnlineBankingSetupWizard::ListViewItem MyMoneyAccount MyMoneyDatabaseMgr MyMoneyInstitution MyMoneySecurity MyMoneySeqAccessMgr MyMoneySplit MyMoneyTransaction
Collaboration diagram for MyMoneyKeyValueContainer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MyMoneyKeyValueContainer ()
 MyMoneyKeyValueContainer (const QDomElement &node)
 ~MyMoneyKeyValueContainer ()
const QString & value (const QString &key) const
void setValue (const QString &key, const QString &value)
void deletePair (const QString &key)
void clear (void)
const QMap< QString, QString > & pairs (void) const
void setPairs (const QMap< QString, QString > &list)
bool operator== (const MyMoneyKeyValueContainer &) const
const QString & operator[] (const QString &k) const
QString & operator[] (const QString &k)
void writeXML (QDomDocument &document, QDomElement &parent) const

Private Attributes

QMap< QString, QString > m_kvp


Detailed Description

Author:
Thomas Baumgart This class implements a container for key/value pairs. This is used to store an arbitrary number of attributes with any of the engine object. The container can also be used to have attributes that are attached to this object only for a limited time (e.g. between start of reconciliation end it's end).
To give any class the ability to have a key/value pair container, just derive the class from this one. See MyMoneyAccount as an example.

Constructor & Destructor Documentation

MyMoneyKeyValueContainer::MyMoneyKeyValueContainer (  ) 

MyMoneyKeyValueContainer::MyMoneyKeyValueContainer ( const QDomElement &  node  ) 

MyMoneyKeyValueContainer::~MyMoneyKeyValueContainer (  ) 


Member Function Documentation

const QString& MyMoneyKeyValueContainer::value ( const QString &  key  )  const

This method can be used to retrieve the value for a specific key. If the key is unknown in this container, an empty string will be returned.

Parameters:
key const reference to QString with the key to search for
Returns:
reference to value of this key. If the key does not exist, an emtpy string is returned.

Reimplemented in MyMoneySplit, MyMoneyDatabaseMgr, and MyMoneySeqAccessMgr.

void MyMoneyKeyValueContainer::setValue ( const QString &  key,
const QString &  value 
)

This method is used to add a key/value pair to the container or modify an existing pair.

Parameters:
key const reference to QString with the key to search for
value const reference to QString with the value for this key

Reimplemented in MyMoneySplit, MyMoneyDatabaseMgr, and MyMoneySeqAccessMgr.

void MyMoneyKeyValueContainer::deletePair ( const QString &  key  ) 

This method is used to remove an existing key/value pair from the container. If the key does not exist, the container is not changed.

Parameters:
key const reference to QString with the key to remove

Reimplemented in MyMoneyDatabaseMgr, and MyMoneySeqAccessMgr.

void MyMoneyKeyValueContainer::clear ( void   ) 

This method clears all pairs currently in the container.

const QMap<QString, QString>& MyMoneyKeyValueContainer::pairs ( void   )  const [inline]

This method is used to retrieve the whole set of key/value pairs from the container. It is meant to be used for permanent storage functionality.

Returns:
QMap<QString, QString> containing all key/value pairs of this container.

Reimplemented in MyMoneyDatabaseMgr, and MyMoneySeqAccessMgr.

void MyMoneyKeyValueContainer::setPairs ( const QMap< QString, QString > &  list  ) 

This method is used to initially store a set of key/value pairs in the container. It is meant to be used for loading functionality from permanent storage.

Parameters:
list const QMap<QString, QString> containing the set of key/value pairs to be loaded into the container.
Note:
All existing key/value pairs in the container will be deleted.

Reimplemented in MyMoneyDatabaseMgr, and MyMoneySeqAccessMgr.

bool MyMoneyKeyValueContainer::operator== ( const MyMoneyKeyValueContainer  )  const

This operator tests for equality of two MyMoneyKeyValueContainer objects

const QString& MyMoneyKeyValueContainer::operator[] ( const QString &  k  )  const [inline]

QString& MyMoneyKeyValueContainer::operator[] ( const QString &  k  )  [inline]

void MyMoneyKeyValueContainer::writeXML ( QDomDocument &  document,
QDomElement &  parent 
) const

This method creates a QDomElement for the document under the parent node parent.

Parameters:
document reference to QDomDocument
parent reference to QDomElement parent node

Reimplemented in MyMoneyAccount, MyMoneyInstitution, MyMoneySecurity, MyMoneySplit, and MyMoneyTransaction.


Member Data Documentation

QMap<QString, QString> MyMoneyKeyValueContainer::m_kvp [private]

This member variable represents the container of key/value pairs.


The documentation for this class was generated from the following file:

Generated on Wed Jan 26 13:09:16 2011 for KMyMoney by  doxygen 1.5.6