diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
commit | 4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch) | |
tree | b0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbugbuster/backend/htmlparser.cpp | |
parent | 1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff) | |
download | tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbugbuster/backend/htmlparser.cpp')
-rw-r--r-- | kbugbuster/backend/htmlparser.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/kbugbuster/backend/htmlparser.cpp b/kbugbuster/backend/htmlparser.cpp index 7e53c1bd..055b8d11 100644 --- a/kbugbuster/backend/htmlparser.cpp +++ b/kbugbuster/backend/htmlparser.cpp @@ -28,22 +28,22 @@ #include <kdebug.h> -#include <qbuffer.h> -#include <qregexp.h> -#include <qtextstream.h> +#include <tqbuffer.h> +#include <tqregexp.h> +#include <tqtextstream.h> -KBB::Error HtmlParser::parseBugList( const QByteArray &data, Bug::List &bugs ) +KBB::Error HtmlParser::parseBugList( const TQByteArray &data, Bug::List &bugs ) { - QBuffer buffer( data ); + TQBuffer buffer( data ); if ( !buffer.open( IO_ReadOnly ) ) { return KBB::Error( "Can't open buffer" ); } - QTextStream ts( &buffer ); + TQTextStream ts( &buffer ); mState = Idle; - QString line; + TQString line; while ( !( line = ts.readLine() ).isNull() ) { KBB::Error err = parseLine( line, bugs ); if ( err ) return err; @@ -52,19 +52,19 @@ KBB::Error HtmlParser::parseBugList( const QByteArray &data, Bug::List &bugs ) return KBB::Error(); } -KBB::Error HtmlParser::parsePackageList( const QByteArray &data, +KBB::Error HtmlParser::parsePackageList( const TQByteArray &data, Package::List &packages ) { init(); - QBuffer buffer( data ); + TQBuffer buffer( data ); if ( !buffer.open( IO_ReadOnly ) ) { return KBB::Error( "Can't open buffer" ); } - QTextStream ts( &buffer ); + TQTextStream ts( &buffer ); - QString line; + TQString line; while ( !( line = ts.readLine() ).isNull() ) { KBB::Error err = parseLine( line, packages ); if ( err ) return err; @@ -84,12 +84,12 @@ void HtmlParser::setPackageListQuery( KURL &url ) url.setFileName( "query.cgi" ); } -KBB::Error HtmlParser::parseLine( const QString &, Bug::List & ) +KBB::Error HtmlParser::parseLine( const TQString &, Bug::List & ) { return KBB::Error(); } -KBB::Error HtmlParser::parseLine( const QString &, Package::List & ) +KBB::Error HtmlParser::parseLine( const TQString &, Package::List & ) { return KBB::Error(); } @@ -98,20 +98,20 @@ void HtmlParser::processResult( Package::List & ) { } -QString HtmlParser::getAttribute( const QString &line, const QString &name ) +TQString HtmlParser::getAttribute( const TQString &line, const TQString &name ) { int pos1 = line.find( name + "=\"" ); - if ( pos1 < 1 ) return QString::null; + if ( pos1 < 1 ) return TQString::null; pos1 += name.length() + 2; int pos2 = line.find( "\"", pos1 ); - if ( pos2 < 1 ) return QString::null; + if ( pos2 < 1 ) return TQString::null; return line.mid( pos1, pos2 - pos1 ); } -bool HtmlParser::getCpts( const QString &line, QString &key, - QStringList &values ) +bool HtmlParser::getCpts( const TQString &line, TQString &key, + TQStringList &values ) { - if ( !line.contains( QRegExp( "\\s*cpts" ) ) ) return false; + if ( !line.contains( TQRegExp( "\\s*cpts" ) ) ) return false; // kdDebug() << "LINE: " << line << endl; int pos1 = line.find( "[" ); @@ -131,7 +131,7 @@ bool HtmlParser::getCpts( const QString &line, QString &key, if ( pos1 >= 0 ) pos2 = line.find( "'", ++pos1 ); while ( pos1 >= 0 && pos2 >= 0 ) { - QString value = line.mid( pos1, pos2 - pos1 ); + TQString value = line.mid( pos1, pos2 - pos1 ); // kdDebug() << " VALUE: " << value << endl; values.append( value ); @@ -143,16 +143,16 @@ bool HtmlParser::getCpts( const QString &line, QString &key, return true; } -KBB::Error HtmlParser_2_10::parseLine( const QString &line, Bug::List &bugs ) +KBB::Error HtmlParser_2_10::parseLine( const TQString &line, Bug::List &bugs ) { if ( line.startsWith( "<TR VALIGN" ) ) { // kdDebug() << "LINE: " << line << endl; - QRegExp re( "show_bug\\.cgi\\?id=(\\d+)" ); + TQRegExp re( "show_bug\\.cgi\\?id=(\\d+)" ); re.search( line ); - QString number = re.cap( 1 ); + TQString number = re.cap( 1 ); // kdDebug() << " NUMBER: " << number << endl; - QString summary; + TQString summary; int pos = line.findRev( "summary>" ); if ( pos >= 0 ) summary = line.mid( pos + 8 ); @@ -168,11 +168,11 @@ KBB::Error HtmlParser_2_10::parseLine( const QString &line, Bug::List &bugs ) return KBB::Error(); } -KBB::Error HtmlParser_2_10::parseLine( const QString &line, +KBB::Error HtmlParser_2_10::parseLine( const TQString &line, Package::List &packages ) { - QString package; - QStringList components; + TQString package; + TQStringList components; if ( getCpts( line, package, components ) ) { packages.append( Package( new PackageImpl( package, "", 0, Person(), @@ -190,7 +190,7 @@ void HtmlParser_2_14_2::init() mState = Idle; } -KBB::Error HtmlParser_2_14_2::parseLine( const QString &line, +KBB::Error HtmlParser_2_14_2::parseLine( const TQString &line, Package::List & ) { switch ( mState ) { @@ -199,8 +199,8 @@ KBB::Error HtmlParser_2_14_2::parseLine( const QString &line, break; case Components: { if ( line.startsWith( "function" ) ) mState = Finished; - QString key; - QStringList values; + TQString key; + TQStringList values; if ( getCpts( line, key, values ) ) { // kdDebug() << "KEY: " << key << " VALUES: " << values.join(",") << endl; if ( values.count() == 2 ) { @@ -217,7 +217,7 @@ KBB::Error HtmlParser_2_14_2::parseLine( const QString &line, void HtmlParser_2_14_2::processResult( Package::List &packages ) { - QMap<QString,QStringList>::ConstIterator it; + TQMap<TQString,TQStringList>::ConstIterator it; for ( it = mComponentsMap.begin(); it != mComponentsMap.end(); ++it ) { packages.append( Package( new PackageImpl( it.key(), "", 0, Person(), it.data() ) ) ); @@ -233,17 +233,17 @@ void HtmlParser_2_17_1::init() mState = Idle; } -KBB::Error HtmlParser_2_17_1::parseBugList( const QByteArray &data, Bug::List &bugs ) +KBB::Error HtmlParser_2_17_1::parseBugList( const TQByteArray &data, Bug::List &bugs ) { return RdfProcessor::parseBugList( data, bugs ); } -KBB::Error HtmlParser_2_17_1::parseLine( const QString & /*line*/, Bug::List &/*bugs*/ ) +KBB::Error HtmlParser_2_17_1::parseLine( const TQString & /*line*/, Bug::List &/*bugs*/ ) { return KBB::Error( "Not implemented" ); } -KBB::Error HtmlParser_2_17_1::parseLine( const QString &line, Package::List & ) +KBB::Error HtmlParser_2_17_1::parseLine( const TQString &line, Package::List & ) { switch ( mState ) { case Idle: @@ -254,18 +254,18 @@ KBB::Error HtmlParser_2_17_1::parseLine( const QString &line, Package::List & ) if ( line.contains( "onchange=\"selectProduct" ) ) mState = Products; break; case Components: { - if ( line.contains( QRegExp( "\\s*function" ) ) ) { + if ( line.contains( TQRegExp( "\\s*function" ) ) ) { mState = SearchProducts; } - QString key; - QStringList components; + TQString key; + TQStringList components; if ( getCpts( line, key, components ) ) { mComponents.append( components ); } } case Products: { if ( line.contains( "</select>" ) ) mState = Finished; - QString product = getAttribute( line, "value" ); + TQString product = getAttribute( line, "value" ); if ( !product.isEmpty() ) { kdDebug() << "PRODUCT: " << product << endl; mProducts.append( product ); @@ -282,8 +282,8 @@ KBB::Error HtmlParser_2_17_1::parseLine( const QString &line, Package::List & ) void HtmlParser_2_17_1::processResult( Package::List &packages ) { - QStringList::ConstIterator itProduct = mProducts.begin(); - QValueList<QStringList>::ConstIterator itComponents = mComponents.begin(); + TQStringList::ConstIterator itProduct = mProducts.begin(); + TQValueList<TQStringList>::ConstIterator itComponents = mComponents.begin(); while( itProduct != mProducts.end() && itComponents != mComponents.end() ) { packages.append( Package( new PackageImpl( *itProduct, "", 0, Person(), |