本文整理汇总了C++中qrrepo::RepoApi::name方法的典型用法代码示例。如果您正苦于以下问题:C++ RepoApi::name方法的具体用法?C++ RepoApi::name怎么用?C++ RepoApi::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qrrepo::RepoApi
的用法示例。
在下文中一共展示了RepoApi::name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateRootNode
QString QrsMetamodelLoader::validateRootNode(const qrRepo::RepoApi &repo, const Id &diagram)
{
if (!repo.hasProperty(diagram, "nodeName")) {
return QString();
}
const QString rootNode = repo.property(diagram, "nodeName").toString();
for (const Id &child : repo.children(diagram)) {
if (repo.name(child) == rootNode && (child.type() == metamodelNodeType || child.type() == metamodelGroupType)) {
return rootNode;
}
}
emit errorOccured(QObject::tr("Root node for diagram %1 (which is %2) does not exist!")
.arg(repo.name(diagram)).arg(rootNode), diagram);
return rootNode;
}
示例2: apply
void Binding::apply(const qrRepo::RepoApi &repo
, const Id &id, QString &data)
{
const QString property = mProperty.isEmpty()
? mValue
: mProperty == "name"
? repo.name(id)
: repo.property(id, mProperty).toString();
if (mConverter) {
data.replace(mLabel, mConverter->convert(property));
} else {
applyMulti(property, data);
}
}
示例3: validatePortName
QString QrsMetamodelLoader::validatePortName(const qrRepo::RepoApi &repo, const Id &id, const QString &name)
{
if (name == "NonTyped") {
return name;
}
for (const Id &port : repo.elementsByType(metamodelPortType.element())) {
if (repo.name(port) == name) {
return name;
}
}
emit errorOccured(tr("Port type %1 not declared in metamodel"), id);
return "NonTyped";
}
示例4: validateName
QString QrsMetamodelLoader::validateName(const qrRepo::RepoApi &repo, const Id &id)
{
const QString result = repo.name(id);
if (result.isEmpty()) {
emit errorOccured(tr("Name should not be empty"), id);
}
const QRegExp patten("[A-Za-z_]+([A-Za-z_0-9 :]*)");
if (!patten.exactMatch(result)) {
emit errorOccured(QObject::tr("Name should contain only latin letters, digits, spaces and underscores "
"and should start with latin letter or underscore"), id);
}
return result;
}
示例5: parseProperties
void QrsMetamodelLoader::parseProperties(const qrRepo::RepoApi &repo, ElementType &element, const Id &id)
{
const IdList children = repo.children(id);
for (const Id &child : children) {
if (child.type() == metamodelAttributeType && repo.isLogicalElement(id)) {
const QString type = repo.stringProperty(child, "attributeType");
element.addProperty(repo.name(child), type
, stringProperty(repo, child, "defaultValue", "string")
, stringProperty(repo, child, "displayedName")
, stringProperty(repo, child, "description")
, type == "reference");
}
}
}
示例6: parseGroup
void QrsMetamodelLoader::parseGroup(const qrRepo::RepoApi &repo
, Metamodel &metamodel, const Id &diagram, const Id &id)
{
/// @todo: We should not use XML here, PatternType must not parse XML at all.
QDomDocument document;
QDomElement groupElement = document.createElement("group");
groupElement.setAttribute("name", validateName(repo, id));
groupElement.setAttribute("rootNode", stringProperty(repo, id, "rootNode"));
document.appendChild(groupElement);
parseGroupNodes(repo, groupElement, id);
PatternType *pattern = new PatternType(metamodel);
pattern->setXml(document.toString(4));
pattern->setDiagram(repo.name(diagram));
metamodel.addElement(*pattern);
}
示例7: parsePorts
void QrsMetamodelLoader::parsePorts(const qrRepo::RepoApi &repo
, EdgeElementType &edge, const Id &id, const QString &direction)
{
const QString propertyName = direction + "Ports";
const QStringList ports = stringProperty(repo, id, propertyName).split(',', QString::SkipEmptyParts);
QStringList result;
for (const QString &port : ports) {
const Id portId = Id::loadFromString(port);
result << repo.name(portId);
}
if (direction == "from") {
edge.setFromPortTypes(result);
} else {
edge.setToPortTypes(result);
}
}
示例8: parseNode
void QrsMetamodelLoader::parseNode(const qrRepo::RepoApi &repo
, Metamodel &metamodel, const Id &diagram, const Id &id)
{
NodeElementType *node = new NodeElementType(metamodel);
node->setName(validateName(repo, id));
node->setFriendlyName(repo.stringProperty(id, "displayedName"));
node->setDiagram(repo.name(diagram));
node->setMouseGesture(stringProperty(repo, id, "path"));
node->setDescription(stringProperty(repo, id, "description"));
node->setHidden(boolProperty(repo, id, "abstract"));
node->setResizable(boolProperty(repo, id, "isResizeable", true));
node->setCreateChildrenFromMenu(boolProperty(repo, id, "createChildrenFromMenu"));
parseSdfGraphics(repo, *node, id);
parseContainerProperties(repo, *node, id);
parseProperties(repo, *node, id);
metamodel.addElement(*node);
}
示例9: parseEdge
void QrsMetamodelLoader::parseEdge(const qrRepo::RepoApi &repo
, Metamodel &metamodel, const Id &diagram, const Id &id)
{
EdgeElementType *edge = new EdgeElementType(metamodel);
edge->setName(validateName(repo, id));
edge->setFriendlyName(repo.stringProperty(id, "displayedName"));
edge->setDiagram(repo.name(diagram));
edge->setDescription(stringProperty(repo, id, "description"));
edge->setDividable(boolProperty(repo, id, "isDividable"));
edge->setPenWidth(1);
edge->setPenColor(Qt::black);
edge->setPenStyle(parsePenStyle(stringProperty(repo, id, "lineType"), id));
edge->setShapeType(parseLinkShape(stringProperty(repo, id, "shape"), id));
const QString labelText = stringProperty(repo, id, "labelText");
if (!labelText.isEmpty()) {
LabelProperties label;
const QString labelType = stringProperty(repo, id, "labelType");
if (labelType.contains("static", Qt::CaseInsensitive)) {
label = LabelProperties(0, 0, 0, labelText, 0);
} else if (labelType.contains("dynamic", Qt::CaseInsensitive)) {
label = LabelProperties(0, 0, 0, labelText, false, 0);
} else {
emit errorOccured(tr("Incorrect label type"), id);
}
label.setHard(boolProperty(repo, id, "hardLabel"));
edge->addLabel(label);
}
parseAssociations(repo, *edge, id);
parseProperties(repo, *edge, id);
parsePorts(repo, *edge, id, "from");
parsePorts(repo, *edge, id, "to");
metamodel.addElement(*edge);
}