本文整理汇总了C++中Q3PtrList::findRef方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrList::findRef方法的具体用法?C++ Q3PtrList::findRef怎么用?C++ Q3PtrList::findRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3PtrList
的用法示例。
在下文中一共展示了Q3PtrList::findRef方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
}
}
示例3: change_rel
bool ClassInstanceData::change_rel(ToolCom * com, const char * args,
bool isadd) {
com->get_unsigned(args); // 2
BrowserRelation * r = (BrowserRelation *) com->get_id(args);
BrowserClassInstance * other = (BrowserClassInstance *) com->get_id(args);
if (r->deletedp() || other->deletedp()) {
com->write_ack(FALSE);
return FALSE;
}
RelationData * rd = (RelationData *) r->get_data();
Q3ValueList<SlotRel>::Iterator it;
for (it = relations.begin(); it != relations.end(); ++it) {
const SlotRel & slot_rel = *it;
if ((slot_rel.value == other) &&
(r == ((slot_rel.is_a) ? rd->get_start() : rd->get_end())))
break;
}
if (isadd) {
if (it == relations.end()) {
// not yet present
Q3PtrList<BrowserRelation> l;
cl->get_rels(((ClassInstanceData *)other->get_data())->cl, l);
if ((l.findRef(r) == -1) ||
(!other->is_writable() && !root_permission())) {
// illegal
com->write_ack(FALSE);
return FALSE;
}
// add it
if (rd->is_a(r))
add(other, rd);
else
((ClassInstanceData *)other->get_data())
->add((BrowserClassInstance *) browser_node, rd);
}
}
else if (it != relations.end()) {
// remove it
if (!other->is_writable() && !root_permission()) {
// illegal
com->write_ack(FALSE);
return FALSE;
}
replace(other, rd, 0, (*it).is_a, 0);
}
return TRUE;
}
示例4: 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);
}
示例5: 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);
}
}
}
示例6: check_rels
void ClassInstanceData::check_rels() {
bool modif = FALSE;
Q3ValueList<SlotRel>::Iterator it_rel = relations.begin();
while (it_rel != relations.end()) {
const SlotRel & slot_rel = *it_rel;
BasicData * d = slot_rel.value->get_data();
bool remove = slot_rel.value->deletedp();
if (!remove) {
RelationData * rd = (RelationData *) slot_rel.rel;
BrowserClass * other = (slot_rel.is_a)
? rd->get_end_class() : rd->get_start_class();
BrowserClass * cl = ((ClassInstanceData *) d)->get_class();
if (cl == 0) {
// instance doesn't exist
// note : its brower_node will be deleted
remove = TRUE;
}
else if (cl != other) {
Q3PtrList<BrowserClass> l;
cl->get_all_parents(l);
remove |= (l.findRef(other) == -1);
}
}
if (remove) {
it_rel = relations.remove(it_rel);
modif = TRUE;
}
else
++it_rel;
}
if (modif)
modified();
}
示例7: tool_cmd
bool ClassInstanceData::tool_cmd(ToolCom * com, const char * args,
BrowserNode * bn, const QString & comment) {
if (((unsigned char) args[-1]) >= firstSetCmd) {
if (!bn->is_writable() && !root_permission())
com->write_ack(FALSE);
else {
switch ((unsigned char) args[-1]) {
case setTypeCmd:
set_class((BrowserClass *) com->get_id(args));
break;
case setAttributeCmd:
{
BrowserAttribute * at = (BrowserAttribute *) com->get_id(args);
bool find = FALSE;
Q3ValueList<SlotAttr>::Iterator it_attr;
for (it_attr = attributes.begin(); it_attr != attributes.end(); ++it_attr) {
SlotAttr & slot_attr = *it_attr;
if (slot_attr.att == at) {
find = TRUE;
if (*args == 0)
// remove it
attributes.remove(it_attr);
else
// replace it
slot_attr.value = args;
break;
}
}
if (! find) {
// add it
Q3PtrList<BrowserClass> l;
cl->get_all_parents(l);
l.append(cl);
if (at->deletedp() ||
(l.findRef((BrowserClass *) at->parent()) == -1)) {
// illegal
com->write_ack(FALSE);
return TRUE;
}
attributes.append(SlotAttr(at, args));
}
}
break;
case addRelationCmd:
if (! change_rel(com, args, TRUE))
return TRUE;
break;
case removeRelationCmd:
if (! change_rel(com, args, FALSE))
return TRUE;
break;
default:
return BasicData::tool_cmd(com, args, bn, comment);
}
// ok case
bn->modified();
modified();
com->write_ack(TRUE);
}
}
else {
switch ((unsigned char) args[-1]) {
case attributesCmd:
if (args[0] == 0) {
com->write_unsigned(attributes.count());
Q3ValueList<SlotAttr>::Iterator it;
for (it = attributes.begin(); it != attributes.end(); ++it) {
const SlotAttr & slot = *it;
slot.att->write_id(com);
com->write_string(slot.value);
}
}
else {
// get all available attributes
BrowserNodeList l;
BrowserNode * bn;
cl->get_attrs(l);
com->write_unsigned(l.count());
for (bn = l.first(); bn != 0; bn = l.next())
bn->write_id(com);
}
break;
case relationsCmd:
{
BrowserClassInstance * other =
(BrowserClassInstance *) com->get_id(args);
if (other == 0) {
com->write_unsigned(relations.count());
//.........这里部分代码省略.........
示例8: check
void ClassInstanceData::check() {
if ((cl == 0) || // deleted class instance referenced in a diagram
cl->deletedp())
browser_node->delete_it();
else if (!attributes.isEmpty() || !relations.isEmpty()) {
bool modif = FALSE;
Q3PtrList<BrowserClass> l;
cl->get_all_parents(l);
l.append(cl);
// check attributes
Q3ValueList<SlotAttr>::Iterator it_attr = attributes.begin();
while (it_attr != attributes.end()) {
const SlotAttr & slot_attr = *it_attr;
if (slot_attr.att->deletedp() ||
(l.findRef((BrowserClass *) slot_attr.att->parent()) == -1)) {
// must be removed
it_attr = attributes.remove(it_attr);
modif = TRUE;
}
else {
// change on attribute modify class => memorize classes only
BasicData * cld = ((BrowserNode *) slot_attr.att->parent())->get_data();
if (connect_list.findRef(cld) == -1) {
connect_list.append(cld);
connect(cld, SIGNAL(changed()), this, SLOT(check()));
connect(cld, SIGNAL(deleted()), this, SLOT(check()));
}
++it_attr;
}
}
// check relations (only this side, check also called on other class instance)
Q3ValueList<SlotRel>::Iterator it_rel = relations.begin();
while (it_rel != relations.end()) {
const SlotRel & slot_rel = *it_rel;
BrowserRelation * br = (slot_rel.is_a)
? ((slot_rel.rel->get_start()->deletedp())
? (BrowserRelation *) 0
: slot_rel.rel->get_start())
: (((RelationData::uni_directional(slot_rel.rel->get_type())) ||
slot_rel.rel->get_end()->deletedp())
? (BrowserRelation *) 0
: slot_rel.rel->get_end());
if (br == 0) {
// relation deleted, must be removed
it_rel = relations.remove(it_rel);
modif = TRUE;
}
else if (l.findRef((BrowserClass *) br->parent()) == -1) {
// new instance type, must be removed in both side
if (slot_rel.value->get_data() != this) {
// not reflexive
Q3ValueList<SlotRel> & other_rels =
((ClassInstanceData *) slot_rel.value->get_data())->relations;
Q3ValueList<SlotRel>::Iterator it_rel_other;
for (it_rel_other = other_rels.begin();
it_rel_other != other_rels.end();
it_rel_other++) {
const SlotRel & other_slot_rel = *it_rel_other;
if ((other_slot_rel.value == browser_node) &&
(other_slot_rel.rel == slot_rel.rel)) {
other_rels.remove(it_rel_other);
break;
}
}
}
it_rel = relations.remove(it_rel);
modif = TRUE;
}
else {
// change on relation modify class => memorize classes only
BasicData * d;
d = ((BrowserNode *) br->parent())->get_data();
if (connect_list.findRef(d) == -1) {
connect_list.append(d);
connect(d, SIGNAL(changed()), this, SLOT(check()));
connect(d, SIGNAL(deleted()), this, SLOT(check()));
}
d = slot_rel.value->get_data();
if (connect_list.findRef(d) == -1) {
connect_list.append(d);
connect(d, SIGNAL(changed()), this, SLOT(check_rels()));
connect(d, SIGNAL(deleted()), this, SLOT(check_rels()));
}
//.........这里部分代码省略.........