当前位置: 首页>>代码示例>>C++>>正文


C++ UmlItem::parent方法代码示例

本文整理汇总了C++中UmlItem::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlItem::parent方法的具体用法?C++ UmlItem::parent怎么用?C++ UmlItem::parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UmlItem的用法示例。


在下文中一共展示了UmlItem::parent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
  }
}
开发者ID:SciBoy,项目名称:douml,代码行数:48,代码来源:UmlRelation.cpp

示例2: manage_alias

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);
}
开发者ID:javrillon,项目名称:douml,代码行数:33,代码来源:UmlItem.cpp

示例3: import

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);
  }
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例4: 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);
	}
      }
    }
  }
}
开发者ID:SciBoy,项目名称:douml,代码行数:28,代码来源:UmlRelation.cpp

示例5: generate_index

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();
    }

}
开发者ID:gilbertoca,项目名称:douml,代码行数:30,代码来源:UmlOperation.cpp

示例6: manage_alias

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++;
}
开发者ID:SciBoy,项目名称:douml,代码行数:35,代码来源:UmlItem.cpp

示例7: while

UmlPackage * UmlArtifact::package() {
  UmlItem * parent = this->parent();
  
  while (parent->kind() != aPackage)
    parent = parent->parent();
  
  return (UmlPackage *) parent;
}
开发者ID:SciBoy,项目名称:douml,代码行数:8,代码来源:UmlArtifact.cpp

示例8: roseImport

void UmlPackage::roseImport()
{
    QString s = QFileDialog::getOpenFileName(0, "" ,QString::null, "*.mdl");

    if (!s.isEmpty()) {
        File f(s, "");

        if (! f.open(QIODevice::ReadOnly)) {
            UmlCom::trace(QString("<br>cannot open " + s).toLatin1().constData());
            throw 0;
        }

        UmlItem * prj = this;

        while (prj->parent() != 0)
            prj = prj->parent();

        prj->set_childrenVisible(FALSE);

        try {
            UmlCom::message("Phase 1");
            scanning = TRUE;

            while (import(f))
                ;

            scanning = FALSE;
            UmlCom::message("Phase 2");
            f.rewind();

            while (import(f))
                ;
        }
        catch (...) {
            set_childrenVisible(TRUE);
            throw 0;
        }

        set_childrenVisible(TRUE);
    }
}
开发者ID:DoUML,项目名称:douml,代码行数:41,代码来源:UmlPackage.cpp

示例9: 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());
  }
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:51,代码来源:UmlClass.cpp

示例10: set_under_construction

