diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /lib/catalog | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/catalog')
-rw-r--r-- | lib/catalog/catalog.cpp | 106 | ||||
-rw-r--r-- | lib/catalog/catalog.h | 22 | ||||
-rw-r--r-- | lib/catalog/tag.cpp | 10 | ||||
-rw-r--r-- | lib/catalog/tag.h | 70 |
4 files changed, 104 insertions, 104 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; } diff --git a/lib/catalog/catalog.h b/lib/catalog/catalog.h index 6ab985a9..00eb5b2b 100644 --- a/lib/catalog/catalog.h +++ b/lib/catalog/catalog.h @@ -20,9 +20,9 @@ #ifndef CATALOG_H #define CATALOG_H -#include <qvaluelist.h> -#include <qpair.h> -#include <qvariant.h> +#include <tqvaluelist.h> +#include <tqpair.h> +#include <tqvariant.h> #include "tag.h" @@ -42,31 +42,31 @@ never or rarely changes. System libraries are perfect examples of such code. class Catalog { public: - typedef QPair<QCString, QVariant> QueryArgument; + typedef QPair<TQCString, TQVariant> QueryArgument; public: Catalog(); virtual ~Catalog(); bool isValid() const; - QString dbName() const; + TQString dbName() const; bool enabled() const; void setEnabled( bool en ); - virtual void open( const QString& dbName ); + virtual void open( const TQString& dbName ); virtual void close(); virtual void sync(); - QValueList<QCString> indexList() const; - void addIndex( const QCString& name ); + TQValueList<TQCString> indexList() const; + void addIndex( const TQCString& name ); void addItem( Tag& tag ); - Tag getItemById( const QCString& id ); - QValueList<Tag> query( const QValueList<QueryArgument>& args ); + Tag getItemById( const TQCString& id ); + TQValueList<Tag> query( const TQValueList<QueryArgument>& args ); - QCString generateId(); + TQCString generateId(); private: class _Catalog_Private* d; diff --git a/lib/catalog/tag.cpp b/lib/catalog/tag.cpp index 748ca994..966e9713 100644 --- a/lib/catalog/tag.cpp +++ b/lib/catalog/tag.cpp @@ -18,7 +18,7 @@ */ #include "tag.h" -#include <qdatastream.h> +#include <tqdatastream.h> Tag::Tag() { @@ -81,7 +81,7 @@ Tag& Tag::operator = ( const Tag& source ) return( *this ); } -void Tag::load( QDataStream& stream ) +void Tag::load( TQDataStream& stream ) { stream >> data->id @@ -97,7 +97,7 @@ void Tag::load( QDataStream& stream ) >> data->attributes; } -void Tag::store( QDataStream& stream ) const +void Tag::store( TQDataStream& stream ) const { stream << data->id @@ -113,13 +113,13 @@ void Tag::store( QDataStream& stream ) const << data->attributes; } -QDataStream& operator << ( QDataStream& s, const Tag& t) +TQDataStream& operator << ( TQDataStream& s, const Tag& t) { t.store( s ); return s; } -QDataStream& operator >> ( QDataStream& s, Tag& t ) +TQDataStream& operator >> ( TQDataStream& s, Tag& t ) { t.load( s ); return s; diff --git a/lib/catalog/tag.h b/lib/catalog/tag.h index da67b083..5c1fac41 100644 --- a/lib/catalog/tag.h +++ b/lib/catalog/tag.h @@ -20,9 +20,9 @@ #ifndef TAG_H #define TAG_H -#include <qmap.h> -#include <qvariant.h> -#include <qshared.h> +#include <tqmap.h> +#include <tqvariant.h> +#include <tqshared.h> class QDataStream; @@ -78,12 +78,12 @@ public: Tag& operator = ( const Tag& source ); - QCString id() const + TQCString id() const { return data->id; } - void setId( const QCString& id ) + void setId( const TQCString& id ) { detach(); data->id = id; @@ -111,31 +111,31 @@ public: data->flags = flags; } - QString fileName() const + TQString fileName() const { return data->fileName; } - void setFileName( const QString& fileName ) + void setFileName( const TQString& fileName ) { detach(); data->fileName = fileName; } - QString path( const QString& sep = QString::fromLatin1("::") ) const + TQString path( const TQString& sep = TQString::fromLatin1("::") ) const { - QString s = scope().join( sep ); + TQString s = scope().join( sep ); if( s.isNull() ) return name(); return s + sep + name(); } - QString name() const + TQString name() const { return data->name; } - QString comment() const { + TQString comment() const { if( hasAttribute( "cmt" ) ) { return attribute( "cmt" ).asString(); } else { @@ -143,22 +143,22 @@ public: } } - void setComment( const QString& comment ) { + void setComment( const TQString& comment ) { setAttribute( "cmt", comment ); } - void setName( const QString& name ) + void setName( const TQString& name ) { detach(); data->name = name; } - QStringList scope() const + TQStringList scope() const { return data->scope; } - void setScope( const QStringList& scope ) + void setScope( const TQStringList& scope ) { detach(); data->scope = scope; @@ -190,22 +190,22 @@ public: data->endColumn = column; } - QString getSpecializationDeclaration() const { + TQString getSpecializationDeclaration() const { if( hasAttribute( "spc" ) ) return data->attributes["spc"].asString(); else - return QString::null; + return TQString::null; } bool hasSpecializationDeclaration() const { return data->attributes.contains( "spc" ); } - void setSpecializationDeclaration( const QString& str ) { + void setSpecializationDeclaration( const TQString& str ) { data->attributes["spc"] = str; } - bool hasAttribute( const QCString& name ) const + bool hasAttribute( const TQCString& name ) const { if( name == "kind" || name == "name" || @@ -219,7 +219,7 @@ public: return data->attributes.contains( name ); } - QVariant attribute( const QCString& name ) const + TQVariant attribute( const TQCString& name ) const { if( name == "id" ) return data->id; @@ -244,7 +244,7 @@ public: return data->attributes[ name ]; } - void setAttribute( const QCString& name, const QVariant& value ) + void setAttribute( const TQCString& name, const TQVariant& value ) { detach(); if( name == "id" ) @@ -269,20 +269,20 @@ public: data->attributes[ name ] = value; } - void addTemplateParam( const QString& param , const QString& def = "" ) { - QMap<QCString, QVariant>::iterator it = data->attributes.find( "tpl" ); - if( it != data->attributes.end() && (*it).type() == QVariant::StringList ) { + void addTemplateParam( const TQString& param , const TQString& def = "" ) { + TQMap<TQCString, TQVariant>::iterator it = data->attributes.find( "tpl" ); + if( it != data->attributes.end() && (*it).type() == TQVariant::StringList ) { }else{ - it = data->attributes.insert( "tpl", QVariant( QStringList() ) ); + it = data->attributes.insert( "tpl", TQVariant( TQStringList() ) ); } - QStringList& l( (*it).asStringList() ); + TQStringList& l( (*it).asStringList() ); l << param; l << def; } - void load( QDataStream& stream ); - void store( QDataStream& stream ) const; + void load( TQDataStream& stream ); + void store( TQDataStream& stream ) const; private: Tag copy(); @@ -291,19 +291,19 @@ private: private: struct TagData: public QShared { - QCString id; + TQCString id; int kind; unsigned long flags; - QString name; - QStringList scope; - QString fileName; + TQString name; + TQStringList scope; + TQString fileName; int startLine, startColumn; int endLine, endColumn; - QMap<QCString, QVariant> attributes; + TQMap<TQCString, TQVariant> attributes; } *data; }; -QDataStream& operator << ( QDataStream&, const Tag& ); -QDataStream& operator >> ( QDataStream&, Tag& ); +TQDataStream& operator << ( TQDataStream&, const Tag& ); +TQDataStream& operator >> ( TQDataStream&, Tag& ); #endif |