FunctionType FunctionType::substitute(const TemplateVarMap& templateVarMap, const Predicate& selfconst) const { if (templateVarMap.empty() && selfconst.isSelfConst()) { return *this; } const auto substitutedReturnType = returnType()->substitute(templateVarMap, selfconst); bool changed = (substitutedReturnType != returnType()); TypeArray substitutedParameterTypes; for (const auto parameterType: parameterTypes()) { const auto substitutedParameterType = parameterType->substitute(templateVarMap, selfconst); changed |= (substitutedParameterType != parameterType); substitutedParameterTypes.push_back(substitutedParameterType); } auto noExceptPredicate = attributes().noExceptPredicate().substitute(templateVarMap, selfconst); changed |= (noExceptPredicate != attributes().noExceptPredicate()); if (changed) { FunctionAttributes newAttributes(attributes().isVarArg(), attributes().isMethod(), attributes().isTemplated(), std::move(noExceptPredicate)); return FunctionType(std::move(newAttributes), substitutedReturnType, std::move(substitutedParameterTypes)); } else { return *this; } }
std::size_t FunctionTypeData::hash() const { Hasher hasher; hasher.add(attributes()); hasher.add(returnType()); hasher.add(parameterTypes()); return hasher.get(); }
JSValue QtInstance::stringValue(ExecState* exec) const { QObject* obj = getObject(); if (!obj) return jsNull(); // Hmm.. see if there is a toString defined QByteArray buf; bool useDefault = true; getClass(); if (m_class) { // Cheat and don't use the full name resolution int index = obj->metaObject()->indexOfMethod("toString()"); if (index >= 0) { QMetaMethod m = obj->metaObject()->method(index); // Check to see how much we can call it if (m.access() != QMetaMethod::Private && m.methodType() != QMetaMethod::Signal #if HAVE(QT5) && m.parameterCount() == 0 && m.returnType() != QMetaType::Void) { QVariant ret(m.returnType(), (void*)0); void * qargs[1]; qargs[0] = ret.data(); if (QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, qargs) < 0) { if (ret.isValid() && ret.canConvert(QVariant::String)) { buf = ret.toString().toLatin1().constData(); // ### Latin 1? Ascii? useDefault = false; #else && m.parameterTypes().isEmpty()) { const char* retsig = m.typeName(); if (retsig && *retsig) { QVariant ret(QMetaType::type(retsig), (void*)0); void * qargs[1]; qargs[0] = ret.data(); if (QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, qargs) < 0) { if (ret.isValid() && ret.canConvert(QVariant::String)) { buf = ret.toString().toLatin1().constData(); // ### Latin 1? Ascii? useDefault = false; } #endif } } } } } if (useDefault) { const QMetaObject* meta = obj ? obj->metaObject() : &QObject::staticMetaObject; QString name = obj ? obj->objectName() : QString::fromUtf8("unnamed"); QString str = QString::fromUtf8("%0(name = \"%1\")") .arg(QLatin1String(meta->className())).arg(name); buf = str.toLatin1(); } return jsString(exec, buf.constData()); }
bool MethodSetElement::operator==(const MethodSetElement& methodSetElement) const { return templateVariables() == methodSetElement.templateVariables() && constPredicate() == methodSetElement.constPredicate() && noexceptPredicate() == methodSetElement.noexceptPredicate() && requirePredicate() == methodSetElement.requirePredicate() && returnType() == methodSetElement.returnType() && parameterTypes() == methodSetElement.parameterTypes() && isStatic() == methodSetElement.isStatic(); }
std::string FunctionTypeData::nameToString() const { return makeString("FunctionType(" "attributes: %s, " "returnType: %s, " "parameterTypes: %s)", attributes().toString().c_str(), returnType()->nameToString().c_str(), makeNameArrayString(parameterTypes()).c_str()); }
void ClientImpl::subscribeToTopologyNotifications(){ std::vector<voltdb::Parameter> parameterTypes(1); parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); //parameterTypes[1] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); voltdb::Procedure statisticsProc("@Subscribe", parameterTypes); voltdb::ParameterSet* params = statisticsProc.params(); params->addString("TOPOLOGY"); boost::shared_ptr<SubscribeCallback> topoCallback(new SubscribeCallback(&m_distributer)); invoke(statisticsProc, topoCallback); }
FunctionType FunctionType::makeTemplated() const { if (attributes().isTemplated()) { return *this; } const bool newIsTemplated = true; FunctionAttributes newAttributes(attributes().isVarArg(), attributes().isMethod(), newIsTemplated, attributes().noExceptPredicate().copy()); return FunctionType(std::move(newAttributes), returnType(), parameterTypes().copy()); }
AST::Value CallValue(Context& context, AST::Value rawValue, HeapArray<AST::Value> args, const Debug::SourceLocation& location) { auto value = derefValue(std::move(rawValue)); if (getDerefType(value.type())->isTypename()) { return CallValue(context, GetStaticMethod(context, std::move(value), context.getCString("create"), location), std::move(args), location); } if (!value.type()->isCallable()) { // Try to use 'call' method. if (TypeCapabilities(context).hasCallMethod(getDerefType(value.type()))) { return CallValue(context, GetMethod(context, std::move(value), context.getCString("call"), location), std::move(args), location); } else { context.issueDiag(TypeNotCallableDiag(getDerefType(value.type())), location); return AST::Value::Constant(Constant::Integer(0), context.typeBuilder().getIntType()); } } const auto functionType = value.type()->asFunctionType(); const auto& typeList = functionType.parameterTypes(); if (functionType.attributes().isVarArg()) { if (args.size() < typeList.size()) { context.issueDiag(VarArgTooFewArgsDiag(value.toDiagString(), args.size(), typeList.size()), location); } } else { if (args.size() != typeList.size()) { context.issueDiag(CallIncorrectArgCountDiag(value.toDiagString(), args.size(), typeList.size()), location); } } if (!TypeCapabilities(context).isSized(functionType.returnType())) { // TODO: also check that the type is not abstract. context.issueDiag(CallReturnTypeIsUnsizedDiag(functionType.returnType()), location); } if (functionType.returnType()->hasConst()) { context.issueDiag(CallReturnTypeIsConstDiag(functionType.returnType()), location); } return addDebugInfo(AST::Value::Call(std::move(value), CastFunctionArguments(context, std::move(args), typeList, location), functionType.returnType()->stripConst()), location); }
std::size_t MethodSetElement::hash() const { std::size_t seed = 0; boost::hash_combine(seed, templateVariables().hash()); boost::hash_combine(seed, constPredicate().hash()); boost::hash_combine(seed, noexceptPredicate().hash()); boost::hash_combine(seed, requirePredicate().hash()); boost::hash_combine(seed, isStatic()); boost::hash_combine(seed, returnType()); for (const auto& parameterType: parameterTypes()) { boost::hash_combine(seed, parameterType); } return seed; }
bool FunctionType::dependsOnOnly(const TemplateVarArray& array) const { if (!returnType()->dependsOnOnly(array)) { return false; } if (!attributes().noExceptPredicate().dependsOnOnly(array)) { return false; } for (const auto& paramType: parameterTypes()) { if (!paramType->dependsOnOnly(array)) { return false; } } return true; }
const AST::MethodSet* getMethodSetForObjectType(Context& context, const AST::Type* const objectType) { assert(objectType->isObject()); AST::MethodSet::ElementSet elements; const auto typeInstance = objectType->getObjectType(); const auto templateVarMap = objectType->generateTemplateVarMap(); for (const auto& function: typeInstance->functions()) { auto constPredicate = function->constPredicate().substitute(templateVarMap, /*selfconst=*/AST::Predicate::SelfConst()); auto noexceptPredicate = function->type().attributes().noExceptPredicate().substitute(templateVarMap, /*selfconst=*/AST::Predicate::SelfConst()); auto requirePredicate = function->requiresPredicate().substitute(templateVarMap, /*selfconst=*/AST::Predicate::SelfConst()); const auto functionType = function->type().substitute(templateVarMap, /*selfconst=*/AST::Predicate::SelfConst()); const bool isStatic = function->isStaticMethod(); AST::MethodSetElement functionElement( function->templateVariables().copy(), std::move(constPredicate), std::move(noexceptPredicate), std::move(requirePredicate), isStatic, functionType.returnType(), functionType.parameterTypes().copy()); elements.push_back(std::make_pair(function->canonicalName(), std::move(functionElement))); } // Sort the elements. std::sort(elements.begin(), elements.end(), comparePairKeys<AST::MethodSet::Element>); auto constObjectPredicate = objectType->constPredicate().substitute(templateVarMap, /*selfconst=*/AST::Predicate::SelfConst()); return AST::MethodSet::get(context.astContext(), std::move(constObjectPredicate), std::move(elements)); }
void ClientImpl::updateHashinator(){ m_distributer.startUpdate(); std::vector<voltdb::Parameter> parameterTypes(1); parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); voltdb::Procedure systemCatalogProc("@SystemCatalog", parameterTypes); voltdb::ParameterSet* params = systemCatalogProc.params(); params->addString("PROCEDURES"); boost::shared_ptr<ProcUpdateCallback> procCallback(new ProcUpdateCallback(&m_distributer)); invoke(systemCatalogProc, procCallback); parameterTypes.resize(2); parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); parameterTypes[1] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); voltdb::Procedure statisticsProc("@Statistics", parameterTypes); params = statisticsProc.params(); params->addString("TOPO").addInt32(0); boost::shared_ptr<TopoUpdateCallback> topoCallback(new TopoUpdateCallback(&m_distributer)); invoke(statisticsProc, topoCallback); }
bool FunctionTypeData::operator==(const FunctionTypeData& other) const { return attributes() == other.attributes() && returnType() == other.returnType() && parameterTypes() == other.parameterTypes(); }
MethodSetElement MethodSetElement::copy() const { return MethodSetElement(templateVariables().copy(), constPredicate().copy(), noexceptPredicate().copy(), requirePredicate().copy(), isStatic(), returnType(), parameterTypes().copy()); }
int main(int argc, char **argv) { /* * Instantiate a client and connect to the database. */ voltdb::ClientConfig clientConfig("program", "password"); voltdb::Client client = voltdb::Client::create(); client.createConnection("localhost"); /* * Describe the stored procedure to be invoked */ std::vector<voltdb::Parameter> parameterTypes(3); parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); parameterTypes[1] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); parameterTypes[2] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); voltdb::Procedure procedure("Insert", parameterTypes); boost::shared_ptr<CountingCallback> callback(new CountingCallback(5)); /* * Load the database. */ voltdb::ParameterSet* params = procedure.params(); params->addString("English").addString("Hello").addString("World"); client.invoke(procedure, callback); params->addString("French").addString("Bonjour").addString("Monde"); client.invoke(procedure, callback); params->addString("Spanish").addString("Hola").addString("Mundo"); client.invoke(procedure, callback); params->addString("Danish").addString("Hej").addString("Verden"); client.invoke(procedure, callback); params->addString("Italian").addString("Ciao").addString("Mondo"); client.invoke(procedure, callback); /* * Run the client event loop to poll the network and invoke callbacks. * The event loop will break on an error or when a callback returns true */ client.run(); /* * Describe procedure to retrieve message */ parameterTypes.resize( 1, voltdb::Parameter(voltdb::WIRE_TYPE_STRING)); voltdb::Procedure selectProc("Select", parameterTypes); /* * Retrieve the message */ selectProc.params()->addString("Spanish"); client.invoke(selectProc, boost::shared_ptr<PrintingCallback>(new PrintingCallback())); /* * Invoke event loop */ client.run(); return 0; }
void ConvertTypeInstance(Context& context, AST::Node<AST::TypeInstance>& typeInstanceNode) { for (const auto& function: *(typeInstanceNode->functionDecls)) { PushScopeElement pushScopeElement(context.scopeStack(), ScopeElement::Function(*function)); ConvertFunctionDef(context, function); } if (typeInstanceNode->isEnum()) { size_t enumValue = 0; // Generate enum constructors. for (const auto& constructorName: *(typeInstanceNode->constructors)) { const auto canonicalMethodName = CanonicalizeMethodName(constructorName); CreateEnumConstructorMethod(context, typeInstanceNode, typeInstanceNode->getFunction(canonicalMethodName), enumValue++); } } // Generate default constructor for applicable types. if (typeInstanceNode->isException()) { CreateExceptionConstructor(context, typeInstanceNode, typeInstanceNode->getFunction(context.getCString("create"))); } else if (typeInstanceNode->isDatatype() || typeInstanceNode->isStruct() || typeInstanceNode->isUnion()) { (void) DefaultMethods(context).createDefaultMethod(typeInstanceNode.get(), typeInstanceNode->getFunction(context.getCString("create")), typeInstanceNode.location()); } // Generate default implicitCopy if relevant. if (typeInstanceNode->isEnum() || typeInstanceNode->isStruct() || typeInstanceNode->isDatatype() || typeInstanceNode->isVariant() || typeInstanceNode->isUnion()) { const auto existingFunction = typeInstanceNode->findFunction(context.getCString("implicitcopy")); if (existingFunction != nullptr) { CreateDefaultMethodOrRemove(context, *typeInstanceNode, *existingFunction, typeInstanceNode.location()); } } // Generate default compare if relevant. if (typeInstanceNode->isEnum() || typeInstanceNode->isStruct() || typeInstanceNode->isDatatype() || typeInstanceNode->isVariant()) { const auto existingFunction = typeInstanceNode->findFunction(context.getCString("compare")); if (existingFunction != nullptr) { CreateDefaultMethodOrRemove(context, *typeInstanceNode, *existingFunction, typeInstanceNode.location()); } } // Simplify all predicates to avoid confusing CodeGen. for (auto& function: typeInstanceNode->functions()) { PushScopeElement pushFunction(context.scopeStack(), ScopeElement::Function(*function)); function->setConstPredicate(reducePredicate(context, function->constPredicate().copy())); function->setRequiresPredicate(reducePredicate(context, function->requiresPredicate().copy())); // Simplify function type noexcept predicate. const auto oldFunctionType = function->type(); const bool isVarArg = oldFunctionType.attributes().isVarArg(); const bool isMethod = oldFunctionType.attributes().isMethod(); const bool isTemplated = oldFunctionType.attributes().isTemplated(); auto noExceptPredicate = reducePredicate(context, oldFunctionType.attributes().noExceptPredicate().copy()); const auto returnType = oldFunctionType.returnType(); const auto& argTypes = oldFunctionType.parameterTypes(); AST::FunctionAttributes attributes(isVarArg, isMethod, isTemplated, std::move(noExceptPredicate)); function->setType(AST::FunctionType(std::move(attributes), returnType, argTypes.copy())); } }
static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &className, bool isBindable, QTextStream &out) { int id = 1; int i = 0; if (!mo) return 3; QString topclass = qAxFactory()->exposeToSuperClass(className); if (topclass.isEmpty()) topclass = QLatin1String("QObject"); bool hasStockEvents = qAxFactory()->hasStockEvents(className); const QMetaObject *pmo = mo; do { pmo = pmo->superClass(); } while (pmo && topclass != QString::fromLatin1(pmo->className())); int enumoff = pmo ? pmo->enumeratorOffset() : mo->enumeratorOffset(); int methodoff = pmo ? pmo->methodOffset() : mo->methodOffset(); int propoff = pmo ? pmo->propertyOffset() : mo->propertyOffset(); int qtProps = 0; int qtSlots = 0; bool control = false; if (o && o->isWidgetType()) { qtProps = QWidget::staticMetaObject.propertyCount(); qtSlots = QWidget::staticMetaObject.methodCount(); control = true; } const QString classID = stripCurlyBraces(qAxFactory()->classID(className)); if (classID.isEmpty()) return 4; const QString interfaceID = stripCurlyBraces(qAxFactory()->interfaceID(className)); if (interfaceID.isEmpty()) return 5; const QString eventsID = stripCurlyBraces(qAxFactory()->eventsID(className)); const bool hasEvents = !eventsID.isEmpty(); QString cleanClassName = qax_clean_type(className, mo); QString defProp(QLatin1String(mo->classInfo(mo->indexOfClassInfo("DefaultProperty")).value())); QString defSignal(QLatin1String(mo->classInfo(mo->indexOfClassInfo("DefaultSignal")).value())); for (i = enumoff; i < mo->enumeratorCount(); ++i) { const QMetaEnum enumerator = mo->enumerator(i); if (enums.contains(enumerator.name())) continue; enums.append(enumerator.name()); out << "\tenum " << enumerator.name() << " {" << endl; for (int j = 0; j < enumerator.keyCount(); ++j) { QByteArray key(enumerator.key(j)); while (enumValues.contains(key)) { key += '_'; } enumValues.append(key); const uint value = uint(enumerator.value(j)); key = key.leftJustified(20); out << "\t\t" << key << "\t= "; if (enumerator.isFlag()) out << "0x" << QByteArray::number(value, 16).rightJustified(8, '0'); else out << value; if (j < enumerator.keyCount()-1) out << ", "; out << endl; } out << "\t};" << endl << endl; } // mouse cursor enum for QCursor support if (!enums.contains("MousePointer")) { enums.append("MousePointer"); out << "\tenum MousePointer {" << endl; out << "\t\tArrowCursor = " << Qt::ArrowCursor << ',' << endl; out << "\t\tUpArrowCursor = " << Qt::UpArrowCursor << ',' << endl; out << "\t\tCrossCursor = " << Qt::CrossCursor << ',' << endl; out << "\t\tWaitCursor = " << Qt::WaitCursor << ',' << endl; out << "\t\tIBeamCursor = " << Qt::IBeamCursor << ',' << endl; out << "\t\tSizeVerCursor = " << Qt::SizeVerCursor << ',' << endl; out << "\t\tSizeHorCursor = " << Qt::SizeHorCursor << ',' << endl; out << "\t\tSizeBDiagCursor = " << Qt::SizeBDiagCursor << ',' << endl; out << "\t\tSizeFDiagCursor = " << Qt::SizeFDiagCursor << ',' << endl; out << "\t\tSizeAllCursor = " << Qt::SizeAllCursor << ',' << endl; out << "\t\tBlankCursor = " << Qt::BlankCursor << ',' << endl; out << "\t\tSplitVCursor = " << Qt::SplitVCursor << ',' << endl; out << "\t\tSplitHCursor = " << Qt::SplitHCursor << ',' << endl; out << "\t\tPointingHandCursor = " << Qt::PointingHandCursor << ',' << endl; out << "\t\tForbiddenCursor = " << Qt::ForbiddenCursor << ',' << endl; out << "\t\tWhatsThisCursor = " << Qt::WhatsThisCursor << ',' << endl; out << "\t\tBusyCursor\t= " << Qt::BusyCursor << endl; out << "\t};" << endl << endl; } if (!enums.contains("FocusPolicy")) { enums.append("FocusPolicy"); out << "\tenum FocusPolicy {" << endl; out << "\t\tNoFocus = " << Qt::NoFocus << ',' << endl; out << "\t\tTabFocus = " << Qt::TabFocus << ',' << endl; out << "\t\tClickFocus = " << Qt::ClickFocus << ',' << endl; out << "\t\tStrongFocus = " << Qt::StrongFocus << ',' << endl; out << "\t\tWheelFocus = " << Qt::WheelFocus << endl; out << "\t};" << endl << endl; } out << endl; out << "\t[" << endl; out << "\t\tuuid(" << interfaceID << ")," << endl; out << "\t\thelpstring(\"" << cleanClassName << " Interface\")" << endl; out << "\t]" << endl; out << "\tdispinterface I" << cleanClassName << endl; out << "\t{" << endl; out << "\tproperties:" << endl; for (i = propoff; i < mo->propertyCount(); ++i) { const QMetaProperty property = mo->property(i); /* if (property.testFlags(QMetaProperty::Override)) continue;*/ if (i <= qtProps && ignoreProps(property.name())) continue; if (!property.name() || mo->indexOfProperty(property.name()) > i) continue; bool ok = true; QByteArray type(convertTypes(property.typeName(), &ok)); QByteArray name(replaceKeyword(property.name())); if (!ok) out << "\t/****** Property is of unsupported datatype" << endl; out << "\t\t[id(" << id << ')'; if (!property.isWritable()) out << ", readonly"; if (isBindable && property.isScriptable(o)) out << ", bindable"; if (!property.isDesignable(o)) out << ", nonbrowsable"; if (isBindable) out << ", requestedit"; if (defProp == QLatin1String(name)) out << ", uidefault"; out << "] " << type << ' ' << name << ';' << endl; if (!ok) out << "\t******/" << endl; ++id; } out << endl; out << "\tmethods:" << endl; int numDefArgs = 0; QByteArray outBuffer; for (i = methodoff; i < mo->methodCount(); ++i) { const QMetaMethod slot = mo->method(i); if (slot.access() != QMetaMethod::Public || slot.methodType() == QMetaMethod::Signal) continue; if (slot.attributes() & QMetaMethod::Cloned) { ++numDefArgs; continue; } if (!outBuffer.isEmpty()) { outBuffer = addDefaultArguments(outBuffer, numDefArgs); numDefArgs = 0; out << outBuffer; outBuffer = QByteArray(); } QByteArray signature(slot.methodSignature()); QByteArray name(signature.left(signature.indexOf('('))); if (i <= qtSlots && ignoreSlots(name)) continue; signature.remove(0, name.length() + 1); signature.truncate(signature.length() - 1); name = renameOverloads(replaceKeyword(name)); if (ignoreSlots(name)) continue; QList<QByteArray> parameterTypes(slot.parameterTypes()); QList<QByteArray> parameterNames(slot.parameterNames()); bool ok = true; QByteArray type = slot.typeName(); if (type.isEmpty()) type = "void"; else type = convertTypes(type, &ok); QByteArray ptype(prototype(parameterTypes, parameterNames, &ok)); if (!ok) outBuffer += "\t/****** Slot parameter uses unsupported datatype\n"; outBuffer += "\t\t[id(" + QByteArray::number(id) + ")] " + type + ' ' + name + '(' + ptype + ");\n"; if (!ok) outBuffer += "\t******/\n"; ++id; } if (!outBuffer.isEmpty()) { outBuffer = addDefaultArguments(outBuffer, numDefArgs); numDefArgs = 0; out << outBuffer; outBuffer = QByteArray(); } out << "\t};" << endl << endl; mapping.clear(); id = 1; if (hasEvents) { out << "\t[" << endl; out << "\t\tuuid(" << eventsID << ")," << endl; out << "\t\thelpstring(\"" << cleanClassName << " Events Interface\")" << endl; out << "\t]" << endl; out << "\tdispinterface I" << cleanClassName << "Events" << endl; out << "\t{" << endl; out << "\tproperties:" << endl; out << "\tmethods:" << endl; if (hasStockEvents) { out << "\t/****** Stock events ******/" << endl; out << "\t\t[id(DISPID_CLICK)] void Click();" << endl; out << "\t\t[id(DISPID_DBLCLICK)] void DblClick();" << endl; out << "\t\t[id(DISPID_KEYDOWN)] void KeyDown(short* KeyCode, short Shift);" << endl; out << "\t\t[id(DISPID_KEYPRESS)] void KeyPress(short* KeyAscii);" << endl; out << "\t\t[id(DISPID_KEYUP)] void KeyUp(short* KeyCode, short Shift);" << endl; out << "\t\t[id(DISPID_MOUSEDOWN)] void MouseDown(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << endl; out << "\t\t[id(DISPID_MOUSEMOVE)] void MouseMove(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << endl; out << "\t\t[id(DISPID_MOUSEUP)] void MouseUp(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << endl << endl; } for (i = methodoff; i < mo->methodCount(); ++i) { const QMetaMethod signal = mo->method(i); if (signal.methodType() != QMetaMethod::Signal) continue; QByteArray signature(signal.methodSignature()); QByteArray name(signature.left(signature.indexOf('('))); signature.remove(0, name.length() + 1); signature.truncate(signature.length() - 1); QList<QByteArray> parameterTypes(signal.parameterTypes()); QList<QByteArray> parameterNames(signal.parameterNames()); bool isDefault = defSignal == QLatin1String(name); name = renameOverloads(replaceKeyword(name)); bool ok = true; QByteArray type = signal.typeName(); if (!type.isEmpty() && type != "void") // signals with return value not supported continue; QByteArray ptype(prototype(parameterTypes, parameterNames, &ok)); if (!ok) out << "\t/****** Signal parameter uses unsupported datatype" << endl; out << "\t\t[id(" << id << ')'; if (isDefault) out << ", uidefault"; out << "] void " << name << '(' << ptype << ");" << endl; if (!ok) out << "\t******/" << endl; ++id; } out << "\t};" << endl << endl; } out << "\t[" << endl; if (qstricmp(mo->classInfo(mo->indexOfClassInfo("Aggregatable")).value(), "no")) out << "\t\taggregatable," << endl; if (!qstricmp(mo->classInfo(mo->indexOfClassInfo("RegisterObject")).value(), "yes")) out << "\t\tappobject," << endl; if (mo->classInfo(mo->indexOfClassInfo("LicenseKey")).value()) out << "\t\tlicensed," << endl; const char *helpString = mo->classInfo(mo->indexOfClassInfo("Description")).value(); if (helpString) out << "\t\thelpstring(\"" << helpString << "\")," << endl; else out << "\t\thelpstring(\"" << cleanClassName << " Class\")," << endl; const char *classVersion = mo->classInfo(mo->indexOfClassInfo("Version")).value(); if (classVersion) out << "\t\tversion(" << classVersion << ")," << endl; out << "\t\tuuid(" << classID << ')'; if (control) { out << ", " << endl; out << "\t\tcontrol"; } else if (!o) { out << ", " << endl; out << "\t\tnoncreatable"; } out << endl; out << "\t]" << endl; out << "\tcoclass " << cleanClassName << endl; out << "\t{" << endl; out << "\t\t[default] dispinterface I" << cleanClassName << ';' << endl; if (hasEvents) out << "\t\t[default, source] dispinterface I" << cleanClassName << "Events;" << endl; out << "\t};" << endl; return S_OK; }
FunctionTypeData FunctionTypeData::copy() const { return FunctionTypeData(attributes().copy(), returnType(), parameterTypes().copy()); }
MethodSetElement MethodSetElement::withRequirement(Predicate requirement) const { return MethodSetElement(templateVariables().copy(), constPredicate().copy(), noexceptPredicate().copy(), Predicate::And(requirePredicate().copy(), std::move(requirement)), isStatic(), returnType(), parameterTypes().copy()); }
FunctionType MethodSetElement::createFunctionType(const bool isTemplated) const { const bool isVarArg = false; const bool isMethod = !isStatic(); FunctionAttributes attributes(isVarArg, isMethod, isTemplated, noexceptPredicate().copy()); return FunctionType(std::move(attributes), returnType(), parameterTypes().copy()); }
MethodSetElement MethodSetElement::withNoExceptPredicate(Predicate newNoExceptPredicate) const { return MethodSetElement(templateVariables().copy(), constPredicate().copy(), std::move(newNoExceptPredicate), requirePredicate().copy(), isStatic(), returnType(), parameterTypes().copy()); }