本文整理汇总了C++中Q3PtrList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrList::append方法的具体用法?C++ Q3PtrList::append怎么用?C++ Q3PtrList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3PtrList
的用法示例。
在下文中一共展示了Q3PtrList::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_inherit
// check inheritance
QString BrowserNode::check_inherit(const BrowserNode * new_parent) const {
Q3PtrList<BrowserNode> all_parents;
Q3PtrList<BrowserNode> notyet = parents();
if (notyet.findRef(new_parent) != -1)
return TR("already generalize / realize");
notyet.append(new_parent);
do {
BrowserNode * cl = notyet.getFirst();
notyet.removeFirst();
if (cl == this)
return TR("can't have circular generalization / realization");
if (all_parents.findRef(cl) == -1) {
all_parents.append(cl);
Q3PtrList<BrowserNode> grand_parents = cl->parents();
for (cl = grand_parents.first(); cl; cl = grand_parents.next())
if (notyet.findRef(cl) == -1)
notyet.append(cl);
}
} while (! notyet.isEmpty());
return 0;
}
示例2: update_actuals
void ClassData::update_actuals(BrowserClass * parent,
Q3PtrList<ActualParamData> & new_actuals,
Q3PtrList<ActualParamData> & managed)
{
if (((BrowserNode *) parent->parent())->get_type() == UmlClass)
update_actuals((BrowserClass *) parent->parent(), new_actuals, managed);
ActualParamData * actual;
int n = ((ClassData *) parent->get_data())->nformals;
if (n != 0) {
// search the first associated actual
for (actual = actuals.first(); actual != 0; actual = actuals.next()) {
if ((actual->get_class() == parent) &&
(managed.findRef(actual) == -1))
// find;
break;
}
int nth = 0;
// progress on still present formals
while (actual && (nth < n) && (actual->get_class() == parent)) {
// actual ok
new_actuals.append(actual);
managed.append(actual);
actual = actuals.next();
nth += 1;
}
if (nth < n) {
// adds necessary actuals
if (nth == 0) {
// new inheritance
connect(parent->get_data(), SIGNAL(deleted()),
this, SLOT(update_actuals()));
connect(parent->get_data(), SIGNAL(changed()),
this, SLOT(update_actuals()));
}
do {
new_actuals.append(new ActualParamData(parent, nth));
nth += 1;
}
while (nth != n);
}
}
}
示例3: get_actuals
void ClassData::get_actuals(Q3PtrList<ActualParamData> & l, BrowserClass * parent)
{
if (((BrowserNode *) parent->parent())->get_type() == UmlClass)
get_actuals(l, (BrowserClass *) parent->parent());
ActualParamData * actual;
int n = ((ClassData *) parent->get_data())->nformals;
if (n != 0) {
// search the first associated actual
for (actual = actuals.first(); actual != 0; actual = actuals.next()) {
if ((actual->get_class() == parent) &&
(l.findRef(actual) == -1))
// find;
break;
}
int nth = 0;
// progress on still present formals
while (actual && (nth < n) && (actual->get_class() == parent)) {
// actual ok
l.append(actual);
actual = actuals.next();
nth += 1;
}
}
}
示例4: generate
void UmlJunctionPseudoState::generate(UmlClass * machine, UmlClass * anystate, UmlState * state) {
// create an operation because a priori shared
if (_oper.isEmpty())
_oper.sprintf("_junction%d", ++_rank);
UmlClass * cl = state->assocClass();
UmlOperation * junction;
if (((junction = (UmlOperation *) cl->getChild(anOperation, _oper)) == 0) &&
((junction = UmlBaseOperation::create(cl, _oper)) == 0)) {
UmlCom::trace("Error : cannot create operation '" + _oper
+ "' in class '" + cl->name() + "'<br>");
throw 0;
}
junction->defaultDef();
junction->setComment("implement a junction, through an operation because shared, internal");
junction->setType("void", "${type}");
junction->addParam(0, InputOutputDirection, "stm", machine);
junction->setParams("${t0} & ${p0}");
Q3CString body;
const Q3PtrVector<UmlItem> ch = children();
Q3PtrList<UmlTransition> trs;
unsigned index;
for (index = 0; index != ch.count(); index += 1)
if (ch[index]->kind() == aTransition)
// theo mandatory
trs.append((UmlTransition *) ch[index]);
UmlTransition::generate(trs, machine, anystate, state, body, " ", FALSE);
junction->set_CppBody(body);
}
示例5: send
void SubjectCanvas::send(ToolCom * com, Q3CanvasItemList & all)
{
Q3PtrList<SubjectCanvas> subjects;
Q3CanvasItemList::Iterator cit;
for (cit = all.begin(); cit != all.end(); ++cit) {
DiagramItem *di = QCanvasItemToDiagramItem(*cit);
if ((di != 0) &&
(*cit)->visible() &&
(di->type() == UmlSubject))
subjects.append((SubjectCanvas *) di);
}
com->write_unsigned(subjects.count());
SubjectCanvas * sc;
for (sc = subjects.first(); sc != 0; sc = subjects.next()) {
Q3CString s = fromUnicode(sc->name);
com->write_string((const char *) s);
com->write(sc->rect());
}
}
示例6: mark_useless
void UmlArtifact::mark_useless(Q3PtrList<UmlItem> & l) {
if (useless) {
set_isMarked(TRUE);
parent()->set_childrenVisible(TRUE);
l.append(this);
}
}
示例7: extend
void UmlClass::extend(WrapperStr mcl)
{
if (parent()->parent()->kind() != aPackage)
return;
int index = mcl.find('#');
if (index == -1)
return;
WrapperStr path = mcl.left(index);
const char * defltpath0 = "http://schema.omg.org/spec/UML/2.0/uml.xml";
const char * defltpath1 = "http://schema.omg.org/spec/UML/2.1/uml.xml";
bool dflt = ((path == defltpath0) || (path == defltpath1));
mcl = mcl.mid(index + 1);
static Q3PtrList<UmlClass> metaclasses;
Q3PtrListIterator<UmlClass> it(metaclasses);
UmlClass * metacl = UmlClass::get(mcl, 0);
WrapperStr s;
if ((metacl == 0) ||
(metacl->stereotype() != "metaclass") ||
!((dflt) ? (!metacl->propertyValue("metaclassPath", s) ||
(s == defltpath0) ||
(s == defltpath1))
: (metacl->propertyValue("metaclassPath", s) &&
(path == s)))) {
metacl = 0;
if (dflt) {
for (; (metacl = it.current()) != 0; ++it) {
if (!strcmp(mcl, metacl->name()) &&
(!metacl->propertyValue("metaclassPath", s) ||
(s == defltpath0) ||
(s == defltpath1)))
break;
}
}
else {
for (; (metacl = it.current()) != 0; ++it) {
if (!strcmp(mcl, metacl->name()) &&
metacl->propertyValue("metaclassPath", s) &&
(path == s))
break;
}
}
if (metacl == 0) {
metacl = addMetaclass(mcl, (dflt) ? 0 : (const char *)path); //[rageek] different types for ? :
metaclasses.append(metacl);
}
}
UmlRelation::create(aDirectionalAssociation, this, metacl);
}
示例8: 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");
}
示例9: generate
void UmlTransition::generate(UmlClass * machine, UmlClass * anystate, UmlState * state, Q3CString & body, Q3CString indent)
{
if (!cppTrigger().isEmpty()) {
UmlCom::trace("Error : transition from a pseudo state can't have trigger<br>");
throw 0;
}
Q3PtrList<UmlTransition> l;
l.append(this);
generate(l, machine, anystate, state, body, indent, FALSE);
}
示例10: compute_referenced_by
void BrowserSimpleRelation::compute_referenced_by(Q3PtrList<BrowserNode> & l,
BrowserNode * target)
{
IdIterator<BrowserSimpleRelation> it(all);
while (it.current()) {
if (!it.current()->deletedp() &&
(it.current()->def->get_end_node() == target))
l.append(it.current());
++it;
}
}
示例11: unconsistent_fixed
void BrowserNode::unconsistent_fixed(const char * what, BrowserNode * newone) {
UnconsistencyFixedMsg += QString("<li>") + what + QString(" <i>") +
quote(full_name()) + QString("</i> and <i>") +
quote(newone->full_name()) + QString("</i></li>\n");
BrowserNode * bn = this;
while (bn->get_type() != UmlPackage)
bn = (BrowserNode *) bn->parent();
if (ModifiedPackages.findRef(bn) == -1)
ModifiedPackages.append(bn);
}
示例12: QString
void tst_Q3PtrList::removeType()
{
Q3PtrList<QString> items;
items.append(new QString("first"));
QString *second = new QString("second");
items.append(second);
QString *third = new QString("third");
items.append(third);
QString *fourth = new QString("fourth");
items.append(fourth);
QVERIFY(items.current() == fourth);
items.setAutoDelete(FALSE);
// this test an undocumented feature of remove( NULL )
// in QGList::remove if the ptr is 0 it removes the current item
// ie. it removes the fourth item from the list in this case
QString *nullPointer = NULL;
items.remove( nullPointer );
QVERIFY(items.count() == 3);
QVERIFY(items.current() == third);
// this tests that remove updates the current item also
// when it removes the _end_ item in the list
items.remove(third);
QVERIFY(items.current() == second);
// test that the removed items are not in the list, then deletes them
QVERIFY(third && items.find(third) == -1 );
QVERIFY(fourth && items.find(fourth) == -1);
delete third;
delete fourth;
fourth = third = 0;
items.setAutoDelete(TRUE);
}
示例13: view
UmlCanvas::UmlCanvas(CanvasFormat f, BrowserDiagram * br_diag)
: Q3Canvas(formatSize[f].w, formatSize[f].h),
br_diagram(br_diag), view(0), all_items((const char *) 0) {
width100percent = width();
height100percent = height();
do_paste = FALSE;
hlimit = 0;
vlimit = 0;
set_zoom(1); // set do_scale
do_scale = FALSE;
br_diag->update_drawing_settings();
show_shadow = br_diag->get_shadow();
draw_all_relations = br_diag->get_draw_all_relations();
All.append(this);
}
示例14: compute_referenced_by
void BrowserRelation::compute_referenced_by(Q3PtrList<BrowserNode> & l,
BrowserClass * target)
{
IdIterator<BrowserRelation> it(all);
BrowserRelation * r;
while ((r = it.current()) != 0) {
if (!r->deletedp() &&
(((r->def->is_a(it.current()))
? (r->def->get_end_class() == target)
: (r->def->get_start_class() == target))
|| (r->def->get_association().type == target)))
l.append(r);
++it;
}
}
示例15: switch
// returns all parents for NON class
Q3PtrList<BrowserNode> BrowserNode::parents() const {
Q3PtrList<BrowserNode> l;
Q3ListViewItem * child;
for (child = firstChild(); child != 0; child = child->nextSibling()) {
BrowserNode * ch = ((BrowserNode *) child);
switch (ch->get_type()) {
case UmlInherit:
if (!ch->deletedp())
l.append(((SimpleRelationData *) ch->get_data())
->get_end_node());
default:
break;
}
}
return l;
}