diff options
Diffstat (limited to 'kresources/exchange/dateset.cpp')
-rw-r--r-- | kresources/exchange/dateset.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/kresources/exchange/dateset.cpp b/kresources/exchange/dateset.cpp index 2fed82af6..d28409a9c 100644 --- a/kresources/exchange/dateset.cpp +++ b/kresources/exchange/dateset.cpp @@ -45,11 +45,11 @@ DateSet::~DateSet() void DateSet::add( TQDate const& date ) { if (mDates->isEmpty()) { - mDates->insert( 0, new QPair<TQDate,TQDate>( date, date ) ); + mDates->insert( 0, new TQPair<TQDate,TQDate>( date, date ) ); return; } - int i = find( date ); - mDates->insert( i, new QPair<TQDate,TQDate>( date, date ) ); + int i = tqfind( date ); + mDates->insert( i, new TQPair<TQDate,TQDate>( date, date ) ); tryMerge( i ); tryMerge( i-1 ); } @@ -57,19 +57,19 @@ void DateSet::add( TQDate const& date ) void DateSet::add( TQDate const& from, TQDate const& to ) { if (mDates->isEmpty()) { - mDates->insert( 0, new QPair<TQDate,TQDate>( from, to ) ); + mDates->insert( 0, new TQPair<TQDate,TQDate>( from, to ) ); return; } - uint i = find( from ); + uint i = tqfind( from ); kdDebug() << "Adding range at position " << i << endl; - mDates->insert( i, new QPair<TQDate,TQDate>( from, to ) ); + mDates->insert( i, new TQPair<TQDate,TQDate>( from, to ) ); do { } while ( tryMerge( i ) ); do { } while ( tryMerge( i-1 ) ); /* - QPair<TQDate,TQDate>* item = mDates->at( i ); + TQPair<TQDate,TQDate>* item = mDates->at( i ); if (to >= item->first) return; @@ -77,7 +77,7 @@ void DateSet::add( TQDate const& from, TQDate const& to ) if (to.daysTo( item->first ) == 1 ) item->first = from; else - mDates->insert( i, new QPair<TQDate,TQDate>( from, to ) ); + mDates->insert( i, new TQPair<TQDate,TQDate>( from, to ) ); */ } @@ -87,11 +87,11 @@ void DateSet::remove( TQDate const& date ) return; } - uint i = find( date ); + uint i = tqfind( date ); if ( i == mDates->count() ) return; - QPair<TQDate,TQDate>* item = mDates->at( i ); + TQPair<TQDate,TQDate>* item = mDates->at( i ); if ( date < item->first ) return; if ( date == item->first ) { @@ -106,7 +106,7 @@ void DateSet::remove( TQDate const& date ) if ( date == item->second ) { item->second = item->second.addDays( -1 ); } else { - mDates->insert( i, new QPair<TQDate,TQDate>(item->first, date.addDays( -1 ) ) ); + mDates->insert( i, new TQPair<TQDate,TQDate>(item->first, date.addDays( -1 ) ) ); item->first = date.addDays( 1 ); } } @@ -117,12 +117,12 @@ void DateSet::remove( TQDate const& from, TQDate const& to ) return; } - uint i = find( from ); + uint i = tqfind( from ); if ( i == mDates->count() ) return; while( i < mDates->count() ) { - QPair<TQDate,TQDate>* item = mDates->at( i ); + TQPair<TQDate,TQDate>* item = mDates->at( i ); // Check if we're done: next item is later dan removal period if ( to < item->first ) break; @@ -136,7 +136,7 @@ void DateSet::remove( TQDate const& from, TQDate const& to ) // Check if we should take a slice out of the middle of the item if ( from > item->first && to < item->second ) { - mDates->insert( i, new QPair<TQDate,TQDate>( item->first, from.addDays( -1 ) ) ); + mDates->insert( i, new TQPair<TQDate,TQDate>( item->first, from.addDays( -1 ) ) ); item->first = to.addDays( 1 ); break; // We're done } @@ -161,13 +161,13 @@ bool DateSet::tqcontains( TQDate const& date ) return false; } - uint i = find( date ); -// kdDebug() << "tqcontains looking for " << date.toString() << " at range " << i << endl; + uint i = tqfind( date ); +// kdDebug() << "contains looking for " << date.toString() << " at range " << i << endl; if ( i == mDates->count() ) return false; - QPair<TQDate,TQDate>* item = mDates->at( i ); - // kdDebug() << "tqcontains looking at range " << item->first.toString() << " -- " << item->second.toString() << endl; + TQPair<TQDate,TQDate>* item = mDates->at( i ); + // kdDebug() << "contains looking at range " << item->first.toString() << " -- " << item->second.toString() << endl; return ( item->first <= date ); } @@ -178,11 +178,11 @@ bool DateSet::tqcontains( TQDate const& from, TQDate const& to ) return false; } - uint i = find( from ); + uint i = tqfind( from ); if ( i == mDates->count() ) return false; - QPair<TQDate,TQDate>* item = mDates->at( i ); + TQPair<TQDate,TQDate>* item = mDates->at( i ); return ( from >= item->first && to <= item->second ); } @@ -192,7 +192,7 @@ bool DateSet::tqcontains( TQDate const& from, TQDate const& to ) // If mDates is empty, return 0. // If date is later than the last item in mDates, return mDates->count() -int DateSet::find( TQDate const& date ) +int DateSet::tqfind( TQDate const& date ) { if ( mDates->isEmpty() ) return 0; @@ -202,7 +202,7 @@ int DateSet::find( TQDate const& date ) while ( start < end ) { int i = start + (end-start) / 2; // kdDebug() << start << ", " << i << ", " << end << endl; - QPair<TQDate,TQDate> *item = mDates->at( i ); + TQPair<TQDate,TQDate> *item = mDates->at( i ); if ( item->first <= date && date <= item->second ) return i; if ( date > item->second ) { @@ -246,8 +246,8 @@ bool DateSet::tryMerge( int i ) if ( i < 0 || i+1 >= (int)(mDates->count()) ) return false; - QPair<TQDate,TQDate>* item1 = mDates->at( i ); - QPair<TQDate,TQDate>* item2 = mDates->at( i+1 ); + TQPair<TQDate,TQDate>* item1 = mDates->at( i ); + TQPair<TQDate,TQDate>* item2 = mDates->at( i+1 ); // First case: item1 starts before or on the same date as item2 if ( item1->first <= item2->first ) { |