diff options
Diffstat (limited to 'kode/kwsdl/converter.cpp')
-rw-r--r-- | kode/kwsdl/converter.cpp | 270 |
1 files changed, 135 insertions, 135 deletions
diff --git a/kode/kwsdl/converter.cpp b/kode/kwsdl/converter.cpp index fc255d74e..5d824afe3 100644 --- a/kode/kwsdl/converter.cpp +++ b/kode/kwsdl/converter.cpp @@ -23,21 +23,21 @@ using namespace KWSDL; -static QString capitalize( const QString &str ) +static TQString capitalize( const TQString &str ) { return str[ 0 ].upper() + str.mid( 1 ); } -static QString escapeEnum( const QString &str ) +static TQString escapeEnum( const TQString &str ) { - QString enumStr = capitalize( str ); + TQString enumStr = capitalize( str ); return enumStr.replace( "-", "_" ); } Converter::Converter() { - mQObject = KODE::Class( "QObject" ); + mQObject = KODE::Class( "TQObject" ); } void Converter::setWSDL( const WSDL &wsdl ) @@ -91,7 +91,7 @@ void Converter::convertSimpleType( const Schema::SimpleType *type ) Use setter and getter method for enums as well. */ if ( type->facetType() & Schema::SimpleType::ENUM ) { - QStringList enums = type->facetEnums(); + TQStringList enums = type->facetEnums(); for ( uint i = 0; i < enums.count(); ++i ) enums[ i ] = escapeEnum( enums[ i ] ); @@ -123,12 +123,12 @@ void Converter::convertSimpleType( const Schema::SimpleType *type ) type->baseType() != Schema::XSDType::INVALID && !(type->facetType() & Schema::SimpleType::ENUM) ) { - const QString baseName = type->baseTypeName(); - const QString typeName = mTypeMapper.type( baseName ); + const TQString baseName = type->baseTypeName(); + const TQString typeName = mTypeMapper.type( baseName ); // include header - QMap<QString, QString> headerDec = mTypeMapper.headerDec( baseName ); - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQString> headerDec = mTypeMapper.headerDec( baseName ); + TQMap<TQString, TQString>::ConstIterator it; for ( it = headerDec.begin(); it != headerDec.end(); ++it ) { if ( !it.key().isEmpty() ) newClass.addInclude( it.key(), it.data() ); @@ -159,13 +159,13 @@ void Converter::convertSimpleType( const Schema::SimpleType *type ) newClass.addFunction( getter ); } } else if ( type->subType() == Schema::SimpleType::TypeList ) { - newClass.addHeaderInclude( "qptrlist.h" ); - const QString baseName = type->listTypeName(); - const QString typeName = mTypeMapper.type( baseName ); + newClass.addHeaderInclude( "tqptrlist.h" ); + const TQString baseName = type->listTypeName(); + const TQString typeName = mTypeMapper.type( baseName ); // include header - QMap<QString, QString> headerDec = mTypeMapper.headerDec( baseName ); - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQString> headerDec = mTypeMapper.headerDec( baseName ); + TQMap<TQString, TQString>::ConstIterator it; for ( it = headerDec.begin(); it != headerDec.end(); ++it ) { if ( !it.key().isEmpty() ) newClass.addInclude( it.key(), it.data() ); @@ -175,7 +175,7 @@ void Converter::convertSimpleType( const Schema::SimpleType *type ) } // member variables - KODE::MemberVariable variable( "entries", "QPtrList<" + typeName + ">*" ); + KODE::MemberVariable variable( "entries", "TQPtrList<" + typeName + ">*" ); newClass.addMemberVariable( variable ); ctorCode += variable.name() + " = 0;"; @@ -188,7 +188,7 @@ void Converter::convertSimpleType( const Schema::SimpleType *type ) setter.setBody( variable.name() + " = entries;" ); // getter method - KODE::Function getter( "entries", "QPtrList<" + typeName + ">*" ); + KODE::Function getter( "entries", "TQPtrList<" + typeName + ">*" ); getter.setBody( " return " + variable.name() + ";" ); getter.setConst( true ); @@ -212,26 +212,26 @@ void Converter::convertSimpleType( const Schema::SimpleType *type ) void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) { - const QString typeName = mTypeMapper.type( type ); - const QString baseType = mTypeMapper.type( type->baseTypeName() ); + const TQString typeName = mTypeMapper.type( type ); + const TQString baseType = mTypeMapper.type( type->baseTypeName() ); KODE::Function marshal( "marshal", "void" ); marshal.setStatic( true ); - marshal.addArgument( "QDomDocument &doc" ); - marshal.addArgument( "QDomElement &parent" ); - marshal.addArgument( "const QString &name" ); + marshal.addArgument( "TQDomDocument &doc" ); + marshal.addArgument( "TQDomElement &parent" ); + marshal.addArgument( "const TQString &name" ); marshal.addArgument( "const " + typeName + "* value" ); KODE::Function demarshal( "demarshal", "void" ); demarshal.setStatic( true ); - demarshal.addArgument( "const QDomElement &parent" ); + demarshal.addArgument( "const TQDomElement &parent" ); demarshal.addArgument( typeName + "* value" ); KODE::Code marshalCode, demarshalCode, code; // include header - QMap<QString, QString> headerDec = mTypeMapper.headerDec( type->name() ); - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQString> headerDec = mTypeMapper.headerDec( type->name() ); + TQMap<TQString, TQString>::ConstIterator it; for ( it = headerDec.begin(); it != headerDec.end(); ++it ) { if ( !it.key().isEmpty() ) mSerializer.addInclude( it.key(), it.data() ); @@ -243,13 +243,13 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) if ( type->subType() == Schema::SimpleType::TypeRestriction ) { // is an enumeration if ( type->facetType() & Schema::SimpleType::ENUM ) { - QStringList enums = type->facetEnums(); - QStringList escapedEnums; + TQStringList enums = type->facetEnums(); + TQStringList escapedEnums; for ( uint i = 0; i < enums.count(); ++i ) escapedEnums.append( escapeEnum( enums[ i ] ) ); // marshal value - KODE::Function marshalValue( "marshalValue", "QString" ); + KODE::Function marshalValue( "marshalValue", "TQString" ); marshalValue.setStatic( true ); marshalValue.addArgument( "const " + typeName + "* value" ); code += "switch ( value->type() ) {"; @@ -269,11 +269,11 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) code.unindent(); code += "}"; code.newLine(); - code += "return QString();"; + code += "return TQString();"; marshalValue.setBody( code ); // marshal - marshalCode += "QDomElement root = doc.createElement( name );"; + marshalCode += "TQDomElement root = doc.createElement( name );"; marshalCode += "root.setAttribute( \"xsi:type\", \"ns1:" + type->name() + "\" );"; marshalCode += "parent.appendChild( root );"; marshalCode += "root.appendChild( doc.createTextNode( Serializer::marshalValue( value ) ) );"; @@ -281,7 +281,7 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) // demarshal value KODE::Function demarshalValue( "demarshalValue", "void" ); demarshalValue.setStatic( true ); - demarshalValue.addArgument( "const QString &str" ); + demarshalValue.addArgument( "const TQString &str" ); demarshalValue.addArgument( typeName + "* value" ); code.clear(); for ( uint i = 0; i < enums.count(); ++i ) { @@ -305,7 +305,7 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) marshalCode.unindent(); marshalCode += "}"; - demarshalCode += "const QString text = parent.text();"; + demarshalCode += "const TQString text = parent.text();"; demarshalCode.newLine(); demarshalCode += "if ( !text.isEmpty() ) {"; demarshalCode.indent(); @@ -315,7 +315,7 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) demarshalCode.unindent(); demarshalCode += "}"; - KODE::Function marshalValue( "marshalValue", "QString" ); + KODE::Function marshalValue( "marshalValue", "TQString" ); marshalValue.setStatic( true ); marshalValue.addArgument( "const " + typeName + "* value" ); marshalValue.setBody( "return Serializer::marshalValue( value->value() );" ); @@ -324,7 +324,7 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) KODE::Function demarshalValue( "demarshalValue", "void" ); demarshalValue.setStatic( true ); - demarshalValue.addArgument( "const QString &str" ); + demarshalValue.addArgument( "const TQString &str" ); demarshalValue.addArgument( typeName + "* value" ); KODE::Code code; code += baseType + "* data = new " + baseType + ";"; @@ -335,15 +335,15 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) mSerializer.addFunction( demarshalValue ); } } else if ( type->subType() == Schema::SimpleType::TypeList ) { - const QString listType = mTypeMapper.type( type->listTypeName() ); + const TQString listType = mTypeMapper.type( type->listTypeName() ); - mSerializer.addInclude( "qstringlist.h" ); + mSerializer.addInclude( "tqstringlist.h" ); marshalCode += "if ( value->entries() ) {"; marshalCode.indent(); - marshalCode += "QStringList list;"; - marshalCode += "QPtrList<" + listType + ">* entries = value->entries();"; - marshalCode += "QPtrListIterator<" + listType + "> it( *entries );"; + marshalCode += "TQStringList list;"; + marshalCode += "TQPtrList<" + listType + ">* entries = value->entries();"; + marshalCode += "TQPtrListIterator<" + listType + "> it( *entries );"; marshalCode += "while ( it.current() != 0 ) {"; marshalCode.indent(); marshalCode += "list.append( Serializer::marshalValue( it.current() ) );"; @@ -351,18 +351,18 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type ) marshalCode.unindent(); marshalCode += "}"; marshalCode.newLine(); - marshalCode += "QDomElement element = doc.createElement( name );"; + marshalCode += "TQDomElement element = doc.createElement( name );"; marshalCode += "parent.appendChild( element );"; marshalCode += "element.appendChild( doc.createTextNode( list.join( \" \" ) ) );"; marshalCode.unindent(); marshalCode += "}"; - demarshalCode += "const QStringList list = QStringList::split( \" \", parent.text(), false );"; + demarshalCode += "const TQStringList list = TQStringList::split( \" \", parent.text(), false );"; demarshalCode += "if ( !list.isEmpty() ) {"; demarshalCode.indent(); - demarshalCode += "QPtrList<" + listType + ">* entries = new QPtrList<" + listType + ">;"; + demarshalCode += "TQPtrList<" + listType + ">* entries = new TQPtrList<" + listType + ">;"; demarshalCode += "entries->setAutoDelete( true );"; - demarshalCode += "QStringList::ConstIterator it;"; + demarshalCode += "TQStringList::ConstIterator it;"; demarshalCode += "for ( it = list.begin(); it != list.end(); ++it ) {"; demarshalCode.indent(); demarshalCode += listType + " *entry = new " + listType + ";"; @@ -391,7 +391,7 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) KODE::Code ctorCode, dtorCode; if ( type->baseType() != Schema::XSDType::ANYTYPE && !type->isArray() ) { - QString baseName = mTypeMapper.type( type->baseTypeName() ); + TQString baseName = mTypeMapper.type( type->baseTypeName() ); newClass.addBaseClass( KODE::Class( baseName ) ); newClass.addHeaderIncludes( mTypeMapper.header( type->baseTypeName() ) ); } @@ -403,10 +403,10 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) Schema::Element::List elements = type->elements(); Schema::Element::List::ConstIterator elemIt; for ( elemIt = elements.begin(); elemIt != elements.end(); ++elemIt ) { - QString typeName = mTypeMapper.type( &*elemIt ); + TQString typeName = mTypeMapper.type( &*elemIt ); if ( (*elemIt).maxOccurs() > 1 ) - typeName = "QPtrList<" + typeName + ">"; + typeName = "TQPtrList<" + typeName + ">"; // member variables KODE::MemberVariable variable( (*elemIt).name(), typeName + "*" ); @@ -416,8 +416,8 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) dtorCode += "delete " + variable.name() + ";"; dtorCode += variable.name() + " = 0;"; - QString upperName = (*elemIt).name(); - QString lowerName = (*elemIt).name(); + TQString upperName = (*elemIt).name(); + TQString lowerName = (*elemIt).name(); upperName[ 0 ] = upperName[ 0 ].upper(); lowerName[ 0 ] = lowerName[ 0 ].lower(); @@ -435,8 +435,8 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) newClass.addFunction( getter ); // include header - QMap<QString, QString> headerDec = mTypeMapper.headerDec( &*elemIt); - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQString> headerDec = mTypeMapper.headerDec( &*elemIt); + TQMap<TQString, TQString>::ConstIterator it; for ( it = headerDec.begin(); it != headerDec.end(); ++it ) { if ( !it.key().isEmpty() ) newClass.addInclude( it.key(), it.data() ); @@ -450,7 +450,7 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) Schema::Attribute::List attributes = type->attributes(); Schema::Attribute::List::ConstIterator attrIt; for ( attrIt = attributes.begin(); attrIt != attributes.end(); ++attrIt ) { - const QString typeName = mTypeMapper.type( &*attrIt ); + const TQString typeName = mTypeMapper.type( &*attrIt ); // member variables KODE::MemberVariable variable( (*attrIt).name(), typeName + "*" ); @@ -460,8 +460,8 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) dtorCode += "delete " + variable.name() + ";"; dtorCode += variable.name() + " = 0;"; - QString upperName = (*attrIt).name(); - QString lowerName = (*attrIt).name(); + TQString upperName = (*attrIt).name(); + TQString lowerName = (*attrIt).name(); upperName[ 0 ] = upperName[ 0 ].upper(); lowerName[ 0 ] = lowerName[ 0 ].lower(); @@ -479,8 +479,8 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) newClass.addFunction( getter ); // include header - QMap<QString, QString> headerDec = mTypeMapper.headerDec( &*attrIt); - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQString> headerDec = mTypeMapper.headerDec( &*attrIt); + TQMap<TQString, TQString>::ConstIterator it; for ( it = headerDec.begin(); it != headerDec.end(); ++it ) { if ( !it.key().isEmpty() ) newClass.addInclude( it.key(), it.data() ); @@ -506,25 +506,25 @@ void Converter::convertComplexType( const Schema::ComplexType *type ) void Converter::createComplexTypeSerializer( const Schema::ComplexType *type ) { - const QString typeName = mTypeMapper.type( type ); + const TQString typeName = mTypeMapper.type( type ); KODE::Function marshal( "marshal", "void" ); marshal.setStatic( true ); - marshal.addArgument( "QDomDocument &doc" ); - marshal.addArgument( "QDomElement &parent" ); - marshal.addArgument( "const QString &name" ); + marshal.addArgument( "TQDomDocument &doc" ); + marshal.addArgument( "TQDomElement &parent" ); + marshal.addArgument( "const TQString &name" ); marshal.addArgument( "const " + typeName + "* value" ); KODE::Function demarshal( "demarshal", "void" ); demarshal.setStatic( true ); - demarshal.addArgument( "const QDomElement &parent" ); + demarshal.addArgument( "const TQDomElement &parent" ); demarshal.addArgument( typeName + "* value" ); KODE::Code marshalCode, demarshalCode, demarshalFinalCode; // include header - QMap<QString, QString> headerDec = mTypeMapper.headerDec( type->name() ); - QMap<QString, QString>::ConstIterator it; + TQMap<TQString, TQString> headerDec = mTypeMapper.headerDec( type->name() ); + TQMap<TQString, TQString>::ConstIterator it; for ( it = headerDec.begin(); it != headerDec.end(); ++it ) { if ( !it.key().isEmpty() ) mSerializer.addInclude( it.key(), it.data() ); @@ -533,14 +533,14 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type ) mSerializer.addHeaderInclude( it.key() ); } - marshalCode += "QDomElement root = doc.createElement( name );"; + marshalCode += "TQDomElement root = doc.createElement( name );"; marshalCode += "root.setAttribute( \"xsi:type\", \"ns1:" + typeName + "\" );"; marshalCode += "parent.appendChild( root );"; - demarshalCode += "QDomNode node = parent.firstChild();"; + demarshalCode += "TQDomNode node = parent.firstChild();"; demarshalCode += "while ( !node.isNull() ) {"; demarshalCode.indent(); - demarshalCode += "QDomElement element = node.toElement();"; + demarshalCode += "TQDomElement element = node.toElement();"; demarshalCode += "if ( !element.isNull() ) {"; demarshalCode.indent(); @@ -548,10 +548,10 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type ) Schema::Element::List elements = type->elements(); Schema::Element::List::ConstIterator elemIt; for ( elemIt = elements.begin(); elemIt != elements.end(); ++elemIt ) { - const QString typeName = mTypeMapper.type( &*elemIt ); + const TQString typeName = mTypeMapper.type( &*elemIt ); - QString upperName = (*elemIt).name(); - QString lowerName = (*elemIt).name(); + TQString upperName = (*elemIt).name(); + TQString lowerName = (*elemIt).name(); upperName[ 0 ] = upperName[ 0 ].upper(); lowerName[ 0 ] = lowerName[ 0 ].lower(); @@ -561,16 +561,16 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type ) if ( (*elemIt).maxOccurs() > 1 ) { marshalCode += "if ( value->" + mNameMapper.escape( lowerName ) + "() ) {"; marshalCode.indent(); - marshalCode += "const QPtrList<" + typeName + ">* list = value->" + mNameMapper.escape( lowerName ) + "();"; + marshalCode += "const TQPtrList<" + typeName + ">* list = value->" + mNameMapper.escape( lowerName ) + "();"; marshalCode.newLine(); - marshalCode += "QDomElement element = doc.createElement( name );"; + marshalCode += "TQDomElement element = doc.createElement( name );"; // no idea about the namespaces here... marshalCode += "element.setAttribute( \"xmlns:ns1\", \"http://schemas.xmlsoap.org/soap/encoding/\" );"; marshalCode += "element.setAttribute( \"xsi:type\", \"ns1:Array\" );"; - marshalCode += "element.setAttribute( \"ns1:arrayType\", \"ns1:" + typeName + "[\" + QString::number( list->count() ) + \"]\" );"; + marshalCode += "element.setAttribute( \"ns1:arrayType\", \"ns1:" + typeName + "[\" + TQString::number( list->count() ) + \"]\" );"; marshalCode += "parent.appendChild( element );"; marshalCode.newLine(); - marshalCode += "QPtrListIterator<" + typeName + "> it( *list );"; + marshalCode += "TQPtrListIterator<" + typeName + "> it( *list );"; marshalCode += "while ( it.current() != 0 ) {"; marshalCode.indent(); marshalCode += "Serializer::marshal( doc, element, \"item\", it.current() );"; @@ -580,10 +580,10 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type ) marshalCode.unindent(); marshalCode += "}"; - const QString listName = mNameMapper.escape( lowerName ) + "List"; + const TQString listName = mNameMapper.escape( lowerName ) + "List"; // TODO: prepend the code somehow KODE::Code code; - code += "QPtrList<" + typeName + ">* " + listName + " = new QPtrList<" + typeName + ">();"; + code += "TQPtrList<" + typeName + ">* " + listName + " = new TQPtrList<" + typeName + ">();"; code += listName + "->setAutoDelete( true );"; code += demarshalCode; demarshalCode = code; @@ -617,10 +617,10 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type ) Schema::Attribute::List attributes = type->attributes(); Schema::Attribute::List::ConstIterator attrIt; for ( attrIt = attributes.begin(); attrIt != attributes.end(); ++attrIt ) { - const QString typeName = mTypeMapper.type( &*attrIt ); + const TQString typeName = mTypeMapper.type( &*attrIt ); - QString upperName = (*attrIt).name(); - QString lowerName = (*attrIt).name(); + TQString upperName = (*attrIt).name(); + TQString lowerName = (*attrIt).name(); upperName[ 0 ] = upperName[ 0 ].upper(); lowerName[ 0 ] = lowerName[ 0 ].lower(); @@ -661,8 +661,8 @@ void Converter::convertService( const Service &service ) { KODE::Class newClass( service.name() ); newClass.addBaseClass( mQObject ); - newClass.addHeaderInclude( "qobject.h" ); - newClass.addHeaderInclude( "qstring.h" ); + newClass.addHeaderInclude( "tqobject.h" ); + newClass.addHeaderInclude( "tqstring.h" ); newClass.addHeaderInclude( "transport.h" ); newClass.addInclude( "serializer.h" ); @@ -689,9 +689,9 @@ void Converter::convertService( const Service &service ) KODE::MemberVariable transport( inputMessage.name() + "Transport", "Transport" ); ctorCode += transport.name() + " = new Transport( \"" + (*it).mLocation + "\" );"; - ctorCode += "connect( " + transport.name() + ", SIGNAL( result( const QString& ) ),"; + ctorCode += "connect( " + transport.name() + ", TQT_SIGNAL( result( const TQString& ) ),"; ctorCode.indent(); - ctorCode += "this, SLOT( " + outputMessage.name() + "Slot( const QString& ) ) );"; + ctorCode += "this, TQT_SLOT( " + outputMessage.name() + "Slot( const TQString& ) ) );"; ctorCode.unindent(); dtorCode += "delete " + transport.name() + ";"; @@ -714,7 +714,7 @@ void Converter::convertInputMessage( const Port &port, const Message &message, K newClass.addMemberVariable( transport ); // call - QString messageName = message.name(); + TQString messageName = message.name(); messageName[ 0 ] = messageName[ 0 ].lower(); KODE::Function callFunc( mNameMapper.escape( messageName ), "void", KODE::Function::Public ); @@ -722,30 +722,30 @@ void Converter::convertInputMessage( const Port &port, const Message &message, K Message::Part::List::ConstIterator it; for ( it = parts.begin(); it != parts.end(); ++it ) { newClass.addHeaderIncludes( mTypeMapper.header( (*it).type() ) ); - QString lowerName = (*it).name(); + TQString lowerName = (*it).name(); lowerName[ 0 ] = lowerName[ 0 ].lower(); callFunc.addArgument( mTypeMapper.argument( mNameMapper.escape( lowerName ), (*it).type() ) ); } KODE::Code code; - code += "QDomDocument doc( \"kwsdl\" );"; + code += "TQDomDocument doc( \"kwsdl\" );"; code += "doc.appendChild( doc.createProcessingInstruction( \"xml\", \"version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\" ) );"; - code += "QDomElement env = doc.createElement( \"SOAP-ENV:Envelope\" );"; + code += "TQDomElement env = doc.createElement( \"SOAP-ENV:Envelope\" );"; code += "env.setAttribute( \"xmlns:SOAP-ENV\", \"http://schemas.xmlsoap.org/soap/envelope/\" );"; code += "env.setAttribute( \"xmlns:xsi\", \"http://www.w3.org/1999/XMLSchema-instance\" );"; code += "env.setAttribute( \"xmlns:xsd\", \"http://www.w3.org/1999/XMLSchema\" );"; code += "doc.appendChild( env );"; - code += "QDomElement body = doc.createElement( \"SOAP-ENV:Body\" );"; + code += "TQDomElement body = doc.createElement( \"SOAP-ENV:Body\" );"; code += "env.appendChild( body );"; - code += "QDomElement method = doc.createElement( \"ns1:" + message.name() + "\" );"; - QString nameSpace = mWSDL.findBindingOperation( port.name(), message.name() ).input().nameSpace(); + code += "TQDomElement method = doc.createElement( \"ns1:" + message.name() + "\" );"; + TQString nameSpace = mWSDL.findBindingOperation( port.name(), message.name() ).input().nameSpace(); code += "method.setAttribute( \"xmlns:ns1\", \"" + nameSpace + "\" );"; code += "method.setAttribute( \"SOAP-ENV:encodingStyle\", \"http://schemas.xmlsoap.org/soap/encoding/\" );"; code += "body.appendChild( method );"; code.newLine(); for ( it = parts.begin(); it != parts.end(); ++it ) { - QString lowerName = (*it).name(); + TQString lowerName = (*it).name(); lowerName[ 0 ] = lowerName[ 0 ].lower(); code += "Serializer::marshal( doc, method, \"" + (*it).name() + "\", " + mNameMapper.escape( lowerName ) + " );"; code += "delete " + mNameMapper.escape( lowerName ) + ";"; @@ -763,7 +763,7 @@ void Converter::convertOutputMessage( const Port&, const Message &message, KODE: Message::Part part = message.parts().first(); // signal - QString messageName = message.name(); + TQString messageName = message.name(); messageName[ 0 ] = messageName[ 0 ].lower(); KODE::Function respSignal( messageName, "void", KODE::Function::Signal ); @@ -777,7 +777,7 @@ void Converter::convertOutputMessage( const Port&, const Message &message, KODE: const Message::Part::List parts = message.parts(); Message::Part::List::ConstIterator it; for ( it = parts.begin(); it != parts.end(); ++it ) { - QStringList headers = mTypeMapper.header( (*it).type() ); + TQStringList headers = mTypeMapper.header( (*it).type() ); for ( uint i = 0; i < headers.count(); ++i ) if ( !headers[ i ].isEmpty() ) newClass.addHeaderInclude( headers[ i ] ); @@ -789,11 +789,11 @@ void Converter::convertOutputMessage( const Port&, const Message &message, KODE: // slot KODE::Function respSlot( messageName + "Slot", "void", KODE::Function::Slot | KODE::Function::Private ); - respSlot.addArgument( "const QString &xml" ); + respSlot.addArgument( "const TQString &xml" ); KODE::Code code; - code += "QDomDocument doc;"; - code += "QString errorMsg;"; + code += "TQDomDocument doc;"; + code += "TQString errorMsg;"; code += "int column, row;"; code.newLine(); code += "qDebug( \"%s\", xml.latin1() );"; @@ -806,9 +806,9 @@ void Converter::convertOutputMessage( const Port&, const Message &message, KODE: code += "}"; code.newLine(); code += mTypeMapper.type( part.type() ) + "* value = new " + mTypeMapper.type( part.type() ) + ";"; - code += "QDomElement envelope = doc.documentElement();"; - code += "QDomElement body = envelope.firstChild().toElement();"; - code += "QDomElement method = body.firstChild().toElement();"; + code += "TQDomElement envelope = doc.documentElement();"; + code += "TQDomElement body = envelope.firstChild().toElement();"; + code += "TQDomElement method = body.firstChild().toElement();"; code += "Serializer::demarshal( method.firstChild().toElement(), value );"; code.newLine(); code += "emit " + respSignal.name() + "( value );"; @@ -820,18 +820,18 @@ void Converter::convertOutputMessage( const Port&, const Message &message, KODE: void Converter::createUtilClasses() { mSerializer = KODE::Class( "Serializer" ); - mSerializer.addHeaderInclude( "qcstring.h" ); - mSerializer.addHeaderInclude( "qdom.h" ); - mSerializer.addHeaderInclude( "qdatetime.h" ); - mSerializer.addHeaderInclude( "qstring.h" ); - mSerializer.addHeaderInclude( "qptrlist.h" ); + mSerializer.addHeaderInclude( "tqcstring.h" ); + mSerializer.addHeaderInclude( "tqdom.h" ); + mSerializer.addHeaderInclude( "tqdatetime.h" ); + mSerializer.addHeaderInclude( "tqstring.h" ); + mSerializer.addHeaderInclude( "tqptrlist.h" ); mSerializer.addInclude( "kmdcodec.h" ); typedef struct { - QString type; - QString xsdType; - QString marshalCode; - QString demarshalCode; + TQString type; + TQString xsdType; + TQString marshalCode; + TQString demarshalCode; } TypeEntry; /** @@ -839,18 +839,18 @@ void Converter::createUtilClasses() of typing and is easier to maintain at the end ;) */ TypeEntry types[] = { - { "QString", "xsd:string", "*value", "str" }, + { "TQString", "xsd:string", "*value", "str" }, { "bool", "xsd:boolean", "(*value ? \"true\" : \"false\")", "(str.lower() == \"true\" ? true : false)" }, - { "float", "xsd:TODO", "QString::number( *value )", "str.toFloat()" }, - { "int", "xsd:int", "QString::number( *value )", "str.toInt()" }, - { "unsigned int", "xsd:unsignedByte", "QString::number( *value )", "str.toUInt()" }, - { "double", "xsd:double", "QString::number( *value )", "str.toDouble()" }, - { "char", "xsd:byte", "QString( QChar( *value ) )", "str[ 0 ].latin1()" }, - { "unsigned char", "xsd:unsignedByte", "QString( QChar( *value ) )", "str[ 0 ].latin1()" }, - { "short", "xsd:short", "QString::number( *value )", "str.toShort()" }, - { "QByteArray", "xsd:base64Binary", "QString::fromUtf8( KCodecs::base64Encode( *value ) )", "KCodecs::base64Decode( str.utf8() )" }, - { "QDateTime", "xsd:dateTime", "value->toString( Qt::ISODate )", "QDateTime::fromString( str, Qt::ISODate )" }, - { "QDate", "xsd:date", "value->toString( Qt::ISODate )", "QDate::fromString( str, Qt::ISODate )" } + { "float", "xsd:TODO", "TQString::number( *value )", "str.toFloat()" }, + { "int", "xsd:int", "TQString::number( *value )", "str.toInt()" }, + { "unsigned int", "xsd:unsignedByte", "TQString::number( *value )", "str.toUInt()" }, + { "double", "xsd:double", "TQString::number( *value )", "str.toDouble()" }, + { "char", "xsd:byte", "TQString( TQChar( *value ) )", "str[ 0 ].latin1()" }, + { "unsigned char", "xsd:unsignedByte", "TQString( TQChar( *value ) )", "str[ 0 ].latin1()" }, + { "short", "xsd:short", "TQString::number( *value )", "str.toShort()" }, + { "TQByteArray", "xsd:base64Binary", "TQString::fromUtf8( KCodecs::base64Encode( *value ) )", "KCodecs::base64Decode( str.utf8() )" }, + { "TQDateTime", "xsd:dateTime", "value->toString( Qt::ISODate )", "TQDateTime::fromString( str, Qt::ISODate )" }, + { "TQDate", "xsd:date", "value->toString( Qt::ISODate )", "TQDate::fromString( str, Qt::ISODate )" } }; for ( uint i = 0; i < sizeof( types ) / sizeof( TypeEntry ); ++i ) { @@ -859,7 +859,7 @@ void Converter::createUtilClasses() TypeEntry entry = types[ i ]; - marshal = KODE::Function( "marshalValue", "QString" ); + marshal = KODE::Function( "marshalValue", "TQString" ); marshal.setStatic( true ); marshal.addArgument( "const " + entry.type + "* value" ); @@ -870,7 +870,7 @@ void Converter::createUtilClasses() demarshal = KODE::Function( "demarshalValue", "void" ); demarshal.setStatic( true ); - demarshal.addArgument( "const QString &str" ); + demarshal.addArgument( "const TQString &str" ); demarshal.addArgument( entry.type + " *value" ); demarshal.setBody( "*value = " + entry.demarshalCode + ";" ); @@ -878,13 +878,13 @@ void Converter::createUtilClasses() marshal = KODE::Function( "marshal", "void" ); marshal.setStatic( true ); - marshal.addArgument( "QDomDocument &doc" ); - marshal.addArgument( "QDomElement &parent" ); - marshal.addArgument( "const QString &name" ); + marshal.addArgument( "TQDomDocument &doc" ); + marshal.addArgument( "TQDomElement &parent" ); + marshal.addArgument( "const TQString &name" ); marshal.addArgument( "const " + entry.type + "* value" ); code.clear(); - code += "QDomElement element = doc.createElement( name );"; + code += "TQDomElement element = doc.createElement( name );"; code += "element.setAttribute( \"xsi:type\", \"" + entry.xsdType + "\" );"; code += "element.appendChild( doc.createTextNode( Serializer::marshalValue( value ) ) );"; code += "parent.appendChild( element );"; @@ -894,7 +894,7 @@ void Converter::createUtilClasses() demarshal = KODE::Function( "demarshal", "void" ); demarshal.setStatic( true ); - demarshal.addArgument( "const QDomElement &element" ); + demarshal.addArgument( "const TQDomElement &element" ); demarshal.addArgument( entry.type + "* value" ); demarshal.setBody( "Serializer::demarshalValue( element.text(), value );" ); @@ -906,33 +906,33 @@ void Converter::createTransportClass() { KODE::Class transport( "Transport" ); transport.addBaseClass( mQObject ); - transport.addHeaderInclude( "qobject.h" ); + transport.addHeaderInclude( "tqobject.h" ); transport.addHeaderInclude( "kio/job.h" ); transport.addInclude( "kdebug.h" ); - KODE::MemberVariable url( "url", "QString" ); + KODE::MemberVariable url( "url", "TQString" ); transport.addMemberVariable( url ); - KODE::MemberVariable slotDataVar( "data", "QByteArray" ); + KODE::MemberVariable slotDataVar( "data", "TQByteArray" ); transport.addMemberVariable( slotDataVar ); // ctor KODE::Function ctor( "Transport" ); - ctor.addArgument( "const QString &url" ); + ctor.addArgument( "const TQString &url" ); ctor.setBody( url.name() + " = url;" ); transport.addFunction( ctor ); // query KODE::Function query( "query", "void" ); - query.addArgument( "const QString &xml" ); + query.addArgument( "const TQString &xml" ); KODE::Code queryCode; queryCode += slotDataVar.name() + ".truncate( 0 );"; queryCode.newLine(); - queryCode += "QByteArray postData;"; - queryCode += "QDataStream stream( postData, IO_WriteOnly );"; + queryCode += "TQByteArray postData;"; + queryCode += "TQDataStream stream( postData, IO_WriteOnly );"; queryCode += "stream.writeRawBytes( xml.utf8(), xml.utf8().length() );"; queryCode.newLine(); queryCode += "KIO::TransferJob* job = KIO::http_post( KURL( " + url.name() + " ), postData, false );"; @@ -946,8 +946,8 @@ void Converter::createTransportClass() queryCode += "job->addMetaData( \"UserAgent\", \"KWSDL\" );"; queryCode += "job->addMetaData( \"content-type\", \"Content-Type: text/xml; charset=utf-8\" );"; queryCode.newLine(); - queryCode += "connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), this, SLOT( slotData( KIO::Job*, const QByteArray& ) ) );"; - queryCode += "connect( job, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotResult( KIO::Job* ) ) );"; + queryCode += "connect( job, TQT_SIGNAL( data( KIO::Job*, const TQByteArray& ) ), this, TQT_SLOT( slotData( KIO::Job*, const TQByteArray& ) ) );"; + queryCode += "connect( job, TQT_SIGNAL( result( KIO::Job* ) ), this, TQT_SLOT( slotResult( KIO::Job* ) ) );"; query.setBody( queryCode ); @@ -955,7 +955,7 @@ void Converter::createTransportClass() // signal KODE::Function result( "result", "void", KODE::Function::Signal ); - result.addArgument( "const QString &xml" ); + result.addArgument( "const TQString &xml" ); transport.addFunction( result ); @@ -963,7 +963,7 @@ void Converter::createTransportClass() KODE::Function slotData( "slotData", "void", KODE::Function::Private | KODE::Function::Slot ); slotData.addArgument( "KIO::Job*" ); - slotData.addArgument( "const QByteArray &data" ); + slotData.addArgument( "const TQByteArray &data" ); KODE::Code slotDataCode; slotDataCode += "unsigned int oldSize = " + slotDataVar.name() + ".size();"; @@ -988,7 +988,7 @@ void Converter::createTransportClass() slotResultCode += "}"; slotResultCode.newLine(); - slotResultCode += "emit result( QString::fromUtf8( " + slotDataVar.name() + ".data(), " + slotDataVar.name() + ".size() ) );"; + slotResultCode += "emit result( TQString::fromUtf8( " + slotDataVar.name() + ".data(), " + slotDataVar.name() + ".size() ) );"; slotResult.setBody( slotResultCode ); |