diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kofficecore/priorityqueue.h | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kofficecore/priorityqueue.h')
-rw-r--r-- | lib/kofficecore/priorityqueue.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/kofficecore/priorityqueue.h b/lib/kofficecore/priorityqueue.h index 68019143..a9a5c770 100644 --- a/lib/kofficecore/priorityqueue.h +++ b/lib/kofficecore/priorityqueue.h @@ -20,8 +20,8 @@ #define priority_queue_h #include <vector> -#include <qstring.h> -#include <qasciidict.h> +#include <tqstring.h> +#include <tqasciidict.h> #include <kdebug.h> // Better put all those internal classes in some namespace to avoid clashes @@ -41,7 +41,7 @@ namespace KOffice { * search for the item where you decreased the key :} * Just to make it even worse we also use a "int index() const" method * to fetch the index... well, you most likely would need one anyway ;) - * Note: This class is pointer based (like QPtr*) - if you create PriorityQueue<X> + * Note: This class is pointer based (like TQPtr*) - if you create PriorityQueue<X> * we actually operate on X* ! We don't care about deleting your pointers at all. * We don't copy them, we don't create new ones,... - you own them, you have * to delete them :) @@ -59,7 +59,7 @@ namespace KOffice { public: PriorityQueue() {} PriorityQueue( const PriorityQueue<T>& rhs ) : m_vector( rhs.m_vector ) {} - PriorityQueue( const QAsciiDict<T>& items ); + PriorityQueue( const TQAsciiDict<T>& items ); ~PriorityQueue() {} PriorityQueue<T> &operator=( const PriorityQueue<T>& rhs ) { m_vector = rhs.m_vector; return *this; } @@ -86,7 +86,7 @@ namespace KOffice { private: // Note: We have to use a 1-based index here, and we get/return 0-based ones - int parent( int i ) { return ( ( i + 1 ) >> 1 ) - 1; } + int tqparent( int i ) { return ( ( i + 1 ) >> 1 ) - 1; } int left( int i ) { return ( ( i + 1 ) << 1 ) - 1; } int right( int i ) { return ( i + 1 ) << 1; } @@ -100,10 +100,10 @@ namespace KOffice { }; template<class T> - PriorityQueue<T>::PriorityQueue( const QAsciiDict<T>& items ) : m_vector( items.count() ) + PriorityQueue<T>::PriorityQueue( const TQAsciiDict<T>& items ) : m_vector( items.count() ) { // First put all items into the vector - QAsciiDictIterator<T> it( items ); + TQAsciiDictIterator<T> it( items ); for ( int i = 0; it.current(); ++it, ++i ) { it.current()->setIndex( i ); m_vector[ i ] = it.current(); @@ -148,13 +148,13 @@ namespace KOffice { void PriorityQueue<T>::dump() const { kdDebug( 30500 ) << "++++++++++ PriorityQueue::dump ++++++++++" << endl; - QString out; + TQString out; int size = static_cast<int>( m_vector.size() ); for ( int i = 0; i < size; ++i ) { if ( m_vector[ i ]->index() != i ) - out += " ERROR: index out of sync. Should be " + QString::number( i ) + ", is " + - QString::number( m_vector[ i ]->index() ) + ". "; - out += QString::number( m_vector[ i ]->key() ); + out += " ERROR: index out of sync. Should be " + TQString::number( i ) + ", is " + + TQString::number( m_vector[ i ]->index() ) + ". "; + out += TQString::number( m_vector[ i ]->key() ); out += ", "; } if ( out.isEmpty() ) @@ -190,14 +190,14 @@ namespace KOffice { template<class T> void PriorityQueue<T>::bubbleUp( T* item, int i ) { - int p = parent( i ); + int p = tqparent( i ); while ( i > 0 && m_vector[ p ]->key() > item->key() ) { // update the index first m_vector[ p ]->setIndex( i ); // then move it there m_vector[ i ] = m_vector[ p ]; i = p; - p = parent( i ); + p = tqparent( i ); } item->setIndex( i ); m_vector[ i ] = item; |