本文整理汇总了C++中qrrepo::RepoApi类的典型用法代码示例。如果您正苦于以下问题:C++ RepoApi类的具体用法?C++ RepoApi怎么用?C++ RepoApi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RepoApi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseObjectsOnDiagram
void QrsMetamodelLoader::parseObjectsOnDiagram(const qrRepo::RepoApi &repo, Metamodel &metamodel, const Id &diagram)
{
if (diagram.isNull() || diagram == Id::rootId()) {
return;
}
for (const Id &id : repo.children(diagram)) {
if (!repo.isLogicalElement(id)) {
continue;
}
const Id type = id.type();
if (type == metamodelEnumType) {
parseEnum(repo, metamodel, id);
} else if (type == metamodelPortType) {
parsePort(repo, metamodel, id);
} else if (type == metamodelGroupType) {
parseGroup(repo, metamodel, diagram, id);
} else if (type == metamodelImportType) {
parseImport(repo, metamodel, id);
} else if (type == metamodelNodeType) {
parseNode(repo, metamodel, diagram, id);
} else if (type == metamodelEdgeType) {
parseEdge(repo, metamodel, diagram, id);
}
}
}
示例2: BindingGenerator
PioneerGetLPSPosition::PioneerGetLPSPosition(const qrRepo::RepoApi &repo
, generatorBase::GeneratorCustomizer &customizer
, const qReal::Id &id
, QObject *parent)
: BindingGenerator(repo, customizer, id, "quadcopterCommands/getLPSPosition.t"
, {
Binding::createConverting(
"@@[email protected]@"
, "X"
, customizer.factory()->stringPropertyConverter(id, "X"))
, Binding::createConverting(
"@@[email protected]@"
, "Y"
, customizer.factory()->stringPropertyConverter(id, "Y"))
, Binding::createConverting(
"@@[email protected]@"
, "Z"
, customizer.factory()->stringPropertyConverter(id, "Z"))
}
, parent)
{
customizer.factory()->functionBlockConverter(id, "")->convert(
QString("%1 = 0;%2 = 0;%3 = 0;")
.arg(repo.stringProperty(id, "X"))
.arg(repo.stringProperty(id, "Y"))
.arg(repo.stringProperty(id, "Z")));
}
示例3: stringProperty
QString QrsMetamodelLoader::stringProperty(const qrRepo::RepoApi &repo, const Id &id
, const QString &propertyName, const QString &defaultValue)
{
if (!repo.hasProperty(id, propertyName)) {
return defaultValue;
}
return repo.stringProperty(id, propertyName);
}
示例4: boolProperty
bool QrsMetamodelLoader::boolProperty(const qrRepo::RepoApi &repo, const Id &id
, const QString &propertyName, bool defaultValue)
{
if (!repo.hasProperty(id, propertyName)) {
return defaultValue;
}
return repo.stringProperty(id, propertyName) == "true";
}
示例5: intProperty
int QrsMetamodelLoader::intProperty(const qrRepo::RepoApi &repo, const Id &id
, const QString &propertyName, int defaultValue)
{
if (!repo.hasProperty(id, propertyName)) {
return defaultValue;
}
return parseInt(repo.stringProperty(id, propertyName), id);
}
示例6: saveEdge
Id QrsMetamodelSaver::saveEdge(qrRepo::RepoApi &repo, const EdgeElementType &edge, const Id &diagram)
{
const Id edgeId = metamodelEdgeType.sameTypeId();
repo.addChild(diagram, edgeId);
repo.setName(edgeId, edge.name());
repo.setProperty(edgeId, "displayedName", edge.friendlyName());
repo.setProperty(edgeId, "description", edge.description());
repo.setProperty(edgeId, "isDividable", edge.isDividable());
repo.setProperty(edgeId, "lineType", penStyleToString(edge.penStyle()));
repo.setProperty(edgeId, "shape", linkShapeToString(edge.shapeType()));
const QList<LabelProperties> &labels = edge.labels();
if (!labels.isEmpty()) {
const LabelProperties &label = labels.first();
repo.setProperty(edgeId, "labelText", label.isStatic() ? label.text() : label.binding());
repo.setProperty(edgeId, "labelType", label.isStatic() ? "staticText" : "dynamicText");
repo.setProperty(edgeId, "hardLabel", label.isHard());
}
saveAssociations(repo, edge, edgeId);
saveProperties(repo, edge, edgeId);
savePorts(repo, edge, edgeId, "from");
savePorts(repo, edge, edgeId, "to");
return edgeId;
}
示例7: qMakePair
QList<QPair<QString, QString>> QrsMetamodelLoader::parseEnumValues(const qrRepo::RepoApi &repo, const Id &id)
{
QList<QPair<QString, QString>> result;
for (const Id &child : repo.children(id)) {
if (child.type() == metamodelEnumValueType && repo.isLogicalElement(child)) {
result << qMakePair(validateName(repo, child), stringProperty(repo, child, "displayedName"));
}
}
return result;
}
示例8: BindingGenerator
VariableInitGenerator::VariableInitGenerator(qrRepo::RepoApi const &repo
, GeneratorCustomizer &customizer
, Id const &id
, QObject *parent)
: BindingGenerator(repo, customizer, id, "function.t"
, { Binding::createStaticConverting("@@[email protected]@"
, repo.property(id, "variable").toString() + "=" + repo.property(id, "value").toString()
, customizer.factory()->functionBlockConverter(id, "value")) }
, parent)
{
}
示例9: BindingGenerator
SayGenerator::SayGenerator(const qrRepo::RepoApi &repo
, generatorBase::GeneratorCustomizer &customizer
, const qReal::Id &id
, QObject *parent)
: BindingGenerator(repo, customizer, id
, "say.t"
, { repo.property(id, "Evaluate").toBool()
? Binding::createConverting("@@[email protected]@", "Text"
, customizer.factory()->stringPropertyConverter(id, "Text"))
: Binding::createStatic("@@[email protected]@", utils::StringUtils::wrap(repo.property(id, "Text").toString()))
} , parent)
{
}
示例10: result
QVector<int> QrsMetamodelLoader::intVectorProperty(const qrRepo::RepoApi &repo, const Id &id
, const QString &propertyName, const QVector<int> &defaultValue)
{
if (!repo.hasProperty(id, propertyName)) {
return defaultValue;
}
const QStringList values = repo.stringProperty(id, propertyName).split(",", QString::SkipEmptyParts);
QVector<int> result(values.size());
for (int i = 0; i < values.size(); ++i) {
result[i] = parseInt(values[i], id);
}
return result;
}
示例11: 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);
}
}
示例12: 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";
}
示例13: 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");
}
}
}
示例14: saveDiagram
void QrsMetamodelSaver::saveDiagram(qrRepo::RepoApi &repo, const Metamodel &metamodel
, const QString &diagramName, const Id &metamodelId, Id &resultingId)
{
const Id diagramId = metamodelDiagramType.sameTypeId();
resultingId = diagramId;
repo.addChild(metamodelId, diagramId);
repo.setName(diagramId, diagramName);
repo.setProperty(diagramId, "displayedName", metamodel.diagramFriendlyName(diagramName));
if (const ElementType *node = metamodel.diagramNode(diagramName)) {
repo.setProperty(diagramId, "nodeName", node->name());
}
QMap<const ElementType *, Id> elements;
saveObjectsOnDiagram(repo, metamodel, diagramName, diagramId, elements);
saveLinksInMetamodel(repo, metamodel, diagramName, diagramId, elements);
}
示例15: parseContainer
void QrsMetamodelLoader::parseContainer(const qrRepo::RepoApi &repo, Metamodel &metamodel
, const Id &id, const QString &diagram)
{
const Id from = repo.from(id);
const Id to = repo.to(id);
if (from.isNull() || to.isNull()) {
qWarning() << "Containment link" << id << "is not connected!";
return;
}
const QString fromName = validateName(repo, from);
const QString toName = validateName(repo, to);
ElementType &fromElement = metamodel.elementType(diagram, fromName);
ElementType &toElement = metamodel.elementType(diagram, toName);
metamodel.produceEdge(fromElement, toElement, ElementType::containmentLinkType);
}