diff options
Diffstat (limited to 'kode/kxml_compiler')
-rw-r--r-- | kode/kxml_compiler/creator.cpp | 166 | ||||
-rw-r--r-- | kode/kxml_compiler/creator.h | 32 | ||||
-rw-r--r-- | kode/kxml_compiler/kxml_compiler.cpp | 26 | ||||
-rw-r--r-- | kode/kxml_compiler/parser.cpp | 36 | ||||
-rw-r--r-- | kode/kxml_compiler/parser.h | 38 |
5 files changed, 149 insertions, 149 deletions
diff --git a/kode/kxml_compiler/creator.cpp b/kode/kxml_compiler/creator.cpp index 1277d8d71..591265887 100644 --- a/kode/kxml_compiler/creator.cpp +++ b/kode/kxml_compiler/creator.cpp @@ -36,11 +36,11 @@ #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> -#include <qregexp.h> -#include <qmap.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqregexp.h> +#include <tqmap.h> #include <iostream> @@ -50,7 +50,7 @@ Creator::Creator( XmlParserType p, XmlWriterType w ) setExternalClassNames(); } -void Creator::setExternalClassPrefix( const QString &prefix ) +void Creator::setExternalClassPrefix( const TQString &prefix ) { mExternalClassPrefix = prefix; @@ -65,18 +65,18 @@ void Creator::setExternalClassNames() KODE::File &Creator::file() { return mFile; } -QString Creator::upperFirst( const QString &str ) +TQString Creator::upperFirst( const TQString &str ) { return KODE::Style::upperFirst( str ); } -QString Creator::lowerFirst( const QString &str ) +TQString Creator::lowerFirst( const TQString &str ) { return KODE::Style::lowerFirst( str ); } -void Creator::createProperty( KODE::Class &c, const QString &type, - const QString &name ) +void Creator::createProperty( KODE::Class &c, const TQString &type, + const TQString &name ) { KODE::MemberVariable v( name, type ); c.addMemberVariable( v ); @@ -95,28 +95,28 @@ void Creator::createProperty( KODE::Class &c, const QString &type, void Creator::createElementFunctions( KODE::Class &c, Element *e ) { if ( e->hasText ) { - createProperty( c, "QString", e->name ); + createProperty( c, "TQString", e->name ); if ( mXmlParserType == XmlParserCustomExternal ) { createTextElementParserCustom( c, e ); } return; } - QString type = upperFirst( e->name ); + TQString type = upperFirst( e->name ); if ( !mFile.hasClass( type ) ) { createClass( e ); } - QString name = lowerFirst( e->name ); + TQString name = lowerFirst( e->name ); if ( e->pattern.oneOrMore || e->pattern.zeroOrMore || e->pattern.choice || e->pattern.optional ) { registerListTypedef( type ); - c.addHeaderInclude( "qvaluelist.h" ); + c.addHeaderInclude( "tqvaluelist.h" ); type = type + "::List"; - QString className = upperFirst( name ); + TQString className = upperFirst( name ); name = name + "List"; KODE::Function adder( "add" + className, "void" ); @@ -135,7 +135,7 @@ void Creator::createElementFunctions( KODE::Class &c, Element *e ) void Creator::createClass( Element *element ) { - QString className = upperFirst( element->name ); + TQString className = upperFirst( element->name ); if ( mProcessedClasses.find( className ) != mProcessedClasses.end() ) { return; @@ -145,21 +145,21 @@ void Creator::createClass( Element *element ) mProcessedClasses.append( className ); - QValueList<Attribute *>::ConstIterator itA; + TQValueList<Attribute *>::ConstIterator itA; for( itA = element->attributes.begin(); itA != element->attributes.end(); ++itA ) { Attribute *a = *itA; - createProperty( c, "QString", a->name ); + createProperty( c, "TQString", a->name ); } - QValueList<Element *>::ConstIterator itE; + TQValueList<Element *>::ConstIterator itE; for( itE = element->elements.begin(); itE != element->elements.end(); ++itE ) { createElementFunctions( c, *itE ); } - QValueList<Reference *>::ConstIterator itR; + TQValueList<Reference *>::ConstIterator itR; for( itR = element->references.begin(); itR != element->references.end(); ++itR ) { Element e; @@ -176,15 +176,15 @@ void Creator::createClass( Element *element ) void Creator::createElementWriter( KODE::Class &c, Element *element ) { - KODE::Function writer( "writeElement", "QString" ); + KODE::Function writer( "writeElement", "TQString" ); KODE::Code code; - code += "QString xml;"; + code += "TQString xml;"; - QString tag = "<" + element->name; + TQString tag = "<" + element->name; - QValueList<Attribute *>::ConstIterator it3; + TQValueList<Attribute *>::ConstIterator it3; for( it3 = element->attributes.begin(); it3 != element->attributes.end(); ++it3 ) { tag += " " + (*it3)->name + "=\\\"\" + " + (*it3)->name + "() + \"\\\""; @@ -201,10 +201,10 @@ void Creator::createElementWriter( KODE::Class &c, Element *element ) if ( !element->isEmpty ) { code += "indent( 2 );"; - QValueList<Element *>::ConstIterator it; + TQValueList<Element *>::ConstIterator it; for( it = element->elements.begin(); it != element->elements.end(); ++it ) { Element *e = *it; - QString type = upperFirst( e->name ); + TQString type = upperFirst( e->name ); if ( e->pattern.oneOrMore || e->pattern.zeroOrMore ) { code += type + "::List list = " + e->name + "List();"; code += type + "::List::ConstIterator it;"; @@ -223,11 +223,11 @@ void Creator::createElementWriter( KODE::Class &c, Element *element ) } } - QValueList<Reference *>::ConstIterator it2; + TQValueList<Reference *>::ConstIterator it2; for( it2 = element->references.begin(); it2 != element->references.end(); ++it2 ) { Reference *r = *it2; - QString type = upperFirst( r->name ); + TQString type = upperFirst( r->name ); if ( r->pattern.oneOrMore || r->pattern.zeroOrMore ) { code += type + "::List list2 = " + r->name + "List();"; code += type + "::List::ConstIterator it2;"; @@ -268,11 +268,11 @@ void Creator::createElementParser( KODE::Class &c, Element *e ) void Creator::createTextElementParserCustom( KODE::Class &, Element *e ) { - KODE::Function parser( "parseElement" + upperFirst( e->name ), "QString" ); + KODE::Function parser( "parseElement" + upperFirst( e->name ), "TQString" ); KODE::Code code; - code += "QString result;"; + code += "TQString result;"; code.newLine(); KODE::StateMachine sm; @@ -285,7 +285,7 @@ void Creator::createTextElementParserCustom( KODE::Class &, Element *e ) stateCode += "} else if ( c == '&' ) {"; stateCode += " entityStart = mRunning + 1;"; stateCode += "} else if ( entityStart >= 0 && c == ';' ) {"; - stateCode += " QString entity = mBuffer.mid( entityStart, mRunning - entityStart );"; + stateCode += " TQString entity = mBuffer.mid( entityStart, mRunning - entityStart );"; stateCode += " if ( entity == \"quot\" ) result += '\"';"; stateCode += " entityStart = -1;"; stateCode += "} else if ( entityStart < 0 ) {"; @@ -330,7 +330,7 @@ void Creator::createTextElementParserCustom( KODE::Class &, Element *e ) code.newLine(); code += "while ( mRunning < mBuffer.length() ) {"; code.indent(); - code += "QChar c = mBuffer[ mRunning ];"; + code += "TQChar c = mBuffer[ mRunning ];"; code.addBlock( sm.transitionLogic() ); code += "++mRunning;"; code.unindent(); @@ -382,9 +382,9 @@ void Creator::createElementParserCustom( KODE::Class &c, Element *e ) for( it = e->elements.begin(); it != e->elements.end(); ++it ) { createFoundTextFunction( (*it)->name ); - QString eName = upperFirst( (*it)->name ); + TQString eName = upperFirst( (*it)->name ); stateCode += "} else if ( foundText" + eName + "() ) {"; - QString line = " result->"; + TQString line = " result->"; if ( (*it)->hasText ) line += "set"; else line += "add"; line += eName + "( parseElement" + eName + "() );"; @@ -395,7 +395,7 @@ void Creator::createElementParserCustom( KODE::Class &c, Element *e ) for( it3 = e->references.begin(); it3 != e->references.end(); ++it3 ) { createFoundTextFunction( (*it3)->name ); - QString eName = upperFirst( (*it3)->name ); + TQString eName = upperFirst( (*it3)->name ); stateCode += "} else if ( foundText" + eName + "() ) {"; stateCode += " result->add" + eName + "( parseElement" + eName + "() );"; stateCode += " state = WHITESPACE;"; @@ -451,7 +451,7 @@ void Creator::createElementParserCustom( KODE::Class &c, Element *e ) code += "while ( mRunning < mBuffer.length() ) {"; code.indent(); - code += "QChar c = mBuffer[ mRunning ];"; + code += "TQChar c = mBuffer[ mRunning ];"; if ( e->isEmpty ) { code += "if ( c == '>' ) {"; @@ -485,11 +485,11 @@ KODE::Code Creator::createAttributeScanner( Attribute *a, bool firstAttribute ) { KODE::Code code; - QString aName = upperFirst( a->name ); + TQString aName = upperFirst( a->name ); createFoundTextFunction( a->name ); - QString line; + TQString line; if ( !firstAttribute ) line = "} else "; line += "if ( foundText" + aName + "() ) {"; code += line; @@ -509,7 +509,7 @@ KODE::Code Creator::createAttributeScanner( Attribute *a, bool firstAttribute ) void Creator::createElementParserDom( KODE::Class &c, Element *e ) { - QString functionName; + TQString functionName; if ( externalParser() ) functionName = "parseElement" + c.name(); else functionName = "parseElement"; @@ -517,7 +517,7 @@ void Creator::createElementParserDom( KODE::Class &c, Element *e ) parser.setStatic( true ); parser.setDocs( "Parse XML object from DOM element." ); - parser.addArgument( "const QDomElement &element" ); + parser.addArgument( "const TQDomElement &element" ); KODE::Code code; @@ -533,27 +533,27 @@ void Creator::createElementParserDom( KODE::Class &c, Element *e ) code += c.name() + " *result = new " + c.name() + "();"; code.newLine(); - code += "QDomNode n;"; + code += "TQDomNode n;"; code += "for( n = element.firstChild(); !n.isNull();" " n = n.nextSibling() ) {"; code.indent(); - code += "QDomElement e = n.toElement();"; + code += "TQDomElement e = n.toElement();"; - QValueList<Element *>::ConstIterator it; + TQValueList<Element *>::ConstIterator it; for( it = e->elements.begin(); it != e->elements.end(); ++it ) { - QString condition; + TQString condition; if ( it != e->elements.begin() ) condition = "else "; condition += "if"; code += condition + " ( e.tagName() == \"" + (*it)->name + "\" ) {"; code.indent(); - QString className = upperFirst( (*it)->name ); + TQString className = upperFirst( (*it)->name ); if ( (*it)->hasText ) { code += "result->set" + className + "( e.text() );"; } else { - QString line = className + " *o = "; + TQString line = className + " *o = "; if ( externalParser() ) { line += "parseElement" + className; } else { @@ -571,18 +571,18 @@ void Creator::createElementParserDom( KODE::Class &c, Element *e ) code.newLine(); - QValueList<Reference *>::ConstIterator it3; + TQValueList<Reference *>::ConstIterator it3; for( it3 = e->references.begin(); it3 != e->references.end(); ++it3 ) { - QString condition; + TQString condition; if ( it3 != e->references.begin() ) condition = "else "; condition += "if"; code += condition + " ( e.tagName() == \"" + (*it3)->name + "\" ) {"; code.indent(); - QString className = upperFirst( (*it3)->name ); + TQString className = upperFirst( (*it3)->name ); - QString line = className + " *o = "; + TQString line = className + " *o = "; if ( externalParser() ) { line += "parseElement" + className; } else { @@ -601,7 +601,7 @@ void Creator::createElementParserDom( KODE::Class &c, Element *e ) code += "}"; code.newLine(); - QValueList<Attribute *>::ConstIterator it2; + TQValueList<Attribute *>::ConstIterator it2; for( it2 = e->attributes.begin(); it2 != e->attributes.end(); ++it2 ) { code += "result->set" + upperFirst( (*it2)->name ) + "( element.attribute( \"" + (*it2)->name + "\" ) );"; @@ -619,32 +619,32 @@ void Creator::createElementParserDom( KODE::Class &c, Element *e ) } } -void Creator::registerListTypedef( const QString &type ) +void Creator::registerListTypedef( const TQString &type ) { if ( !mListTypedefs.contains( type ) ) mListTypedefs.append( type ); } void Creator::createListTypedefs() { - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for( it = mListTypedefs.begin(); it != mListTypedefs.end(); ++it ) { KODE::Class c = mFile.findClass( *it ); if ( !c.isValid() ) continue; - c.addTypedef( KODE::Typedef( "QValueList<" + *it + " *>", "List" ) ); + c.addTypedef( KODE::Typedef( "TQValueList<" + *it + " *>", "List" ) ); mFile.insertClass( c ); } } void Creator::createIndenter( KODE::File &file ) { - KODE::Function indenter( "indent", "QString" ); + KODE::Function indenter( "indent", "TQString" ); indenter.addArgument( "int n = 0" ); KODE::Code code; code += "static int i = 0;"; code += "i += n;"; - code += "QString space;"; + code += "TQString space;"; code += "return space.fill( ' ', i );"; indenter.setBody( code ); @@ -652,15 +652,15 @@ void Creator::createIndenter( KODE::File &file ) file.addFileFunction( indenter ); } -void Creator::createFileWriter( Element *element, const QString &dtd ) +void Creator::createFileWriter( Element *element, const TQString &dtd ) { - QString className = upperFirst( element->name ); + TQString className = upperFirst( element->name ); KODE::Class c = mFile.findClass( className ); c.addInclude( "kdebug.h" ); - c.addInclude( "qtextstream.h" ); - c.addInclude( "qfile.h" ); + c.addInclude( "tqtextstream.h" ); + c.addInclude( "tqfile.h" ); if ( !externalWriter() ) { createIndenter( mFile ); @@ -668,19 +668,19 @@ void Creator::createFileWriter( Element *element, const QString &dtd ) KODE::Function writer( "writeFile", "bool" ); - writer.addArgument( "const QString &filename" ); + writer.addArgument( "const TQString &filename" ); - c.addInclude( "qfile.h" ); + c.addInclude( "tqfile.h" ); KODE::Code code; - code += "QFile file( filename );"; + code += "TQFile file( filename );"; code += "if ( !file.open( IO_WriteOnly ) ) {"; code += " kdError() << \"Unable to open file '\" << filename << \"'\" << endl;"; code += " return false;"; code += "}"; code += ""; - code += "QTextStream ts( &file );"; + code += "TQTextStream ts( &file );"; code += "ts << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\";"; code += "ts << \"<!DOCTYPE features SYSTEM \\\"" + dtd + "\\\">\\n\";"; @@ -714,29 +714,29 @@ void Creator::createFileParserCustom( Element *element ) { kdDebug() << "Creator::createFileParserCustom()" << endl; - QString className = upperFirst( element->name ); + TQString className = upperFirst( element->name ); KODE::Function parser( "parseFile", className + " *" ); - parser.addArgument( "const QString &filename" ); + parser.addArgument( "const TQString &filename" ); - mParserClass.addInclude( "qfile.h" ); + mParserClass.addInclude( "tqfile.h" ); mParserClass.addInclude( "kdebug.h" ); mParserClass.addMemberVariable( KODE::MemberVariable( "mBuffer", - "QString" ) ); + "TQString" ) ); mParserClass.addMemberVariable( KODE::MemberVariable( "mRunning", "unsigned int" ) ); KODE::Code code; - code += "QFile file( filename );"; + code += "TQFile file( filename );"; code += "if ( !file.open( IO_ReadOnly ) ) {"; code += " kdError() << \"Unable to open file '\" << filename << \"'\" << endl;"; code += " return 0;"; code += "}"; code += ""; - code += "QTextStream ts( &file );"; + code += "TQTextStream ts( &file );"; code += "mBuffer = ts.read();"; code += ""; code += "mRunning = 0;"; @@ -771,7 +771,7 @@ void Creator::createFileParserCustom( Element *element ) code += "while ( mRunning < mBuffer.length() ) {"; code.indent(); - code += "QChar c = mBuffer[ mRunning ];"; + code += "TQChar c = mBuffer[ mRunning ];"; code.addBlock( sm.transitionLogic() ); code += "++mRunning;"; code.unindent(); @@ -785,9 +785,9 @@ void Creator::createFileParserCustom( Element *element ) mParserClass.addFunction( parser ); } -void Creator::createFoundTextFunction( const QString &text ) +void Creator::createFoundTextFunction( const TQString &text ) { - QString functionName = "foundText" + upperFirst( text ); + TQString functionName = "foundText" + upperFirst( text ); if ( mParserClass.hasFunction( functionName ) ) return; @@ -798,8 +798,8 @@ void Creator::createFoundTextFunction( const QString &text ) code += "if ( mBuffer[ mRunning ] != '" + text.right( 1 ) + "' ) return false;"; code += ""; code += "return mBuffer.mid( mRunning - " + - QString::number( text.length() - 1 ) + ", " + - QString::number( text.length() ) + " ) == \"" + text + "\";"; + TQString::number( text.length() - 1 ) + ", " + + TQString::number( text.length() ) + " ) == \"" + text + "\";"; f.setBody( code ); @@ -810,7 +810,7 @@ void Creator::createFileParserDom( Element *element ) { kdDebug() << "Creator::createFileParserDom()" << endl; - QString className = upperFirst( element->name ); + TQString className = upperFirst( element->name ); KODE::Class c; @@ -823,23 +823,23 @@ void Creator::createFileParserDom( Element *element ) KODE::Function parser( "parseFile", className + " *" ); parser.setStatic( true ); - parser.addArgument( "const QString &filename" ); + parser.addArgument( "const TQString &filename" ); - c.addInclude( "qfile.h" ); - c.addInclude( "qdom.h" ); + c.addInclude( "tqfile.h" ); + c.addInclude( "tqdom.h" ); c.addInclude( "kdebug.h" ); KODE::Code code; - code += "QFile file( filename );"; + code += "TQFile file( filename );"; code += "if ( !file.open( IO_ReadOnly ) ) {"; code += " kdError() << \"Unable to open file '\" << filename << \"'\" << endl;"; code += " return 0;"; code += "}"; code += ""; - code += "QString errorMsg;"; + code += "TQString errorMsg;"; code += "int errorLine, errorCol;"; - code += "QDomDocument doc;"; + code += "TQDomDocument doc;"; code += "if ( !doc.setContent( &file, false, &errorMsg, &errorLine, &errorCol ) ) {"; code += " kdError() << errorMsg << \" at \" << errorLine << \",\" << errorCol << endl;"; code += " return 0;"; @@ -849,7 +849,7 @@ void Creator::createFileParserDom( Element *element ) code += ""; - QString line = className + " *c = parseElement"; + TQString line = className + " *c = parseElement"; if ( externalParser() ) line += className; line += "( doc.documentElement() );"; code += line; diff --git a/kode/kxml_compiler/creator.h b/kode/kxml_compiler/creator.h index 6e0d6f8b3..2103f928e 100644 --- a/kode/kxml_compiler/creator.h +++ b/kode/kxml_compiler/creator.h @@ -38,11 +38,11 @@ #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> -#include <qregexp.h> -#include <qmap.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqregexp.h> +#include <tqmap.h> #include <iostream> @@ -56,28 +56,28 @@ class Creator Creator( XmlParserType p = XmlParserDom, XmlWriterType w = XmlWriterCustom ); - void setExternalClassPrefix( const QString & ); + void setExternalClassPrefix( const TQString & ); bool externalParser() const; bool externalWriter() const; KODE::File &file(); - QString upperFirst( const QString &str ); - QString lowerFirst( const QString &str ); + TQString upperFirst( const TQString &str ); + TQString lowerFirst( const TQString &str ); - void createProperty( KODE::Class &c, const QString &type, - const QString &name ); + void createProperty( KODE::Class &c, const TQString &type, + const TQString &name ); void createElementFunctions( KODE::Class &c, Element *e ); void createClass( Element *element ); - void registerListTypedef( const QString &type ); + void registerListTypedef( const TQString &type ); void createListTypedefs(); void createFileParser( Element *element ); - void createFileWriter( Element *element, const QString &dtd ); + void createFileWriter( Element *element, const TQString &dtd ); void printFiles( KODE::Printer & ); @@ -94,7 +94,7 @@ class Creator void createElementParserCustom( KODE::Class &c, Element *e ); void createTextElementParserCustom( KODE::Class &c, Element *e ); KODE::Code createAttributeScanner( Attribute *a, bool firstAttribute ); - void createFoundTextFunction( const QString &text ); + void createFoundTextFunction( const TQString &text ); void createElementWriter( KODE::Class &c, Element *e ); @@ -103,13 +103,13 @@ class Creator private: XmlParserType mXmlParserType; XmlWriterType mXmlWriterType; - QString mExternalClassPrefix; + TQString mExternalClassPrefix; KODE::File mFile; KODE::Class mParserClass; KODE::Class mWriterClass; - QStringList mProcessedClasses; - QStringList mListTypedefs; + TQStringList mProcessedClasses; + TQStringList mListTypedefs; }; #endif diff --git a/kode/kxml_compiler/kxml_compiler.cpp b/kode/kxml_compiler/kxml_compiler.cpp index 62b2162c5..71720d6b9 100644 --- a/kode/kxml_compiler/kxml_compiler.cpp +++ b/kode/kxml_compiler/kxml_compiler.cpp @@ -36,11 +36,11 @@ #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> -#include <qregexp.h> -#include <qmap.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqregexp.h> +#include <tqmap.h> #include <iostream> @@ -77,25 +77,25 @@ int main( int argc, char **argv ) return 1; } - QString baseDir = QFile::decodeName( args->getOption( "directory" ) ); + TQString baseDir = TQFile::decodeName( args->getOption( "directory" ) ); if ( !baseDir.endsWith( "/" ) ) baseDir.append( "/" ); - QString dtdFilename = args->url( 0 ).path(); + TQString dtdFilename = args->url( 0 ).path(); - QString baseName = args->url( 0 ).fileName(); + TQString baseName = args->url( 0 ).fileName(); int pos = baseName.findRev( '.' ); if ( pos > 0 ) baseName = baseName.left( pos ); - QFile dtdFile( dtdFilename ); + TQFile dtdFile( dtdFilename ); if ( !dtdFile.open( IO_ReadOnly ) ) { kdError() << "Unable to open '" << dtdFilename << "'" << endl; return 1; } - QString errorMsg; + TQString errorMsg; int errorLine, errorCol; - QDomDocument doc; + TQDomDocument doc; if ( !doc.setContent( &dtdFile, false, &errorMsg, &errorLine, &errorCol ) ) { kdError() << errorMsg << " at " << errorLine << "," << errorCol << endl; return 1; @@ -135,7 +135,7 @@ int main( int argc, char **argv ) Creator c( pt ); kdDebug() << "Create classes" << endl; - QValueList<Element *>::ConstIterator it; + TQValueList<Element *>::ConstIterator it; for( it = start->elements.begin(); it != start->elements.end(); ++it ) { c.createClass( *it ); } @@ -149,7 +149,7 @@ int main( int argc, char **argv ) c.createListTypedefs(); #if 0 - QValueList<Reference *>::ConstIterator it2; + TQValueList<Reference *>::ConstIterator it2; for( it2 = start->references.begin(); it2 != start->references.end(); ++it2 ) { Element e; diff --git a/kode/kxml_compiler/parser.cpp b/kode/kxml_compiler/parser.cpp index bc451ce0d..9b3f33b99 100644 --- a/kode/kxml_compiler/parser.cpp +++ b/kode/kxml_compiler/parser.cpp @@ -35,11 +35,11 @@ #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> -#include <qregexp.h> -#include <qmap.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqregexp.h> +#include <tqmap.h> #include <iostream> @@ -54,10 +54,10 @@ bool Pattern::isEmpty() return !optional && !zeroOrMore && !oneOrMore && !choice; } -QString Pattern::asString() +TQString Pattern::asString() { if ( isEmpty() ) return ""; - QString str = "( "; + TQString str = "( "; if ( optional ) str += "optional "; if ( zeroOrMore ) str += "zeroOrMore "; if ( oneOrMore ) str += "oneOrMore "; @@ -83,20 +83,20 @@ Parser::Parser() { } -Element *Parser::parse( const QDomElement &docElement ) +Element *Parser::parse( const TQDomElement &docElement ) { Element *start = 0; - QDomNode n1; + TQDomNode n1; for( n1 = docElement.firstChild(); !n1.isNull(); n1 = n1.nextSibling() ) { - QDomElement e1 = n1.toElement(); + TQDomElement e1 = n1.toElement(); kdDebug() << "TOP LEVEL element " << e1.tagName() << endl; if ( e1.tagName() == "define" ) { Element *d = new Element; d->name = e1.attribute( "name" ); parseElement( e1, d, Pattern() ); Element::List definitions; - QMap<QString,Element::List >::ConstIterator it; + TQMap<TQString,Element::List >::ConstIterator it; it = mDefinitionMap.find( d->name ); if ( it != mDefinitionMap.end() ) definitions = *it; definitions.append( d ); @@ -112,14 +112,14 @@ Element *Parser::parse( const QDomElement &docElement ) return start; } -Reference *Parser::parseReference( const QDomElement &referenceElement ) +Reference *Parser::parseReference( const TQDomElement &referenceElement ) { Reference *r = new Reference; r->name = referenceElement.attribute( "name" ); return r; } -bool Parser::parseAttribute( const QDomElement &attributeElement, +bool Parser::parseAttribute( const TQDomElement &attributeElement, Attribute *a ) { a->name = attributeElement.attribute( "name" ); @@ -127,14 +127,14 @@ bool Parser::parseAttribute( const QDomElement &attributeElement, return true; } -bool Parser::parseElement( const QDomElement &elementElement, Element *e, +bool Parser::parseElement( const TQDomElement &elementElement, Element *e, Pattern pattern ) { kdDebug() << "parseElement " << e->name << endl; - QDomNode n1; + TQDomNode n1; for( n1 = elementElement.firstChild(); !n1.isNull(); n1 = n1.nextSibling() ) { - QDomElement e1 = n1.toElement(); + TQDomElement e1 = n1.toElement(); if ( e1.tagName() == "element" ) { Element *element = new Element; element->name = e1.attribute( "name" ); @@ -191,7 +191,7 @@ void Parser::substituteReferences( Element *s ) } else { r->substituted = true; } - QMap<QString,Element::List >::ConstIterator it1; + TQMap<TQString,Element::List >::ConstIterator it1; it1 = mDefinitionMap.find( r->name ); if ( it1 != mDefinitionMap.end() ) { Element::List elements = *it1; @@ -292,7 +292,7 @@ void Parser::dumpTree( Element *s ) void Parser::dumpDefinitionMap() { std::cout << "DEFINITION MAP" << std::endl; - QMap<QString,Element::List >::ConstIterator it; + TQMap<TQString,Element::List >::ConstIterator it; for( it = mDefinitionMap.begin(); it != mDefinitionMap.end(); ++it ) { dumpElements( *it, 2 ); } diff --git a/kode/kxml_compiler/parser.h b/kode/kxml_compiler/parser.h index b9ff542c0..6efd6f746 100644 --- a/kode/kxml_compiler/parser.h +++ b/kode/kxml_compiler/parser.h @@ -35,11 +35,11 @@ #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> -#include <qregexp.h> -#include <qmap.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqregexp.h> +#include <tqmap.h> #include <iostream> @@ -50,7 +50,7 @@ class Pattern bool isEmpty(); - QString asString(); + TQString asString(); void merge( Pattern p ); @@ -63,11 +63,11 @@ class Pattern class Reference { public: - typedef QValueList<Reference *> List; + typedef TQValueList<Reference *> List; Reference() : substituted( false ) {} - QString name; + TQString name; Pattern pattern; bool substituted; @@ -76,22 +76,22 @@ class Reference class Attribute { public: - typedef QValueList<Attribute *> List; + typedef TQValueList<Attribute *> List; - QString name; - QValueList<QString> choices; - QString defaultValue; + TQString name; + TQValueList<TQString> choices; + TQString defaultValue; Pattern pattern; }; class Element { public: - typedef QValueList<Element *> List; + typedef TQValueList<Element *> List; Element(); - QString name; + TQString name; Element::List elements; Attribute::List attributes; Reference::List references; @@ -105,12 +105,12 @@ class Parser public: Parser(); - Element *parse( const QDomElement &docElement ); + Element *parse( const TQDomElement &docElement ); - Reference *parseReference( const QDomElement &referenceElement ); - bool parseAttribute( const QDomElement &attributeElement, + Reference *parseReference( const TQDomElement &referenceElement ); + bool parseAttribute( const TQDomElement &attributeElement, Attribute *a ); - bool parseElement( const QDomElement &elementElement, Element *e, + bool parseElement( const TQDomElement &elementElement, Element *e, Pattern pattern ); void substituteReferences( Element *s ); @@ -128,7 +128,7 @@ class Parser void dumpDefinitionMap(); private: - QMap<QString,Element::List> mDefinitionMap; + TQMap<TQString,Element::List> mDefinitionMap; }; #endif |