本文整理汇总了C++中UmlItem::kind方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlItem::kind方法的具体用法?C++ UmlItem::kind怎么用?C++ UmlItem::kind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlItem
的用法示例。
在下文中一共展示了UmlItem::kind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: search_class_assoc
void UmlRelation::search_class_assoc() {
if (side(TRUE) != this)
return;
switch (relationKind()) {
case aGeneralisation:
case aRealization:
case aDependency:
break;
default:
{
UmlTypeSpec a = association();
if (a.type != 0) {
// not generated for actors
UmlItem * p = parent();
if (p->stereotype() != "actor") {
do {
p = p->parent();
} while (p->kind() == aClass);
if (p->kind() == aClassView)
_assoc_class = a.type->set_assoc(this);
}
}
}
}
}
示例2: write
void UmlRelation::write(FileOut & out, bool inside) {
switch (relationKind()) {
case aGeneralisation:
if (inside)
write_generalization(out);
break;
case aRealization:
if (inside)
parent()->memo_relation(this);
else
write_realization(out);
break;
case aDependency:
if (inside)
parent()->memo_relation(this);
else
write_dependency(out);
break;
default:
// don't generate them for actors
{
UmlItem * p = parent();
if (p->stereotype() == "actor")
return;
do {
p = p->parent();
} while (p->kind() == aClass);
UmlItem * op = roleType();
if (op->stereotype() == "actor")
return;
do {
op = op->parent();
} while (op->kind() == aClass);
if ((p->kind() == aClassView) && (op->kind() == aClassView)) {
if (inside)
write_relation_as_attribute(out);
else
// note : it is the first side
write_relation(out);
}
}
break;
}
}
示例3: if
UmlAttribute * UmlAttribute::search_attr(UmlClass * cl, const Q3CString & name)
{
UmlItem * x = cl->search_for_att_rel(name);
if (x == 0)
return 0;
else if (x->kind() == anAttribute)
return (UmlAttribute *) x;
switch (((UmlRelation *) x)->relationKind()) {
case aDirectionalAssociation:
case aDirectionalAggregation:
case aDirectionalAggregationByValue:
x->deleteIt();
break;
case anAssociation:
case anAggregation:
case anAggregationByValue:
if (x == ((UmlRelation *) x)->side(TRUE))
((UmlRelation *) x)->side(FALSE)->set_unidir();
else
((UmlRelation *) x)->set_unidir();
break;
default:
break;
}
return 0;
}
示例4: if
static UmlAttribute * search_attr(Class * container, const WrapperStr & name)
{
UmlItem * x = container->get_uml()->search_for_att_rel(name);
if (x == 0)
return 0;
else if (x->kind() == anAttribute)
return (UmlAttribute *) x;
switch (((UmlRelation *) x)->relationKind()) {
case aDirectionalAssociation:
case aDirectionalAggregation:
case aDirectionalAggregationByValue:
x->deleteIt();
break;
case anAssociation:
case anAggregation:
case anAggregationByValue:
if (x == ((UmlRelation *) x)->side(TRUE))
((UmlRelation *) x)->side(FALSE)->set_unidir();
else
((UmlRelation *) x)->set_unidir();
break;
default:
break;
}
return 0;
}
示例5: parent
UmlClass * UmlClass::addMetaclass(WrapperStr mclname, const char * mclpath)
{
UmlPackage * pack = (UmlPackage *) parent()->parent(); // is a package
const Q3PtrVector<UmlItem> ch = pack->children();
unsigned n = ch.size();
UmlClass * r = 0;
for (unsigned i = 0; i != n; i += 1) {
UmlItem * x = ch[i];
if ((x->kind() == aClassView) &&
!strncmp(x->name(), "meta classes", 12) &&
((r = UmlClass::create(x, mclname)) != 0))
break;
}
if (r == 0) {
WrapperStr s = "meta classes";
UmlItem * v = 0;
while ((v = UmlClassView::create(pack, s)) == 0)
s += "_";
r = UmlClass::create(v, mclname);
}
r->set_Stereotype("metaclass");
if (mclpath != 0)
r->set_PropertyValue("metaclassPath", mclpath);
return r;
}
示例6: it
UmlItem * UmlClass::search_for_att_rel(const WrapperStr & name)
{
const QVector<UmlItem*> & ch = UmlItem::children();
QVectorIterator<UmlItem*> it(ch);
while(it.hasNext())
{
UmlItem* item = it.next();
switch (item->kind()) {
case anAttribute:
if (item->name() == name)
return item;
break;
case aRelation:
if (((UmlRelation *) item)->roleName() == name)
return item;
break;
default:
break;
}
}
return 0;
}
示例7: if
static UmlRelation * search_rel(Class * container, const WrapperStr & name,
UmlClass * dest, const WrapperStr & st)
{
UmlItem * x = container->get_uml()->search_for_att_rel(name);
if (x == 0)
return 0;
else if (x->kind() == anAttribute) {
((UmlAttribute *) x)->deleteIt();
return 0;
}
else {
UmlRelation * r1 = ((UmlRelation *) x)->side(TRUE);
UmlRelation * r2 = (r1 != x)
? ((UmlRelation *) x)
: ((UmlRelation *) x)->side(FALSE);
if ((((UmlRelation *) x)->roleType() == dest) &&
((r2 == 0) ||
st.isEmpty() ||
(((UmlRelation *) x)->stereotype() == st) ||
(((x == r1) ? r2 : r1)->javaDecl().find("${stereotype}") == -1)))
return (UmlRelation *) x;
// rel target or new stereotype not compatible with other side
if (x != r1)
r1->set_unidir();
else if (r2 == 0)
r1->deleteIt();
else
r2->set_unidir();
return 0;
}
}
示例8: while
UmlPackage * UmlArtifact::package() {
UmlItem * parent = this->parent();
while (parent->kind() != aPackage)
parent = parent->parent();
return (UmlPackage *) parent;
}
示例9: main
int main(int argc, char ** argv)
{
if (argc != 2)
return 0;
if (UmlCom::connect(QCString(argv[1]).toUInt())) {
try {
//UmlCom::with_ack(FALSE);
UmlCom::trace("<b>C++ reverse</b> release 2.15<br>");
UmlCom::traceAutoRaise(FALSE);
UmlItem * item = UmlCom::targetItem();
if (item->kind() != aPackage)
UmlCom::trace("<font face=helvetica><b>must be applied on a <i>package</i></b></font><br><hr><br>");
else {
char * argv = 0;
int argc = 0;
QApplication * app = new QApplication(argc, &argv);
Package::init((UmlPackage *) item, app);
QCString f;
if (UmlPackage::getProject()->propertyValue("#file", f))
Lex::defines(f);
// add c++ catalog like java ?
int n;
Package::scan_dirs(n);
if (n != 0) {
CppSettings::set_UseDefaults(TRUE);
Package::send_dirs(n, TRUE);
Statistic::produce();
}
}
}
catch (...) {
}
try {
// socket may be already closed
UmlCom::message("");
UmlCom::showTrace();
UmlCom::bye(0); // application must not be deleted
}
catch (...) {
}
}
UmlCom::close();
return 0;
}
示例10: write
void UmlArtifact::write(FileOut & out)
{
const char * k = (_uml_20) ? "ownedMember" : "packagedElement";
out.indent();
out << "<" << k << " xmi:type=\"uml:Artifact\"";
out.id(this);
out << " name=\"";
out.quote((const char *)name()); //[jasa] ambiguous call
out << "\">\n";
out.indent(+1);
write_description_properties(out);
const Q3PtrVector<UmlItem> ch = children();
unsigned i;
unsigned n = ch.size();
unsigned rank = 0;
for (i = 0; i != n; i += 1) {
UmlItem * x = ch[i];
if ((x->kind() == aNcRelation) &&
(x->stereotype() == "manifest") &&
(((UmlNcRelation *) x)->relationKind() == aDependency))
write_manifest(out, ((UmlNcRelation *) x)->target(), "dependency", ++rank);
else
ch[i]->write(out);
}
if (stereotype() == "source") {
const Q3PtrVector<UmlClass> & cls = associatedClasses();
n = cls.size();
for (i = 0; i != n; i += 1)
write_manifest(out, cls[i], "source", ++rank);
}
else {
const Q3PtrVector<UmlArtifact> & arts = associatedArtifacts();
n = arts.size();
for (i = 0; i != n; i += 1)
write_manifest(out, arts[i], 0, ++rank);
}
out.indent(-1);
out.indent();
out << "</" << k << ">\n";
unload();
}
示例11: solveGeneralizationDependencyRealization
void UmlClass::solveGeneralizationDependencyRealization(int context, WrapperStr idref, WrapperStr label, WrapperStr constraint)
{
QMap<QString, UmlItem *>::Iterator it = All.find(idref);
if (it != All.end()) {
static const struct {
aRelationKind rk;
const char * err;
} r[] = {
{ aGeneralisation, "cannot create generalization from '" },
{ aDependency, "cannot create dependency from '" },
{ aRealization, "cannot create realization from '" },
{ aDependency, "cannot create usage from '" },
{ aDependency, "cannot create import from '" }
};
UmlItem * target = *it;
UmlItem * rel;
if (target->kind() == aClass)
rel = UmlRelation::create(r[context].rk, this, (UmlClass *) target);
else
rel = UmlNcRelation::create(r[context].rk, this, target);
if (rel == 0)
UmlCom::trace(r[context].err + name() + "' to '" + target->name() + "'<br>");
else {
if (!label.isEmpty())
rel->set_Name(label);
if (!constraint.isEmpty() && (target->kind() == aClass))
((UmlRelation *) rel)->set_Constraint(constraint);
if (context == 3)
rel->set_Stereotype("use");
}
}
else if (!FileIn::isBypassedId(idref))
UmlCom::trace("relation : unknown target reference '" + idref + "'<br>");
}
示例12: if
void UmlClass::uml2java(bool rec) {
if (isJavaExternal())
set_JavaDecl(JavaSettings::externalClassDecl());
else {
QCString st = JavaSettings::classStereotype(stereotype());
UmlItem * pack = parent()->parent();
while (pack->kind() != aPackage)
pack = pack->parent();
if ((st == "stereotype") ||
(st == "metaclass") ||
(pack->stereotype() == "profile")) {
set_CppDecl("");
return;
}
if (st == "enum_pattern")
set_JavaDecl(JavaSettings::enumPatternDecl());
else if (st == "enum")
set_JavaDecl(JavaSettings::enumDecl());
else if (st == "interface")
set_JavaDecl(JavaSettings::interfaceDecl());
else if (st == "@interface") {
QCString s = JavaSettings::interfaceDecl();
int index = s.find("interface");
if (index != -1)
s.insert(index, '@');
set_JavaDecl(s);
}
else if (st == "ignored") {
set_JavaDecl("");
return;
}
else
set_JavaDecl(JavaSettings::classDecl());
if (rec) {
const QVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2java(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_JavaSource(JavaSettings::sourceContent());
}
}
示例13: 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;
}
示例14: solveManifestation
void UmlArtifact::solveManifestation(WrapperStr s, WrapperStr idref)
{
QMap<WrapperStr, UmlItem *>::Iterator it = All.find(idref);
if (it == All.end()) {
if (!FileIn::isBypassedId(idref))
UmlCom::trace("manifestation : unknown utilized element reference '" + idref + "'<br>");
return;
}
UmlItem * target = *it;
if (!FromBouml || (s != "dependency")) {
switch (target->kind()) {
case aClass:
if (s != "source")
break;
else if (stereotype().isEmpty())
set_Stereotype("source");
else if (stereotype() != "source")
break;
addAssociatedClass((UmlClass *) target);
return;
case anArtifact:
if (!FromBouml)
break;
addAssociatedArtifact((UmlArtifact *) target);
return;
default:
break;
}
}
UmlNcRelation * rel = UmlNcRelation::create(aDependency, this, target);
if (rel == 0)
UmlCom::trace("cannot create manifestation from '" + name() +
"' to '" + target->name() + "'");
else
rel->set_Stereotype("manifest");
}
示例15: subArtifacts
void UmlPackage::subArtifacts(QList<UmlArtifact *> &l, QByteArray name, QByteArray deplview_name)
{
UmlDeploymentView * deplview;
foreach (deplview, _deplviews){
if (deplview->baseName() == deplview_name) {
const QVector<UmlItem*> ch = deplview->children();
int i;
for (i = 0; i != ch.size(); i += 1) {
UmlItem * it = ch[i];
if ((it->kind() == anArtifact) && (it->name() == name))
l.append((UmlArtifact *) it);
}
}
}
}