diff options
Diffstat (limited to 'lib/catalog/catalog.cpp')
-rw-r--r-- | lib/catalog/catalog.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/lib/catalog/catalog.cpp b/lib/catalog/catalog.cpp index 96853ff1..c58bbe7d 100644 --- a/lib/catalog/catalog.cpp +++ b/lib/catalog/catalog.cpp @@ -17,10 +17,10 @@ Boston, MA 02110-1301, USA. */ #include "catalog.h" -#include <qdir.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qdatastream.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqdatastream.h> #include <krandomsequence.h> #include <kdebug.h> @@ -34,10 +34,10 @@ struct _Catalog_Private { - QString dbName; + TQString dbName; DB* dbp; - QMap<QCString, DB*> indexList; + TQMap<TQCString, DB*> indexList; KRandomSequence rnd; bool enabled; @@ -46,17 +46,17 @@ struct _Catalog_Private { } - bool hasIndex( const QCString& name ) const + bool hasIndex( const TQCString& name ) const { return indexList.contains( name ); } - DB* index( const QCString& name ) + DB* index( const TQCString& name ) { return indexList[ name ]; } - bool addItem( DB* dbp, const QCString& id, const Tag& tag ) + bool addItem( DB* dbp, const TQCString& id, const Tag& tag ) { Q_ASSERT( dbp != 0 ); @@ -66,17 +66,17 @@ struct _Catalog_Private std::memset( &key, 0, sizeof(key) ); std::memset( &data, 0, sizeof(data) ); - QByteArray a1; + TQByteArray a1; { - QDataStream stream( a1, IO_WriteOnly ); + TQDataStream stream( a1, IO_WriteOnly ); stream << id; key.data = a1.data(); key.size = a1.size(); } - QByteArray a2; + TQByteArray a2; { - QDataStream stream( a2, IO_WriteOnly ); + TQDataStream stream( a2, IO_WriteOnly ); tag.store( stream ); data.data = a2.data(); data.size = a2.size(); @@ -87,7 +87,7 @@ struct _Catalog_Private return ret == 0; } - bool addItem( DB* dbp, const QVariant& id, const QCString& v ) + bool addItem( DB* dbp, const TQVariant& id, const TQCString& v ) { Q_ASSERT( dbp != 0 ); @@ -97,17 +97,17 @@ struct _Catalog_Private std::memset( &key, 0, sizeof(key) ); std::memset( &data, 0, sizeof(data) ); - QByteArray a1; + TQByteArray a1; { - QDataStream stream( a1, IO_WriteOnly ); + TQDataStream stream( a1, IO_WriteOnly ); stream << id; key.data = a1.data(); key.size = a1.size(); } - QByteArray a2; + TQByteArray a2; { - QDataStream stream( a2, IO_WriteOnly ); + TQDataStream stream( a2, IO_WriteOnly ); stream << v; data.data = a2.data(); data.size = a2.size(); @@ -142,10 +142,10 @@ struct _Catalog_Private /*! \fn Catalog::indexList() const */ - QValueList<QCString> Catalog::indexList() const + TQValueList<TQCString> Catalog::indexList() const { - QValueList<QCString> l; - QMap<QCString, DB*>::Iterator it = d->indexList.begin(); + TQValueList<TQCString> l; + TQMap<TQCString, DB*>::Iterator it = d->indexList.begin(); while( it != d->indexList.end() ){ l << it.key(); ++it; @@ -165,14 +165,14 @@ void Catalog::setEnabled( bool isEnabled ) } /*! - \fn Catalog::addIndex( const QString& name ) + \fn Catalog::addIndex( const TQString& name ) @todo document these functions */ - void Catalog::addIndex( const QCString& name ) + void Catalog::addIndex( const TQCString& name ) { Q_ASSERT( d->dbp != 0 ); - QMap<QCString, DB*>::Iterator it = d->indexList.find( name ); + TQMap<TQCString, DB*>::Iterator it = d->indexList.find( name ); if( it == d->indexList.end() ){ DB* dbp = 0; @@ -189,15 +189,15 @@ void Catalog::setEnabled( bool isEnabled ) return; } - QFileInfo fileInfo( d->dbName ); - QString indexName = fileInfo.dirPath(true) + "/" + fileInfo.baseName(true) + "." + QString(name) + ".idx"; + TQFileInfo fileInfo( d->dbName ); + TQString indexName = fileInfo.dirPath(true) + "/" + fileInfo.baseName(true) + "." + TQString(name) + ".idx"; if( (ret = dbp->set_cachesize( dbp, 0, 2 * 1024 * 1024, 0 )) != 0 ){ kdDebug() << "set_cachesize: " << db_strerror(ret) << endl; } if ((ret = dbp->open( - dbp, NULL, QFile::encodeName( indexName ).data(), 0, DB_BTREE, DB_CREATE, 0664)) != 0) { + dbp, NULL, TQFile::encodeName( indexName ).data(), 0, DB_BTREE, DB_CREATE, 0664)) != 0) { kdDebug() << "db_open: " << db_strerror(ret) << endl; dbp->close( dbp, 0 ); return; @@ -213,9 +213,9 @@ void Catalog::setEnabled( bool isEnabled ) void Catalog::close() { - d->dbName = QString::null; + d->dbName = TQString::null; - QMap<QCString, DB*>::Iterator it = d->indexList.begin(); + TQMap<TQCString, DB*>::Iterator it = d->indexList.begin(); while( it != d->indexList.end() ){ if( it.data() ){ it.data()->close( it.data(), 0 ); @@ -231,10 +231,10 @@ void Catalog::setEnabled( bool isEnabled ) } /*! - \fn Catalog::open( const QString& dbName ) + \fn Catalog::open( const TQString& dbName ) */ - void Catalog::open( const QString& dbName ) + void Catalog::open( const TQString& dbName ) { Q_ASSERT( d->dbp == 0 ); @@ -269,7 +269,7 @@ void Catalog::setEnabled( bool isEnabled ) \fn Catalog::dbName() const */ - QString Catalog::dbName() const + TQString Catalog::dbName() const { return d->dbName; } @@ -292,11 +292,11 @@ void Catalog::setEnabled( bool isEnabled ) if( tag.name().isEmpty() ) return; - QCString id = generateId(); + TQCString id = generateId(); tag.setId( id ); if( d->addItem(d->dbp, id, tag) ){ - QMap<QCString, DB*>::Iterator it = d->indexList.begin(); + TQMap<TQCString, DB*>::Iterator it = d->indexList.begin(); while( it != d->indexList.end() ){ if( tag.hasAttribute(it.key()) ) d->addItem( it.data(), tag.attribute(it.key()), id ); @@ -306,10 +306,10 @@ void Catalog::setEnabled( bool isEnabled ) } /*! - \fn Catalog::getItemById( const QString& id ) + \fn Catalog::getItemById( const TQString& id ) */ - Tag Catalog::getItemById( const QCString& id ) + Tag Catalog::getItemById( const TQCString& id ) { Q_ASSERT( d->dbp != 0 ); @@ -317,9 +317,9 @@ void Catalog::setEnabled( bool isEnabled ) std::memset( &key, 0, sizeof(key) ); std::memset( &data, 0, sizeof(data) ); - QByteArray a1; + TQByteArray a1; { - QDataStream stream( a1, IO_WriteOnly ); + TQDataStream stream( a1, IO_WriteOnly ); stream << id; key.data = a1.data(); key.size = a1.size(); @@ -331,9 +331,9 @@ void Catalog::setEnabled( bool isEnabled ) Tag tag; if( ret == 0 ){ - QByteArray a; + TQByteArray a; a.setRawData( (const char*) data.data, data.size ); - QDataStream stream( a, IO_ReadOnly ); + TQDataStream stream( a, IO_ReadOnly ); tag.load( stream ); a.resetRawData( (const char*) data.data, data.size ); } @@ -350,7 +350,7 @@ void Catalog::setEnabled( bool isEnabled ) Q_ASSERT( d->dbp != 0 ); d->dbp->sync( d->dbp, 0 ); - QMap<QCString, DB*>::Iterator it = d->indexList.begin(); + TQMap<TQCString, DB*>::Iterator it = d->indexList.begin(); while( it != d->indexList.end() ){ it.data()->sync( it.data(), 0 ); ++it; @@ -358,22 +358,22 @@ void Catalog::setEnabled( bool isEnabled ) } /*! - \fn Catalog::query( const QValueList<QueryArgument>& args ) + \fn Catalog::query( const TQValueList<QueryArgument>& args ) */ - QValueList<Tag> Catalog::query( const QValueList<QueryArgument>& args ) + TQValueList<Tag> Catalog::query( const TQValueList<QueryArgument>& args ) { - QValueList<Tag> tags; + TQValueList<Tag> tags; DBT key, data; DBC** cursors = new DBC* [ args.size() + 1 ]; - QValueList< QPair<QCString,QVariant> >::ConstIterator it = args.begin(); + TQValueList< QPair<TQCString,TQVariant> >::ConstIterator it = args.begin(); int current = 0; while( it != args.end() ){ - QCString indexName = (*it).first; - QVariant value = (*it).second; + TQCString indexName = (*it).first; + TQVariant value = (*it).second; if( d->hasIndex(indexName) ) { DB* dbp = d->index( indexName ); @@ -382,9 +382,9 @@ void Catalog::setEnabled( bool isEnabled ) std::memset( &key, 0, sizeof(key) ); std::memset( &data, 0, sizeof(data) ); - QByteArray a1; + TQByteArray a1; { - QDataStream stream( a1, IO_WriteOnly ); + TQDataStream stream( a1, IO_WriteOnly ); stream << value; key.data = a1.data(); key.size = a1.size(); @@ -426,9 +426,9 @@ void Catalog::setEnabled( bool isEnabled ) while( join_curs->c_get(join_curs, &key, &data, 0) == 0 ) { - QByteArray a2; + TQByteArray a2; a2.setRawData( (const char*) data.data, data.size ); - QDataStream s( a2, IO_ReadOnly ); + TQDataStream s( a2, IO_ReadOnly ); Tag tag; tag.load( s ); a2.resetRawData( (const char*) data.data, data.size ); @@ -452,10 +452,10 @@ void Catalog::setEnabled( bool isEnabled ) return tags; } - QCString Catalog::generateId() + TQCString Catalog::generateId() { static int n = 1; - QCString asStr; + TQCString asStr; asStr.sprintf( "%05d", n++ ); return asStr; } |