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


C++ UmlRelation::set_CppDecl方法代码示例

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


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

示例1: new_friend

bool UmlRelation::new_friend(Class * container, UmlClass * to,
			     Q3PtrList<UmlItem> & expected_order)
{
  UmlClass * from = container->get_uml();
  
#ifdef DEBUG_BOUML
  cout << "FRIEND from '" << from->name() << "' to '" << to->name() << "'\n";
#endif
  
  const Q3PtrVector<UmlItem> & ch = from->children();
  UmlItem ** v = ch.data();
  UmlItem ** const vsup = v + ch.size();
  
  for (;v != vsup; v += 1) {
    if (((*v)->kind() == aRelation) &&
	(((UmlRelation *) *v)->relationKind() == aDependency) &&
	(((UmlRelation *) *v)->roleType() == to) &&
	!neq((*v)->stereotype(), "friend")) {
      expected_order.append(*v);
      ((UmlRelation *) *v)->set_usefull();
      return TRUE;
    }
  }

  // relation not found
  
  UmlRelation * rel = UmlBaseRelation::create(aDependency, from, to);
  
  if (rel == 0) {
    UmlCom::trace(Q3CString("<font face=helvetica><b>cannot add friend relation in <i>")
		  + from->name() + "</i> to <i>"
		  + to->name() + "</i></b></font><br><hr><br>");  
    return FALSE;
  }
  
  expected_order.append(rel);
  container->set_updated();
  
  rel->set_CppDecl("Generated");
  
  return rel->set_Stereotype("friend");
}
开发者ID:SciBoy,项目名称:douml,代码行数:42,代码来源:UmlRelation.cpp

示例2: new_one


//.........这里部分代码省略.........
	st_uml = st;
      
      if (neq(rel->stereotype(), st_uml)) {
	rel->set_Stereotype(st_uml);
	container->set_updated();
      }
    }
    else
#endif
      rel->set_Stereotype((st_uml.isEmpty()) ? st : st_uml);
    
    int index2;
    
    if ((index2 = decl.find("<${type}>")) == -1) {
      decl = "    ${comment}${static}${mutable}${volatile}${const}${stereotype}<${type}> ${name}${value};";
      index2 = decl.find("<${type}>");
    }
    decl.replace(index2, 9, typeform.mid(index));
  }
  else {
    if (!array.isEmpty()) {
#ifdef ROUNDTRIP
    if (roundtrip) {
      if (neq(rel->multiplicity(), array)) {
	rel->set_Multiplicity(array);
	container->set_updated();
      }
    }
    else
#endif
      rel->set_Multiplicity(array);
    }
    decl = CppSettings::relationDecl(modifier != "*", array);
    
    int index;
    
    if (!pretype.isEmpty() &&
	((index = decl.find("${type}")) != 0))
      decl.insert(index,(const char*)( pretype + " "));
    
    if ((modifier == "&") && ((index = decl.find("${type}")) != 0))
      decl.insert(index + 7, " &");
  }
  
  if (! value.isEmpty()) {
    int index = decl.find("${value}");
    
    if (index != -1)
      decl.insert(index + 2,  "h_");
    
#ifdef ROUNDTRIP
    if (roundtrip) {
      if (!staticp) {
	Q3CString v = rel->defaultValue();
	
	if (!v.isEmpty() && (((const char *) v)[0] == '='))
	  v = v.mid(1);
	
	if (nequal(v, value)) {
	  rel->set_DefaultValue(value);
	  container->set_updated();
	}
      }
    }
    else
#endif
      rel->set_DefaultValue(value);
  }
  
#ifdef ROUNDTRIP
  if (roundtrip) {
    if (neq(rel->cppDecl(), decl)) {
      rel->set_CppDecl(decl);
      container->set_updated();
    }
    
    if (decl.find("${description}") != -1) {
      if (nequal(rel->description(), description)) {
	rel->set_Description(description);
	container->set_updated();
      }
    }
    else if (nequal(rel->description(), Lex::simplify_comment(comment))) {
      rel->set_Description(comment); // comment was set
      container->set_updated();
    }
    
    // role name is the right one
    return TRUE;
  }
#endif

  rel->set_CppDecl(decl);
  
  if (!comment.isEmpty())
    rel->set_Description((decl.find("${description") != -1)
			 ? description : Lex::simplify_comment(comment));
  
  return rel->set_RoleName(name);
}
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:UmlRelation.cpp

示例3: set_unidir

