本文整理汇总了C++中kode::Code::addLine方法的典型用法代码示例。如果您正苦于以下问题:C++ Code::addLine方法的具体用法?C++ Code::addLine怎么用?C++ Code::addLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kode::Code
的用法示例。
在下文中一共展示了Code::addLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertServerService
void Converter::convertServerService()
{
Q_FOREACH (const Service &service, mWSDL.definitions().services()) {
Q_ASSERT(!service.name().isEmpty());
QSet<QName> uniqueBindings = mWSDL.uniqueBindings(service);
Q_FOREACH (const QName &bindingName, uniqueBindings) {
//qDebug() << "binding" << bindingName;
const Binding binding = mWSDL.findBinding(bindingName);
QString className = KODE::Style::className(service.name());
QString nameSpace;
if (uniqueBindings.count() > 1) {
// Multiple bindings: use Service::Binding as classname.
nameSpace = className;
className = KODE::Style::className(bindingName.localName());
}
className += "ServerBase";
KODE::Class serverClass(className, nameSpace);
serverClass.addBaseClass(mQObject);
serverClass.addBaseClass(mKDSoapServerObjectInterface);
if (!Settings::self()->exportDeclaration().isEmpty()) {
serverClass.setExportDeclaration(Settings::self()->exportDeclaration());
}
serverClass.setNameSpace(Settings::self()->nameSpace());
// Files included in the header
serverClass.addHeaderInclude("QtCore/QObject");
serverClass.addHeaderInclude("KDSoapServer/KDSoapServerObjectInterface.h");
serverClass.addDeclarationMacro("Q_OBJECT");
serverClass.addDeclarationMacro("Q_INTERFACES(KDSoapServerObjectInterface)");
KODE::Function processRequestMethod(QString::fromLatin1("processRequest"), QString::fromLatin1("void"));
processRequestMethod.addArgument("const KDSoapMessage &_request");
processRequestMethod.addArgument("KDSoapMessage &_response");
processRequestMethod.addArgument("const QByteArray& _soapAction");
KODE::Code body;
const QString responseNs = mWSDL.definitions().targetNamespace();
body.addLine("setResponseNamespace(QLatin1String(\"" + responseNs + "\"));" + COMMENT);
body.addLine("const QByteArray method = _request.name().toLatin1();");
PortType portType = mWSDL.findPortType(binding.portTypeName());
//qDebug() << portType.name();
bool first = true;
const Operation::List operations = portType.operations();
Q_FOREACH (const Operation &operation, operations) {
const Operation::OperationType opType = operation.operationType();
switch (opType) {
case Operation::OneWayOperation:
case Operation::RequestResponseOperation: // the standard case
case Operation::SolicitResponseOperation:
case Operation::NotificationOperation:
generateServerMethod(body, binding, operation, serverClass, first);
break;
}
first = false;
}
if (!first) {
body += "else {";
body.indent();
}
body += "KDSoapServerObjectInterface::processRequest(_request, _response, _soapAction);" + COMMENT;
if (!first) {
body.unindent();
body += "}";
}
processRequestMethod.setBody(body);
serverClass.addFunction(processRequestMethod);
mClasses.addClass(serverClass);
}
}
}