本文整理汇总了C++中UmlClass::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlClass::parent方法的具体用法?C++ UmlClass::parent怎么用?C++ UmlClass::parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlClass
的用法示例。
在下文中一共展示了UmlClass::parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isAppliedStereotype
bool UmlClass::isAppliedStereotype(Token & tk, WrapperStr & prof_st, Q3ValueList<WrapperStr> & base_v)
{
static Q3Dict<WrapperStr> stereotypes;
static Q3Dict<Q3ValueList<WrapperStr> > bases;
WrapperStr s = tk.what();
WrapperStr * st = stereotypes[s];
if (st != 0) {
prof_st = *st;
base_v = *bases[s];
return TRUE;
}
base_v.clear();
if (tk.xmiType().isEmpty() && (getFct(tk) == 0)) {
int index = s.find(':');
if ((index != -1) &&
((index != 3) || ((s.left(3) != "uml") && (s.left(3) != "xmi")))) {
UmlClass * cl = findStereotype(s, FALSE);
if (cl != 0) {
const Q3PtrVector<UmlItem> ch = cl->children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1) {
UmlItem * x = ch[i];
if ((x->kind() == aRelation) &&
(((UmlRelation *) x)->relationKind() == aDirectionalAssociation) &&
(((UmlRelation *) x)->roleType()->stereotype() == "metaclass"))
base_v.append("base_" + ((UmlRelation *) x)->roleType()->name().lower());
}
if (base_v.isEmpty())
base_v.append("base_element");
prof_st = cl->parent()->parent()->name() + ":" + cl->name();
stereotypes.insert(s, new WrapperStr(prof_st));
bases.insert(s, new Q3ValueList<WrapperStr>(base_v));
return TRUE;
}
}
}
return FALSE;
}
示例2: compute
//.........这里部分代码省略.........
else if (cl->isCppExternal())
{
QString className = cl->name();
hform = cl->cppDecl();
int index;
if ((index = hform.find('\n')) == -1)
// wrong form
continue;
hform = hform.mid(index + 1) + '\n';
for (;;) {
if ((index = hform.find("${name}")) != -1)
hform.replace(index, 7, cl->name());
else if ((index = hform.find("${Name}")) != -1)
hform.replace(index, 7, capitalize(cl->name()));
else if ((index = hform.find("${NAME}")) != -1)
hform.replace(index, 7, cl->name().upper());
else if ((index = hform.find("${nAME}")) != -1)
hform.replace(index, 7, cl->name().lower());
else
break;
}
srcform = hform;
}
else {
QString className = cl->name();
WrapperStr st = cl->cpp_stereotype();
if ((st == "enum") || (st == "typedef"))
included = TRUE;
UmlArtifact * art = cl->associatedArtifact();
if (art != 0) {
if (art == who)
// don't include itself
continue;
if (CppSettings::includeWithPath()) {
UmlPackage * p = art->package();
hform = "#include \"" + p->header_path(art->name(), hdir) + "\"\n";
srcform = "#include \"" + p->header_path(art->name(), srcdir) + "\"\n";
}
else
srcform = hform = "#include \"" + art->name() + '.' +
CppSettings::headerExtension() + "\"\n";
}
else if (cl->parent()->kind() != aClass) {
write_trace_header();
UmlCom::trace(WrapperStr(" <font color=\"red\"><b> class<i> ") + cl->name() +
"</i> referenced but does not have associated <i>artifact</i></b></font><br>");
incr_warning();
continue;
}
}
if (included) {
// #include must be placed in the header file
if ((h_incl.find(hform) == -1) && (hdef.find(hform) == -1))
h_incl += hform;
}
else if ((cl != 0) &&
(cl->parent()->kind() != aClass)) { // else too complicated
// #include useless in header file, place it in the source file
if ((src_incl.find(srcform) == -1) && (h_incl.find(hform) == -1) &&
(hdef.find(hform) == -1) && (srcdef.find(srcform) == -1))
src_incl += srcform;
if (!cl->isCppExternal()) {
// header file must contains the declaration
hform = cl->decl();
if (decl.find(hform) == -1)
decl += hform;
if ((cl->associatedArtifact() == 0) &&
(cl->parent()->kind() != aClass)) {
write_trace_header();
UmlCom::trace(WrapperStr(" <font color=\"red\"><b> class<i> ") + cl->name() +
"</i> referenced but does not have associated <i>artifact</i></b></font><br>");
incr_warning();
}
}
}
else if (!hform.isEmpty()) {
// have the #include form but does not know if it is a class or other,
// generate the #include in the header file EXCEPT if the #include is
// already in the header/source file to allow to optimize the generated
// code
if ((src_incl.find(srcform) == -1) && (h_incl.find(hform) == -1) &&
(hdef.find(hform) == -1) && (srcdef.find(srcform) == -1))
h_incl += hform;
}
}
}