void UmlClass::set_under_construction(bool y, bool rec)
{
    if (y) {
        if (rec) {
            UmlItem * it = this;

            do {
                UnderConstruction.append((UmlClass *) it);
            }
            while ((it = it->parent())->kind() == aClass);
        }
        else
            UnderConstruction.append(this);
    }
    else if (rec)
        UnderConstruction.clear();
    else
        UnderConstruction.removeOne(this);
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:19,代码来源:UmlClass.cpp

示例11: main

int main(int argc, char ** argv)
{
  if (argc != 2)
      return 0;
  
  if (UmlCom::connect(Q3CString(argv[1]).toUInt())) {
    bool aborted = TRUE;
    
    try {
      UmlCom::trace("<b>C++ roundtrip</b> release 1.3<br>");
      UmlCom::traceAutoRaise(FALSE);
      
      char * argv = 0;
      int argc = 0;
      QApplication * app = new QApplication(argc, &argv);
      UmlItem * item = UmlCom::targetItem();
      int n;

      switch (item->kind()) {
      default:
	UmlCom::trace("<font face=helvetica><b>must be applied on a <i>package, class view, deployment view, artifact</i> or <i>class</i></b></font><br>");
	aborted = FALSE;
	throw 0;
      case aPackage:
	n = ((UmlPackage *) item)->count_roundtriped();
	break;
      case aClassView:
      case aDeploymentView:
      case anArtifact:
	n = 1;
	break;
      case aClass:
	if (item->parent()->kind() != aClassView) {
	  UmlCom::trace("<font face=helvetica><b>can't be applied on a <i>class</i> nested or out of a <i>class view</i></b></font><br>");
	  aborted = FALSE;
	  throw 0;
	}
	n = 1;
	break;
      }

      UmlPackage * project = UmlPackage::getProject();
      
      UmlCom::trace("<font face=helvetica>Upload project ...</font>");
      Package::init(project, app);
      UmlCom::trace("<font face=helvetica>...done</font><br>");
      UmlCom::message("");
      Package::set_step(0, n);
      
      UmlCom::trace("<font face=helvetica>Preparation...</font>");
      if (!item->set_roundtrip_expected() &&
	  (QMessageBox::warning(0, "Roundtrip",
				"Some elements to roundtrip are read-only and will not be updated\n\n"
				"Roundtrip anyway ?",
				"Yes", "No", QString::null, 1, 1)
	   != 0)) {
	aborted = FALSE;
	throw 0;
      }
      
      Package::set_step(0, -1);
      UmlCom::trace("<font face=helvetica>...done</font><br>");
      
      if ((item->kind() == aPackage) && !UmlArtifact::is_roundtrip_usefull()) {
	UmlCom::trace("<font face=helvetica>you don't ask for to roundtrip artifact(s)<br><br>"
		      "probably you want to do a <i>reverse</i> rather than a <i>roundtrip</i></font><br>");
	aborted = FALSE;
	throw 0;
      }
	
      Q3CString f;
	
      if (project->propertyValue("#file", f))
	Lex::defines(f);
	         
      n = 0;
      item->scan_it(n);
      CppSettings::set_UseDefaults(TRUE);
      project->set_childrenVisible(FALSE);
      item->send_it(n);
      UmlOperation::force_defs();
      Statistic::produce();
      
      // umark all
      {
	Q3PtrVector<UmlItem> marked = UmlItem::markedItems();
	UmlItem ** v = marked.data();
	UmlItem ** const vsup = v + marked.size();
	
	for (;v != vsup; v += 1)
	  (*v)->set_isMarked(FALSE);
      }
      
      Q3PtrList<UmlItem> useless;
      
      item->mark_useless(useless);
      
      if (!useless.isEmpty() &&
	  (QMessageBox::warning(0, "C++ roundtrip",
				"The marked elements are useless because they don't\n"
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:main.cpp

示例12: generate

void UmlTransition::generate(Q3PtrList<UmlTransition> trs, UmlClass * machine, UmlClass * anystate, UmlState * state, Q3CString & body, Q3CString indent, bool completion)
{
    UmlTransition * tr;
    bool guard = FALSE;

    for (tr = trs.first(); tr != 0; tr = trs.next()) {
        body += indent;

        if (!tr->cppGuard().isEmpty()) {
            // manage guard
            body += ((tr == trs.getFirst()) ? "if (" : "else if (")
                    + tr->cppGuard() + ") {\n";
            guard = TRUE;
        }
        else
            // no gard : it is the last transition, may be the first
            body += ((tr == trs.getFirst()) ? "{\n" : "else {\n");

        // the target state
        UmlItem * tg = tr->target();
        bool self_external = (state == tg) && tr->isExternal();

        while (tg->kind() != aState)
            tg = tg->parent();

        // the parent common to the current and the target state
        UmlState * common = state;

        if (self_external) {
            // execute exit behavior
            if (!state->cppExitBehavior().isEmpty())
                body += indent + "  _doexit(stm);\n";
        }
        else {
            bool fromExit =
                // the exit behavior is made entering in the exit point
                (tr->parent()->kind() == anExitPointPseudoState);

            // compute common parent and manage exit behavior
            if (tr->target()->kind() != aTerminatePseudoState) {
                while (!((UmlState *) tg)->inside(common)) {
                    if (!fromExit && !common->cppExitBehavior().isEmpty())
                        body += indent + "  stm" + common->path() + "._doexit(stm);\n";

                    fromExit = FALSE;

                    switch (common->parent()->kind()) {
                    case aState:
                        common = (UmlState *) common->parent();
                        break;

                    case aRegion:
                        common = (UmlState *) common->parent()->parent();
                        break;

                    default:
                        UmlCom::trace("Error : transition from '" + state->name()
                                      + "' goes outside the state machine");
                        throw 0;
                    }
                }
            }
        }

        // manage transition activity
        if (!tr->cppActivity().isEmpty())
            body += "#ifdef VERBOSE_STATE_MACHINE\n" + indent +
                    "  puts(\"DEBUG : execute activity of transition " + tr->name() +
                    "\");\n#endif\n" + tr->cppActivity();

        // manage entry behavior
        if (self_external) {
            if (state->needCreate())
                body += indent + "  create(stm);\n";
        }
        else if (tr->target()->kind() != aTerminatePseudoState) {
            if (tg != common) {
                Q3CString enter;
                UmlState * tg_parent;

                // the enter behavior of the target state will be managed
                // generating a call to create
                for (tg_parent = (UmlState *) tg->parent();
                     tg_parent != common;
                     tg_parent = (UmlState *) tg_parent->parent())
                    if (!tg_parent->cppEntryBehavior().isEmpty())
                        enter.insert(0,
                                     (const char *)(indent + "  stm" + tg_parent->path() + "._doentry(stm);\n")); //[rageek] ambiguous

                if (!enter.isEmpty())
                    body += enter;
            }

            // set the current state if needed
            if (tg != state)
                body += indent + "  stm._set_currentState(stm"
                        + ((UmlState *) tg)->path() + ");\n#ifdef VERBOSE_STATE_MACHINE\n" +
                        indent + "  puts(\"DEBUG : current state is now " + ((UmlState *) tg)->prettyPath() +
                        "\");\n#endif\n";
        }
//.........这里部分代码省略.........
开发者ID:bleakxanadu,项目名称:douml,代码行数:101,代码来源:UmlTransition.cpp


注:本文中的UmlItem::parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。