summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/storage/mymoneymap.h
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/mymoney/storage/mymoneymap.h')
-rw-r--r--kmymoney2/mymoney/storage/mymoneymap.h84
1 files changed, 42 insertions, 42 deletions
diff --git a/kmymoney2/mymoney/storage/mymoneymap.h b/kmymoney2/mymoney/storage/mymoneymap.h
index fa5cda8..7582112 100644
--- a/kmymoney2/mymoney/storage/mymoneymap.h
+++ b/kmymoney2/mymoney/storage/mymoneymap.h
@@ -1,6 +1,6 @@
#include <stdint.h>
-#include <qmap.h>
-#include <qptrstack.h>
+#include <tqmap.h>
+#include <tqptrstack.h>
#include <kmymoney/mymoneyexception.h>
#ifndef MYMONEYMAP_H
@@ -11,7 +11,7 @@
/**
* @author Thomas Baumgart
*
- * This template class adds transaction security to the QMap<> class.
+ * This template class adds transaction security to the TQMap<> class.
* The interface is very simple. Before you perform any changes,
* you have to call the startTransaction() method. Then you can use
* the insert(), modify() and remove() methods to modify the map.
@@ -25,12 +25,12 @@
* someone is interested.
*/
template <class Key, class T>
-class MyMoneyMap : protected QMap<Key, T>
+class MyMoneyMap : protected TQMap<Key, T>
{
public:
- // typedef QMapConstIterator<Key, T> const_iterator;
+ // typedef TQMapConstIterator<Key, T> const_iterator;
- MyMoneyMap() : QMap<Key, T>() {}
+ MyMoneyMap() : TQMap<Key, T>() {}
virtual ~MyMoneyMap() {}
void startTransaction(unsigned long* id = 0)
@@ -78,7 +78,7 @@ public:
throw new MYMONEYEXCEPTION("No transaction started to modify element in container");
#if 0
- // had to take this out, because we use QPair in one instance as key
+ // had to take this out, because we use TQPair in one instance as key
if(key.isEmpty())
throw new MYMONEYEXCEPTION("No key to update object");
#endif
@@ -92,7 +92,7 @@ public:
throw new MYMONEYEXCEPTION("No transaction started to remove element from container");
#if 0
- // had to take this out, because we use QPair in one instance as key
+ // had to take this out, because we use TQPair in one instance as key
if(key.isEmpty())
throw new MYMONEYEXCEPTION("No key to remove object");
#endif
@@ -100,59 +100,59 @@ public:
m_stack.push(new MyMoneyMapRemove(this, key));
}
- MyMoneyMap<Key, T>& operator= (const QMap<Key, T>& m)
+ MyMoneyMap<Key, T>& operator= (const TQMap<Key, T>& m)
{
if(m_stack.count() != 0) {
throw new MYMONEYEXCEPTION("Cannot assign whole container during transaction");
}
- QMap<Key, T>::operator=(m);
+ TQMap<Key, T>::operator=(m);
return *this;
}
- inline QValueList<T> values(void) const
+ inline TQValueList<T> values(void) const
{
- return QMap<Key,T>::values();
+ return TQMap<Key,T>::values();
}
- inline QValueList<Key> keys(void) const
+ inline TQValueList<Key> keys(void) const
{
- return QMap<Key,T>::keys();
+ return TQMap<Key,T>::keys();
}
const T& operator[] ( const Key& k ) const
- { QT_CHECK_INVALID_MAP_ELEMENT; return QMap<Key,T>::operator[](k); }
+ { TQT_CHECK_INVALID_MAP_ELEMENT; return TQMap<Key,T>::operator[](k); }
- inline Q_TYPENAME QMap<Key, T>::const_iterator find(const Key& k) const
+ inline TQ_TYPENAME TQMap<Key, T>::const_iterator tqfind(const Key& k) const
{
- return QMap<Key,T>::find(k);
+ return TQMap<Key,T>::tqfind(k);
}
- inline Q_TYPENAME QMap<Key, T>::const_iterator begin(void) const
+ inline TQ_TYPENAME TQMap<Key, T>::const_iterator begin(void) const
{
- return QMap<Key,T>::begin();
+ return TQMap<Key,T>::begin();
}
- inline Q_TYPENAME QMap<Key, T>::const_iterator end(void) const
+ inline TQ_TYPENAME TQMap<Key, T>::const_iterator end(void) const
{
- return QMap<Key,T>::end();
+ return TQMap<Key,T>::end();
}
- inline bool contains(const Key& k) const
+ inline bool tqcontains(const Key& k) const
{
- return find(k) != end();
+ return tqfind(k) != end();
}
- inline void map(QMap<Key, T>& that) const
+ inline void map(TQMap<Key, T>& that) const
{
- //QMap<Key, T>* ptr = dynamic_cast<QMap<Key, T>* >(this);
+ //TQMap<Key, T>* ptr = dynamic_cast<TQMap<Key, T>* >(this);
//that = *ptr;
- that = *(dynamic_cast<QMap<Key, T>* >(const_cast<MyMoneyMap<Key, T>* >(this)));
+ that = *(dynamic_cast<TQMap<Key, T>* >(const_cast<MyMoneyMap<Key, T>* >(this)));
}
inline size_t count(void) const
{
- return QMap<Key, T>::count();
+ return TQMap<Key, T>::count();
}
#if MY_OWN_DEBUG
@@ -173,10 +173,10 @@ private:
class MyMoneyMapAction
{
public:
- MyMoneyMapAction(QMap<Key, T>* container) :
+ MyMoneyMapAction(TQMap<Key, T>* container) :
m_container(container) {}
- MyMoneyMapAction(QMap<Key, T>* container, const Key& key, const T& obj) :
+ MyMoneyMapAction(TQMap<Key, T>* container, const Key& key, const T& obj) :
m_container(container),
m_obj(obj),
m_key(key) {}
@@ -185,7 +185,7 @@ private:
virtual void undo(void) = 0;
protected:
- QMap<Key, T>* m_container;
+ TQMap<Key, T>* m_container;
T m_obj;
Key m_key;
};
@@ -193,7 +193,7 @@ private:
class MyMoneyMapStart : public MyMoneyMapAction
{
public:
- MyMoneyMapStart(QMap<Key, T>* container, unsigned long* id) :
+ MyMoneyMapStart(TQMap<Key, T>* container, unsigned long* id) :
MyMoneyMapAction(container),
m_idPtr(id)
{
@@ -215,7 +215,7 @@ private:
class MyMoneyMapInsert : public MyMoneyMapAction
{
public:
- MyMoneyMapInsert(QMap<Key, T>* container, const Key& key, const T& obj) :
+ MyMoneyMapInsert(TQMap<Key, T>* container, const Key& key, const T& obj) :
MyMoneyMapAction(container, key, obj)
{
(*container)[key] = obj;
@@ -233,7 +233,7 @@ private:
class MyMoneyMapRemove : public MyMoneyMapAction
{
public:
- MyMoneyMapRemove(QMap<Key, T>* container, const Key& key) :
+ MyMoneyMapRemove(TQMap<Key, T>* container, const Key& key) :
MyMoneyMapAction(container, key, (*container)[key])
{
container->remove(key);
@@ -249,7 +249,7 @@ private:
class MyMoneyMapModify : public MyMoneyMapAction
{
public:
- MyMoneyMapModify(QMap<Key, T>* container, const Key& key, const T& obj) :
+ MyMoneyMapModify(TQMap<Key, T>* container, const Key& key, const T& obj) :
MyMoneyMapAction(container, key, (*container)[key])
{
(*container)[key] = obj;
@@ -263,7 +263,7 @@ private:
};
protected:
- QPtrStack<MyMoneyMapAction> m_stack;
+ TQPtrStack<MyMoneyMapAction> m_stack;
};
#if MY_OWN_DEBUG
@@ -271,15 +271,15 @@ protected:
#include <kmymoney/mymoneytransaction.h>
main()
{
- MyMoneyMap<QString, MyMoneyAccount> container;
- MyMoneyMap<QString, MyMoneyTransaction> ct;
+ MyMoneyMap<TQString, MyMoneyAccount> container;
+ MyMoneyMap<TQString, MyMoneyTransaction> ct;
MyMoneyAccount acc;
acc.setName("Test");
// this should not be possible
// container["a"] = acc;
- QValueList<MyMoneyAccount> list;
+ TQValueList<MyMoneyAccount> list;
list = container.values();
MyMoneyAccount b;
@@ -298,7 +298,7 @@ main()
container.dump();
container.startTransaction();
- container.remove(QString("001"));
+ container.remove(TQString("001"));
container.dump();
container.rollbackTransaction();
container.dump();
@@ -306,8 +306,8 @@ main()
b = container["001"];
printf("b.name() = %s\n", b.name().data());
- QMap<QString, MyMoneyAccount>::ConstIterator it;
- it = container.find("001");
+ TQMap<TQString, MyMoneyAccount>::ConstIterator it;
+ it = container.tqfind("001");
it = container.begin();
} catch(MyMoneyException *e) {
@@ -315,7 +315,7 @@ main()
delete e;
}
- QMap<QString, MyMoneyAccount> map;
+ TQMap<TQString, MyMoneyAccount> map;
map["005"] = b;
container = map;