本文整理汇总了C++中UmlItem类的典型用法代码示例。如果您正苦于以下问题:C++ UmlItem类的具体用法?C++ UmlItem怎么用?C++ UmlItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UmlItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: search_rel
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;
}
}
示例2: search_attr
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;
}
示例3: switch
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);
}
}
}
}
}
示例4: sort
void UmlOperation::generate_index()
{
unsigned n = opers.size();
if (n != 0) {
sort(opers);
start_file("public_operations", "Public Operations Index", TRUE);
fw.write("<table>\n");
fw.write("<tr bgcolor=\"#f0f0f0\"><td align=\"center\"><b>Operation</b></td><td align=\"center\"><b>Class</b></td><td align=\"center\"><b>Description</b></td></tr>\n");
for (unsigned i = 0; i != n; i += 1) {
UmlItem * op = opers.elementAt(i);
fw.write("<tr bgcolor=\"#f0f0f0\"><td>");
op->write();
fw.write("</td><td>");
op->parent()->write();
fw.write("</td><td>");
writeq(op->description());
fw.write("</td></tr>\n");
}
fw.write("</table>\n");
end_file();
}
}
示例5: associatedArtifact
void UmlClass::import(QTextOStream & f, const QCString & indent) {
QCString s;
if (!isJavaExternal()) {
UmlArtifact * cp = associatedArtifact();
UmlPackage * pack = (UmlPackage *)
((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package();
if ((s = pack->javaPackage()).isEmpty())
return;
QCString s2 = name();
UmlItem * p = this;
while ((p = p->parent())->kind() == aClass)
s2 = p->name() + dot + s2;
s += dot + s2;
}
else if ((s = package()->javaPackage()).isEmpty())
return;
else
s += dot + name();
if (! UmlArtifact::generated_one()->is_imported(s)) {
f << indent << "import " << s << ";\n";
UmlArtifact::generated_one()->imported(s);
}
}
示例6: generalizeDependRealize
void UmlClass::generalizeDependRealize(UmlItem * target, FileIn & in, int context, WrapperStr label, WrapperStr constraint)
{
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 * 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)
in.warning(r[context].err + name() + "' to '" + target->name() + "'");
else {
if (! label.isEmpty())
rel->set_Name(label);
if (! constraint.isEmpty() && (target->kind() == aClass))
((UmlRelation *) rel)->set_Constraint(constraint);
}
}
示例7: add_init
void UmlExtraClassMember::add_init(UmlClass * cl, WrapperStr def, bool roundtrip,
QList<UmlItem *> & expected_order)
{
if (roundtrip) {
const QVector<UmlItem*> & ch = cl->children();
UmlItem *const* v = ch.data();
UmlItem *const* vsup = v + ch.size();
UmlItem * x;
for (; v != vsup; v += 1) {
if (((x = *v)->kind() == anExtraClassMember) &&
((UmlExtraClassMember *) x)->is_useless() &&
(x->name() == "initialization")) {
expected_order.append(x);
if (neq(((UmlExtraClassMember *) x)->javaDecl(), def)) {
((UmlExtraClassMember *) x)->set_JavaDecl(def);
cl->get_class()->set_updated();
}
((UmlExtraClassMember *) x)->set_usefull();
return;
}
}
}
UmlExtraClassMember * x =
UmlExtraClassMember::create(cl, "initialization");
x->set_JavaDecl(def);
expected_order.append(x);
}
示例8: 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;
}
示例9: key_
void UmlItem::manage_alias(const char *& p, QTextStream & ts)
{
// p starts by '@'
const char * pclosed;
if ((p[1] == '{') && ((pclosed = strchr(p + 2, '}')) != 0)) {
QByteArray key_(p + 2, pclosed - p - 1);
WrapperStr key = key_;
WrapperStr value;
UmlItem * node = this;
do {
if (node->propertyValue(key, value))
break;
node = node->parent();
}
while (node != 0);
if (node != 0)
// find, insert the value
ts << value;
else
// not find, insert the key
ts << "@{" << key << '}';
// bypass the key
p += strlen(key) + 3;
}
else
// bypass '$'
ts << toLocale(p);
}
示例10: 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;
}
示例11: key
void UmlItem::manage_alias(const char *& p, QTextOStream & ts,
Q3CString indent, BooL & indent_needed) {
if (indent_needed) {
indent_needed = FALSE;
ts << indent;
}
// p starts by '@'
const char * pclosed;
if ((p[1] == '{') && ((pclosed = strchr(p + 2, '}')) != 0)) {
Q3CString key(p + 2, pclosed - p - 1);
Q3CString value;
UmlItem * node = this;
do {
if (node->propertyValue(key, value))
break;
node = node->parent();
} while (node != 0);
if (node != 0)
// find, insert the value
ts << value;
else
// not find, insert the key
ts << "@{" << key << '}';
// bypass the key
p += strlen(key) + 3;
}
else
// bypass '$'
ts << *p++;
}
示例12: 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;
}
示例13: while
UmlPackage * UmlArtifact::package() {
UmlItem * parent = this->parent();
while (parent->kind() != aPackage)
parent = parent->parent();
return (UmlPackage *) parent;
}
示例14: 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;
}
示例15: write_stereotyped
void UmlItem::write_stereotyped(FileOut & out)
{
QMap<QString, Q3PtrList<UmlItem> >::Iterator it;
for (it = _stereotypes.begin(); it != _stereotypes.end(); ++it) {
const char * st = it.key();
UmlClass * cl = UmlClass::findStereotype(it.key(), TRUE);
if (cl != 0) {
Q3ValueList<WrapperStr> extended;
cl->get_extended(extended);
Q3PtrList<UmlItem> & l = it.data();
UmlItem * elt;
for (elt = l.first(); elt != 0; elt = l.next()) {
out << "\t<" << st;
out.id_prefix(elt, "STELT_");
const Q3Dict<WrapperStr> props = elt->properties();
Q3DictIterator<WrapperStr> itp(props);
while (itp.current()) {
QString k = itp.currentKey();
if (k.contains(':') == 2) {
out << " ";
out.quote((const char *)k.mid(k.findRev(':') + 1)); //[jasa] ambiguous call
out << "=\"";
out.quote((const char *)*itp.current());
out << '"';
}
++itp;
}
Q3ValueList<WrapperStr>::Iterator iter_extended;
for (iter_extended = extended.begin();
iter_extended != extended.end();
++iter_extended) {
WrapperStr vr = "base_" + *iter_extended;
out.ref(elt, vr);
}
out << "/>\n";
elt->unload();
}
}
}
}