void UmlRelation::set_unidir() {
  UmlRelation * r1 = side(TRUE);
  UmlRelation * r2 = (r1 != this) ? this : side(FALSE);
  
  if (r1->isReadOnly() || r2->isReadOnly()) {
    UmlCom::trace(Q3CString("<font face=helvetica>in <i>") + Q3CString(Lex::filename().toAscii().constData())
		  + "</i> line " + Q3CString().setNum(Lex::line_number())
		  + " <b>cannot remove relation between classes <i>"
		  + roleType()->name() + "</i> and <i>" + parent()->name()
		  + "</i> because one is read only</b></font><br>");
    throw 0;
  }
  
  aRelationKind k;
  
  switch (relationKind()) {
  case anAssociation:
    k = aDirectionalAssociation;
    break;
  case anAggregation:
    k = aDirectionalAggregation;
    break;
  default:
    k = aDirectionalAggregationByValue;
  }
  
  if (this == r1)
    set_rel_kind(k);
  else {
    UmlRelation * rel = 
      UmlBaseRelation::create(aDirectionalAssociation,
			      (UmlClass *) parent(), roleType());
    Q3CString role = roleName();
    
    rel->moveAfter(this);
    rel->set_Visibility(visibility());
    if (!description().isEmpty())
      rel->set_Description(description());
    if (isReadOnly())
      rel->set_isReadOnly(TRUE);
    if (isVolatile())
      rel->set_isVolatile(TRUE);
    if (isClassMember())
      rel->set_isClassMember(TRUE);
    if (!multiplicity().isEmpty())
      rel->set_Multiplicity(multiplicity());
    if (!defaultValue().isEmpty())
      rel->set_DefaultValue(defaultValue());
    if (!stereotype().isEmpty())
      rel->set_Stereotype(stereotype());
    rel->set_CppDecl(cppDecl());
    rel->set_CppVisibility(cppVisibility());
    if (cppVirtualInheritance())
      rel->set_CppVirtualInheritance(TRUE);
    if (isCppMutable())
      rel->set_isCppMutable(TRUE);
    
    UmlOperation * op;
    UmlOperation * oper;
    
    if (((op = getOperation()) != 0) &&
	rel->addGetOperation() &&
	((oper = rel->getOperation()) != 0))
      copy(op, oper);
    
    if (((op = setOperation()) != 0) &&
	rel->addSetOperation() &&
	((oper = rel->getOperation()) != 0))
      copy(op, oper);
      
    r1->deleteIt();
    r2->deleteIt();
    
    rel->set_RoleName(role);
  }
}
开发者ID:SciBoy,项目名称:douml,代码行数:76,代码来源:UmlRelation.cpp

示例4: manage_inherit


//.........这里部分代码省略.........
                }
                else if (!get_actuals(mother.type, container, tmplts
#ifdef ROUNDTRIP
                                      , !is_new
#endif
                                     ))
                    return FALSE;

#ifdef ROUNDTRIP

                if (! is_new) {
                    if (neq(rel->stereotype(), "bind")) {
                        rel->set_Stereotype("bind");
                        the_class->set_updated();
                    }
                }
                else
#endif
                    rel->set_Stereotype("bind");

                s = Lex::read_word();
            }
        }

        if (mother.type == 0) {
            mother.type = auxilarily_typedef(mother_name
#ifdef REVERSE
                                             , libp
# ifdef ROUNDTRIP
                                             , container_roundtrip
                                             , container_expected_order
# endif
#endif
                                            );

            if (mother.type == 0)
                return FALSE;
        }

#ifdef ROUNDTRIP

        if (rel == 0)
            is_new = !roundtrip || ((rel = search_for_inherit(mother.type)) == 0);

#endif

        if ((rel == 0) &&
            ((rel = UmlBaseRelation::create(aGeneralisation, this, mother.type)) == 0)) {
            Lex::warn("cannot inherit <font color =\"red\">" +
                      Lex::quote(mother_name) + " </font>");
#ifdef DEBUG_DOUML
            QLOG_INFO() << "cannot create <|---\n";
#endif
            return FALSE;
        }

#ifdef ROUNDTRIP
        expected_order.append(rel);

        if (!is_new) {
            rel->set_usefull();

            if (neq(rel->cppDecl(), "${type}")) {
                rel->set_CppDecl("${type}");
                the_class->set_updated();
            }

            if (rel->visibility() != v) {
                rel->set_Visibility(v);
                the_class->set_updated();
            }

            if (is_virtual != rel->cppVirtualInheritance()) {
                rel->set_CppVirtualInheritance(is_virtual);
                the_class->set_updated();
            }
        }
        else {
#elif defined(REVERSE)
        Statistic::one_relation_more();
#endif
            rel->set_CppDecl("${type}");
            rel->set_Visibility(v);

            if (is_virtual)
                rel->set_CppVirtualInheritance(TRUE);

#ifdef ROUNDTRIP
        }

#endif

        if (s == ",")
            s = Lex::read_word();
    }

    Lex::unread_word();	// '{'

    return TRUE;
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:101,代码来源:UmlClass.cpp


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