Пример #1
0
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;
}
Пример #2
0
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;
}