void Converter::convertService( const Service &service ) { KODE::Class newClass( service.name() ); newClass.addBaseClass( mQObject ); newClass.addHeaderInclude( "qobject.h" ); newClass.addHeaderInclude( "qstring.h" ); newClass.addHeaderInclude( "transport.h" ); newClass.addInclude( "serializer.h" ); KODE::Function ctor( service.name() ); KODE::Function dtor( "~" + service.name() ); KODE::Code ctorCode, dtorCode; const Service::Port::List servicePorts = service.ports(); Service::Port::List::ConstIterator it; for ( it = servicePorts.begin(); it != servicePorts.end(); ++it ) { Binding binding = mWSDL.findBinding( (*it).mBinding ); Port port = mWSDL.findPort( binding.type() ); const Port::Operation::List operations = port.operations(); Port::Operation::List::ConstIterator opIt; for ( opIt = operations.begin(); opIt != operations.end(); ++opIt ) { Message inputMessage = mWSDL.findMessage( (*opIt).input() ); Message outputMessage = mWSDL.findMessage( (*opIt).output() ); convertInputMessage( port, inputMessage, newClass ); convertOutputMessage( port, outputMessage, newClass ); KODE::MemberVariable transport( inputMessage.name() + "Transport", "Transport" ); ctorCode += transport.name() + " = new Transport( \"" + (*it).mLocation + "\" );"; ctorCode += "connect( " + transport.name() + ", SIGNAL( result( const QString& ) ),"; ctorCode.indent(); ctorCode += "this, SLOT( " + outputMessage.name() + "Slot( const QString& ) ) );"; ctorCode.unindent(); dtorCode += "delete " + transport.name() + ";"; dtorCode += transport.name() + " = 0;"; } } ctor.setBody( ctorCode ); newClass.addFunction( ctor ); dtor.setBody( dtorCode ); newClass.addFunction( dtor ); mClasses.append( newClass ); }
Message WSDL::findOutputMessage(const QString &name) const { Port::List::ConstIterator it; for(it = mPorts.begin(); it != mPorts.end(); ++it) { Port::Operation::List operations = (*it).operations(); Port::Operation::List::ConstIterator opIt; for(opIt = operations.begin(); opIt != operations.end(); ++opIt) { if((*opIt).input() == name) return findMessage((*opIt).output()); } } return Message(); }