void tst_Q3ValueList::clear() { Q3ValueList<int> a; a.append( 1 ); a.append( 2 ); a.append( 3 ); a.clear(); QVERIFY( a.isEmpty() ); }
void UmlBaseClassInstance::relationsValue(Q3ValueList<SlotRelation> & result) { UmlCom::send_cmd(_identifier, relationsCmd, (void *) 0); unsigned n = UmlCom::read_unsigned(); result.clear(); while (n--) { UmlRelation * r = (UmlRelation *) UmlBaseItem::read_(); result.append(SlotRelation(r, (UmlClassInstance *) UmlBaseItem::read_())); } }
void UmlBaseClassInstance::attributesValue(Q3ValueList<SlotAttribute> & result) { UmlCom::send_cmd(_identifier, attributesCmd, (char) 0); unsigned n = UmlCom::read_unsigned(); result.clear(); while (n--) { UmlAttribute * at = (UmlAttribute *) UmlBaseItem::read_(); result.append(SlotAttribute(at, UmlCom::read_string())); } }
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; }
void tst_Q3ValueList::size() { Q3ValueList<int> a; QCOMPARE( (int)a.size(), 0 ); a.append( 1 ); QCOMPARE( (int)a.size(), 1 ); a.append( 2 ); QCOMPARE( (int)a.size(), 2 ); a.append( 3 ); QCOMPARE( (int)a.size(), 3 ); a.clear(); QCOMPARE( (int)a.size(), 0 ); }
void UmlClass::get_extended(Q3ValueList<WrapperStr> & r) { r.clear(); const Q3PtrVector<UmlItem> ch = children(); unsigned n = ch.size(); unsigned i; for (i = 0; i != n; i += 1) { UmlItem * x = ch[i]; if ((x->kind() == aRelation) && (((UmlRelation *) x)->relationKind() == aDirectionalAssociation) && (((UmlRelation *) x)->roleType()->stereotype() == "metaclass")) r.append(((UmlRelation *) x)->roleType()->name()); } if (r.isEmpty()) r.append("Element"); }