summaryrefslogtreecommitdiffstats
path: root/kode/kwsdl/converter.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-13 00:46:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-13 00:46:47 +0000
commit67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7 (patch)
tree5f52a9eada2e9f3654fc327d7c14dfef570a6ecb /kode/kwsdl/converter.cpp
parent2ee4bf4fd5eff93b2fbef0ff8e8063edffc5da5c (diff)
downloadtdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.tar.gz
tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.zip
Initial conversion of kdepim to TQt
This will probably require some tweaking before it will build under Qt4, however Qt3 builds are OK. Any alterations this commit makes to kdepim behaviour under Qt3 are unintentional and should be fixed. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1227832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kode/kwsdl/converter.cpp')
-rw-r--r--kode/kwsdl/converter.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/kode/kwsdl/converter.cpp b/kode/kwsdl/converter.cpp
index 3f97efe1d..173ca7fb3 100644
--- a/kode/kwsdl/converter.cpp
+++ b/kode/kwsdl/converter.cpp
@@ -37,7 +37,7 @@ static TQString escapeEnum( const TQString &str )
Converter::Converter()
{
- mQObject = KODE::Class( "TQObject" );
+ mTQObject = KODE::Class( TQOBJECT_OBJECT_NAME_STRING );
}
void Converter::setWSDL( const WSDL &wsdl )
@@ -218,13 +218,13 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type )
KODE::Function marshal( "marshal", "void" );
marshal.setStatic( true );
marshal.addArgument( "TQDomDocument &doc" );
- marshal.addArgument( "TQDomElement &parent" );
+ marshal.addArgument( "TQDomElement &tqparent" );
marshal.addArgument( "const TQString &name" );
marshal.addArgument( "const " + typeName + "* value" );
KODE::Function demarshal( "demarshal", "void" );
demarshal.setStatic( true );
- demarshal.addArgument( "const TQDomElement &parent" );
+ demarshal.addArgument( "const TQDomElement &tqparent" );
demarshal.addArgument( typeName + "* value" );
KODE::Code marshalCode, demarshalCode, code;
@@ -249,7 +249,7 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type )
escapedEnums.append( escapeEnum( enums[ i ] ) );
// marshal value
- KODE::Function marshalValue( "marshalValue", "TQString" );
+ KODE::Function marshalValue( "marshalValue", TQSTRING_OBJECT_NAME_STRING );
marshalValue.setStatic( true );
marshalValue.addArgument( "const " + typeName + "* value" );
code += "switch ( value->type() ) {";
@@ -275,7 +275,7 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type )
// marshal
marshalCode += "TQDomElement root = doc.createElement( name );";
marshalCode += "root.setAttribute( \"xsi:type\", \"ns1:" + type->name() + "\" );";
- marshalCode += "parent.appendChild( root );";
+ marshalCode += "tqparent.appendChild( root );";
marshalCode += "root.appendChild( doc.createTextNode( Serializer::marshalValue( value ) ) );";
// demarshal value
@@ -294,28 +294,28 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type )
demarshalValue.setBody( code );
// demarshal
- demarshalCode += "Serializer::demarshalValue( parent.text(), value );";
+ demarshalCode += "Serializer::demarshalValue( tqparent.text(), value );";
mSerializer.addFunction( marshalValue );
mSerializer.addFunction( demarshalValue );
} else if ( type->baseType() != Schema::XSDType::INVALID ) {
marshalCode += "if ( value->value() ) {";
marshalCode.indent();
- marshalCode += "Serializer::marshal( doc, parent, name, value->value() );";
+ marshalCode += "Serializer::marshal( doc, tqparent, name, value->value() );";
marshalCode.unindent();
marshalCode += "}";
- demarshalCode += "const TQString text = parent.text();";
+ demarshalCode += "const TQString text = tqparent.text();";
demarshalCode.newLine();
demarshalCode += "if ( !text.isEmpty() ) {";
demarshalCode.indent();
demarshalCode += baseType + "* data = new " + baseType + ";";
- demarshalCode += "Serializer::demarshal( parent, value );";
+ demarshalCode += "Serializer::demarshal( tqparent, value );";
demarshalCode += "value->setValue( data );";
demarshalCode.unindent();
demarshalCode += "}";
- KODE::Function marshalValue( "marshalValue", "TQString" );
+ KODE::Function marshalValue( "marshalValue", TQSTRING_OBJECT_NAME_STRING );
marshalValue.setStatic( true );
marshalValue.addArgument( "const " + typeName + "* value" );
marshalValue.setBody( "return Serializer::marshalValue( value->value() );" );
@@ -352,12 +352,12 @@ void Converter::createSimpleTypeSerializer( const Schema::SimpleType *type )
marshalCode += "}";
marshalCode.newLine();
marshalCode += "TQDomElement element = doc.createElement( name );";
- marshalCode += "parent.appendChild( element );";
+ marshalCode += "tqparent.appendChild( element );";
marshalCode += "element.appendChild( doc.createTextNode( list.join( \" \" ) ) );";
marshalCode.unindent();
marshalCode += "}";
- demarshalCode += "const TQStringList list = TQStringList::split( \" \", parent.text(), false );";
+ demarshalCode += "const TQStringList list = TQStringList::split( \" \", tqparent.text(), false );";
demarshalCode += "if ( !list.isEmpty() ) {";
demarshalCode.indent();
demarshalCode += "TQPtrList<" + listType + ">* entries = new TQPtrList<" + listType + ">;";
@@ -511,13 +511,13 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type )
KODE::Function marshal( "marshal", "void" );
marshal.setStatic( true );
marshal.addArgument( "TQDomDocument &doc" );
- marshal.addArgument( "TQDomElement &parent" );
+ marshal.addArgument( "TQDomElement &tqparent" );
marshal.addArgument( "const TQString &name" );
marshal.addArgument( "const " + typeName + "* value" );
KODE::Function demarshal( "demarshal", "void" );
demarshal.setStatic( true );
- demarshal.addArgument( "const TQDomElement &parent" );
+ demarshal.addArgument( "const TQDomElement &tqparent" );
demarshal.addArgument( typeName + "* value" );
KODE::Code marshalCode, demarshalCode, demarshalFinalCode;
@@ -535,9 +535,9 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type )
marshalCode += "TQDomElement root = doc.createElement( name );";
marshalCode += "root.setAttribute( \"xsi:type\", \"ns1:" + typeName + "\" );";
- marshalCode += "parent.appendChild( root );";
+ marshalCode += "tqparent.appendChild( root );";
- demarshalCode += "TQDomNode node = parent.firstChild();";
+ demarshalCode += "TQDomNode node = tqparent.firstChild();";
demarshalCode += "while ( !node.isNull() ) {";
demarshalCode.indent();
demarshalCode += "TQDomElement element = node.toElement();";
@@ -568,7 +568,7 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type )
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 + "[\" + TQString::number( list->count() ) + \"]\" );";
- marshalCode += "parent.appendChild( element );";
+ marshalCode += "tqparent.appendChild( element );";
marshalCode.newLine();
marshalCode += "TQPtrListIterator<" + typeName + "> it( *list );";
marshalCode += "while ( it.current() != 0 ) {";
@@ -629,7 +629,7 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type )
marshalCode += "if ( value->" + mNameMapper.escape( lowerName ) + "() )";
marshalCode.indent();
- marshalCode += "parent.setAttribute( \"" + (*attrIt).name() + "\","
+ marshalCode += "tqparent.setAttribute( \"" + (*attrIt).name() + "\","
"Serializer::marshalValue( value->" + mNameMapper.escape( lowerName ) + "() ) );";
marshalCode.newLine();
@@ -660,7 +660,7 @@ void Converter::createComplexTypeSerializer( const Schema::ComplexType *type )
void Converter::convertService( const Service &service )
{
KODE::Class newClass( service.name() );
- newClass.addBaseClass( mQObject );
+ newClass.addBaseClass( mTQObject );
newClass.addHeaderInclude( "tqobject.h" );
newClass.addHeaderInclude( "tqstring.h" );
newClass.addHeaderInclude( "transport.h" );
@@ -839,7 +839,7 @@ void Converter::createUtilClasses()
of typing and is easier to maintain at the end ;)
*/
TypeEntry types[] = {
- { "TQString", "xsd:string", "*value", "str" },
+ { TQSTRING_OBJECT_NAME_STRING, "xsd:string", "*value", "str" },
{ "bool", "xsd:boolean", "(*value ? \"true\" : \"false\")", "(str.lower() == \"true\" ? true : false)" },
{ "float", "xsd:TODO", "TQString::number( *value )", "str.toFloat()" },
{ "int", "xsd:int", "TQString::number( *value )", "str.toInt()" },
@@ -848,9 +848,9 @@ void Converter::createUtilClasses()
{ "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 )" }
+ { TQBYTEARRAY_OBJECT_NAME_STRING, "xsd:base64Binary", "TQString::fromUtf8( KCodecs::base64Encode( *value ) )", "KCodecs::base64Decode( str.utf8() )" },
+ { "TQDateTime", "xsd:dateTime", "value->toString( TQt::ISODate )", "TQDateTime::fromString( str, TQt::ISODate )" },
+ { "TQDate", "xsd:date", "value->toString( TQt::ISODate )", "TQDate::fromString( str, TQt::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", "TQString" );
+ marshal = KODE::Function( "marshalValue", TQSTRING_OBJECT_NAME_STRING );
marshal.setStatic( true );
marshal.addArgument( "const " + entry.type + "* value" );
@@ -879,7 +879,7 @@ void Converter::createUtilClasses()
marshal = KODE::Function( "marshal", "void" );
marshal.setStatic( true );
marshal.addArgument( "TQDomDocument &doc" );
- marshal.addArgument( "TQDomElement &parent" );
+ marshal.addArgument( "TQDomElement &tqparent" );
marshal.addArgument( "const TQString &name" );
marshal.addArgument( "const " + entry.type + "* value" );
@@ -887,7 +887,7 @@ void Converter::createUtilClasses()
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 );";
+ code += "tqparent.appendChild( element );";
marshal.setBody( code );
mSerializer.addFunction( marshal );
@@ -905,16 +905,16 @@ void Converter::createUtilClasses()
void Converter::createTransportClass()
{
KODE::Class transport( "Transport" );
- transport.addBaseClass( mQObject );
+ transport.addBaseClass( mTQObject );
transport.addHeaderInclude( "tqobject.h" );
transport.addHeaderInclude( "kio/job.h" );
transport.addInclude( "kdebug.h" );
- KODE::MemberVariable url( "url", "TQString" );
+ KODE::MemberVariable url( "url", TQSTRING_OBJECT_NAME_STRING );
transport.addMemberVariable( url );
- KODE::MemberVariable slotDataVar( "data", "TQByteArray" );
+ KODE::MemberVariable slotDataVar( "data", TQBYTEARRAY_OBJECT_NAME_STRING );
transport.addMemberVariable( slotDataVar );
// ctor