本文整理汇总了C++中UiObjectMember类的典型用法代码示例。如果您正苦于以下问题:C++ UiObjectMember类的具体用法?C++ UiObjectMember怎么用?C++ UiObjectMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UiObjectMember类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: readParameter
void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMethod *fmm)
{
QString name;
QString type;
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (!script) {
addWarning(member->firstSourceLocation(), tr("Expected script binding."));
continue;
}
const QString id = toString(script->qualifiedId);
if (id == QLatin1String("name")) {
name = readStringBinding(script);
} else if (id == QLatin1String("type")) {
type = readStringBinding(script);
} else if (id == QLatin1String("isPointer")) {
// ### unhandled
} else if (id == QLatin1String("isReadonly")) {
// ### unhandled
} else if (id == QLatin1String("isList")) {
// ### unhandled
} else {
addWarning(script->firstSourceLocation(), tr("Expected only name and type script bindings."));
}
}
fmm->addParameter(name, type);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:31,代码来源:qmljstypedescriptionreader.cpp
示例2: readModuleApi
void TypeDescriptionReader::readModuleApi(UiObjectDefinition *ast)
{
ModuleApiInfo apiInfo;
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (script) {
const QString name = toString(script->qualifiedId);
if (name == QLatin1String("uri")) {
apiInfo.uri = readStringBinding(script);
} else if (name == QLatin1String("version")) {
apiInfo.version = readNumericVersionBinding(script);
} else if (name == QLatin1String("name")) {
apiInfo.cppName = readStringBinding(script);
} else {
addWarning(script->firstSourceLocation(),
tr("Expected only uri, version and name script bindings."));
}
} else {
addWarning(member->firstSourceLocation(), tr("Expected only script bindings."));
}
}
if (!apiInfo.version.isValid()) {
addError(ast->firstSourceLocation(), tr("ModuleApi definition has no or invalid version binding."));
return;
}
if (_moduleApis)
_moduleApis->append(apiInfo);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:33,代码来源:qmljstypedescriptionreader.cpp
示例3: fmo
void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
{
FakeMetaObject::Ptr fmo(new FakeMetaObject);
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (component) {
QString name = toString(component->qualifiedTypeNameId);
if (name == "Property") {
readProperty(component, fmo);
} else if (name == "Method" || name == "Signal") {
readSignalOrMethod(component, name == "Method", fmo);
} else if (name == "Enum") {
readEnum(component, fmo);
} else {
addWarning(component->firstSourceLocation(), "Expected only Property, Method, Signal and Enum object definitions");
}
} else if (script) {
QString name = toString(script->qualifiedId);
if (name == "name") {
fmo->setClassName(readStringBinding(script));
} else if (name == "prototype") {
fmo->setSuperclassName(readStringBinding(script));
} else if (name == "defaultProperty") {
fmo->setDefaultPropertyName(readStringBinding(script));
} else if (name == "exports") {
readExports(script, fmo);
} else if (name == "exportMetaObjectRevisions") {
readMetaObjectRevisions(script, fmo);
} else if (name == "attachedType") {
fmo->setAttachedTypeName(readStringBinding(script));
} else {
addWarning(script->firstSourceLocation(),
"Expected only name, prototype, defaultProperty, attachedType, exports"
"and exportMetaObjectRevisions script bindings");
}
} else {
addWarning(member->firstSourceLocation(), "Expected only script bindings and object definitions");
}
}
if (fmo->className().isEmpty()) {
addError(ast->firstSourceLocation(), "Component definition is missing a name binding");
return;
}
// ### add implicit export into the package of c++ types
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
_objects->insert(fmo->className(), fmo);
}
开发者ID:hdweiss,项目名称:qt-creator-visualizer,代码行数:52,代码来源:qmljstypedescriptionreader.cpp
示例4: appendToArrayBinding
void Rewriter::appendToArrayBinding(UiArrayBinding *arrayBinding,
const QString &content)
{
UiObjectMember *lastMember = 0;
for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next)
if (iter->member)
lastMember = iter->member;
if (!lastMember)
return; // an array binding cannot be empty, so there will (or should) always be a last member.
const int insertionPoint = lastMember->lastSourceLocation().end();
m_changeSet->insert(insertionPoint, QLatin1String(",\n") + content);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:15,代码来源:qmljsrewriter.cpp
示例5: appendToArray
void appendToArray(UiArrayBinding *ast)
{
UiObjectMember *lastMember = 0;
for (UiArrayMemberList *iter = ast->members; iter; iter = iter->next) {
if (iter->member)
lastMember = iter->member;
}
if (!lastMember)
Q_ASSERT(!"Invalid QML: empty array found.");
moveInfo.destination = lastMember->lastSourceLocation().end();
moveInfo.suffixToInsert = QLatin1String(",\n");
move(moveInfo);
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:16,代码来源:moveobjectvisitor.cpp
示例6: insertIntoArray
void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue)
{
if (!ast)
return;
UiObjectMember *lastMember = 0;
for (UiArrayMemberList *iter = ast->members; iter; iter = iter->next) {
lastMember = iter->member;
}
if (!lastMember)
return;
const int insertionPoint = lastMember->lastSourceLocation().end();
m_changeSet->insert(insertionPoint, QLatin1String(",\n") + newValue);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:16,代码来源:qmljsrewriter.cpp
示例7: insertInto
// FIXME: duplicate code in the QmlJS::Rewriter class, remove this
void AddArrayMemberVisitor::insertInto(QmlJS::AST::UiArrayBinding *arrayBinding)
{
UiObjectMember *lastMember = 0;
for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next)
if (iter->member)
lastMember = iter->member;
if (!lastMember)
return; // an array binding cannot be empty, so there will (or should) always be a last member.
const int insertionPoint = lastMember->lastSourceLocation().end();
const int indentDepth = calculateIndentDepth(lastMember->firstSourceLocation());
replace(insertionPoint, 0, QLatin1String(",\n") + addIndentation(m_content, indentDepth));
setDidRewriting(true);
}
开发者ID:gidlbn,项目名称:dlbn_02,代码行数:18,代码来源:addarraymembervisitor.cpp
示例8: readSignalOrMethod
void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isMethod, FakeMetaObject::Ptr fmo)
{
FakeMetaMethod fmm;
// ### confusion between Method and Slot. Method should be removed.
if (isMethod)
fmm.setMethodType(FakeMetaMethod::Slot);
else
fmm.setMethodType(FakeMetaMethod::Signal);
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (component) {
QString name = toString(component->qualifiedTypeNameId);
if (name == "Parameter") {
readParameter(component, &fmm);
} else {
addWarning(component->firstSourceLocation(), "Expected only Parameter object definitions");
}
} else if (script) {
QString name = toString(script->qualifiedId);
if (name == "name") {
fmm.setMethodName(readStringBinding(script));
} else if (name == "type") {
fmm.setReturnType(readStringBinding(script));
} else if (name == "revision") {
fmm.setRevision(readIntBinding(script));
} else {
addWarning(script->firstSourceLocation(), "Expected only name and type script bindings");
}
} else {
addWarning(member->firstSourceLocation(), "Expected only script bindings and object definitions");
}
}
if (fmm.methodName().isEmpty()) {
addError(ast->firstSourceLocation(), "Method or Signal is missing a name script binding");
return;
}
fmo->addMethod(fmm);
}
开发者ID:hdweiss,项目名称:qt-creator-visualizer,代码行数:44,代码来源:qmljstypedescriptionreader.cpp
示例9: insertIntoArray
// FIXME: duplicate code in the QmlJS::Rewriter class, remove this
void ChangePropertyVisitor::insertIntoArray(QmlJS::AST::UiArrayBinding *ast)
{
if (!ast)
return;
UiObjectMember *lastMember = 0;
for (UiArrayMemberList *iter = ast->members; iter; iter = iter->next) {
lastMember = iter->member;
}
if (!lastMember)
return;
const int insertionPoint = lastMember->lastSourceLocation().end();
const int depth = calculateIndentDepth(lastMember->firstSourceLocation());
const QString indentedArrayMember = addIndentation(m_value, depth);
replace(insertionPoint, 0, QStringLiteral(",\n") + indentedArrayMember);
setDidRewriting(true);
}
开发者ID:AltarBeastiful,项目名称:qt-creator,代码行数:20,代码来源:changepropertyvisitor.cpp
示例10: readProperty
void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject::Ptr fmo)
{
QString name;
QString type;
bool isPointer = false;
bool isReadonly = false;
bool isList = false;
int revision = 0;
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (!script) {
addWarning(member->firstSourceLocation(), "Expected script binding");
continue;
}
QString id = toString(script->qualifiedId);
if (id == "name") {
name = readStringBinding(script);
} else if (id == "type") {
type = readStringBinding(script);
} else if (id == "isPointer") {
isPointer = readBoolBinding(script);
} else if (id == "isReadonly") {
isReadonly = readBoolBinding(script);
} else if (id == "isList") {
isList = readBoolBinding(script);
} else if (id == "revision") {
revision = readIntBinding(script);
} else {
addWarning(script->firstSourceLocation(), "Expected only type, name, revision, isPointer, isReadonly and isList script bindings");
}
}
if (name.isEmpty() || type.isEmpty()) {
addError(ast->firstSourceLocation(), "Property object is missing a name or type script binding");
return;
}
fmo->addProperty(FakeMetaProperty(name, type, isList, !isReadonly, isPointer, revision));
}
开发者ID:hdweiss,项目名称:qt-creator-visualizer,代码行数:42,代码来源:qmljstypedescriptionreader.cpp
示例11: readModule
void TypeDescriptionReader::readModule(UiObjectDefinition *ast)
{
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
QString typeName;
if (component)
typeName = toString(component->qualifiedTypeNameId);
if (!component || (typeName != QLatin1String("Component") && typeName != QLatin1String("ModuleApi"))) {
addWarning(member->firstSourceLocation(),
tr("Expected only Component and ModuleApi object definitions."));
continue;
}
if (typeName == QLatin1String("Component"))
readComponent(component);
else if (typeName == QLatin1String("ModuleApi"))
readModuleApi(component);
}
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:22,代码来源:qmljstypedescriptionreader.cpp
示例12: readEnum
void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Ptr fmo)
{
FakeMetaEnum fme;
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (!script) {
addWarning(member->firstSourceLocation(), tr("Expected script binding."));
continue;
}
QString name = toString(script->qualifiedId);
if (name == QLatin1String("name"))
fme.setName(readStringBinding(script));
else if (name == QLatin1String("values"))
readEnumValues(script, &fme);
else
addWarning(script->firstSourceLocation(), tr("Expected only name and values script bindings."));
}
fmo->addEnum(fme);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:23,代码来源:qmljstypedescriptionreader.cpp
示例13: fmo
void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
{
FakeMetaObject::Ptr fmo(new FakeMetaObject);
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
UiObjectMember *member = it->member;
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (component) {
QString name = toString(component->qualifiedTypeNameId);
if (name == QLatin1String("Property"))
readProperty(component, fmo);
else if (name == QLatin1String("Method") || name == QLatin1String("Signal"))
readSignalOrMethod(component, name == QLatin1String("Method"), fmo);
else if (name == QLatin1String("Enum"))
readEnum(component, fmo);
else
addWarning(component->firstSourceLocation(),
tr("Expected only Property, Method, Signal and Enum object definitions, not \"%1\".")
.arg(name));
} else if (script) {
QString name = toString(script->qualifiedId);
if (name == QLatin1String("name")) {
fmo->setClassName(readStringBinding(script));
} else if (name == QLatin1String("prototype")) {
fmo->setSuperclassName(readStringBinding(script));
} else if (name == QLatin1String("defaultProperty")) {
fmo->setDefaultPropertyName(readStringBinding(script));
} else if (name == QLatin1String("exports")) {
readExports(script, fmo);
} else if (name == QLatin1String("exportMetaObjectRevisions")) {
readMetaObjectRevisions(script, fmo);
} else if (name == QLatin1String("attachedType")) {
fmo->setAttachedTypeName(readStringBinding(script));
} else if (name == QLatin1String("isSingleton")) {
fmo->setIsSingleton(readBoolBinding(script));
} else if (name == QLatin1String("isCreatable")) {
fmo->setIsCreatable(readBoolBinding(script));
} else if (name == QLatin1String("isComposite")) {
fmo->setIsComposite(readBoolBinding(script));
} else {
addWarning(script->firstSourceLocation(),
tr("Expected only name, prototype, defaultProperty, attachedType, exports "
"isSingleton, isCreatable, isComposite and exportMetaObjectRevisions "
"script bindings, not \"%1\".").arg(name));
}
} else {
addWarning(member->firstSourceLocation(), tr("Expected only script bindings and object definitions."));
}
}
if (fmo->className().isEmpty()) {
addError(ast->firstSourceLocation(), tr("Component definition is missing a name binding."));
return;
}
// ### add implicit export into the package of c++ types
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
fmo->updateFingerprint();
_objects->insert(fmo->className(), fmo);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:61,代码来源:qmljstypedescriptionreader.cpp
注:本文中的UiObjectMember类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论