本文整理汇总了C++中UMLAttribute::setStatic方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLAttribute::setStatic方法的具体用法?C++ UMLAttribute::setStatic怎么用?C++ UMLAttribute::setStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLAttribute
的用法示例。
在下文中一共展示了UMLAttribute::setStatic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseAssignmentStmt
/**
* Parse assignments in the form <identifier> '=' <value>
* Instance variables are identified by a prefixed 'self.'.
* @return success status of parsing
*/
bool PythonImport::parseAssignmentStmt(const QString keyword)
{
QString variable = keyword;
advance();
QString value = advance();
if (value == QLatin1String("-"))
value.append(advance());
bool isStatic = true;
if (variable.startsWith(QLatin1String("self."))) {
variable.remove(0,5);
isStatic = false;
}
Uml::Visibility::Enum visibility = Uml::Visibility::Public;
if (variable.startsWith(QLatin1String("__"))) {
visibility = Uml::Visibility::Private;
variable.remove(0, 2);
} else if (variable.startsWith(QLatin1String("_"))) {
visibility = Uml::Visibility::Protected;
variable.remove(0, 1);
}
QString type;
if (value == QLatin1String("[")) {
if (lookAhead() == QLatin1String("]")) {
advance();
type = QLatin1String("list");
value = QLatin1String("");
}
} else if (value == QLatin1String("{")) {
if (lookAhead() == QLatin1String("}")) {
advance();
type = QLatin1String("dict");
value = QLatin1String("");
}
} else if (value.startsWith(QLatin1String("\""))) {
type = QLatin1String("string");
} else if (value == QLatin1String("True") || value == QLatin1String("False")) {
type = QLatin1String("bool");
} else if (value.contains(QRegExp(QLatin1String("-?\\d+\\.\\d*")))) {
type = QLatin1String("float");
} else if (value.contains(QRegExp(QLatin1String("-?\\d+")))) {
type = QLatin1String("int");
} else if (!value.isEmpty()) {
type = QLatin1String("object");
}
UMLObject* o = Import_Utils::insertAttribute(m_klass, visibility, variable,
type, m_comment, false);
UMLAttribute* a = o->asUMLAttribute();
a->setInitialValue(value);
a->setStatic(isStatic);
return true;
}