本文整理汇总了C++中BrowserNode::get_data方法的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNode::get_data方法的具体用法?C++ BrowserNode::get_data怎么用?C++ BrowserNode::get_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserNode
的用法示例。
在下文中一共展示了BrowserNode::get_data方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drop
// the relation is not yet drawn,
void SimpleRelationCanvas::drop(BrowserNode * bn, UmlCanvas * canvas,
Q3PtrDict<DiagramItem> & drawn)
{
SimpleRelationData * def = (SimpleRelationData *) bn->get_data();
BrowserNode * from = def->get_start_node();
BrowserNode * to = def->get_end_node();
DiagramItem * ccfrom = drawn[from->get_data()];
DiagramItem * ccto = drawn[to->get_data()];
if ((ccfrom != 0) && (ccto != 0)) {
SimpleRelationCanvas * rel =
new SimpleRelationCanvas(canvas, ccfrom, ccto, from,
bn->get_type(), 0, -1.0, -1.0, def);
rel->show();
rel->package_modified();
drawn.replace(def, rel);
// package set modified by caller
}
}
示例2: check_inherit
// just check if the inheritance already exist
QString BrowserArtifact::check_inherit(const BrowserNode * new_parent) const
{
BrowserNode * child;
for (child = firstChild(); child != 0; child = child->nextSibling()) {
BrowserNode * ch = ((BrowserNode *) child);
if ((ch->get_type() == UmlInherit) &&
((((SimpleRelationData *) ch->get_data())->get_end_node())
== new_parent))
return QObject::tr("already exist");
}
return (new_parent != this) ? QString() : QObject::tr("circular inheritance");
}
示例3: 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;
}
示例4: search_ddb
void BrowserNodeList::search_ddb(BrowserNode * bn, UmlCode k, const QString & s,
bool cs, bool even_deleted)
{
Q3ListViewItem * child;
for (child = bn->firstChild(); child != 0; child = child->nextSibling()) {
if (even_deleted || !((BrowserNode *) child)->deletedp()) {
BrowserNode * ch = (BrowserNode *) child;
if (((k == UmlCodeSup) ||
((k == UmlRelations)
? IsaRelation(ch->get_type())
: (ch->get_type() == k))) &&
(s.isEmpty() ||
ch->get_data()->decldefbody_contain(s, cs, ch)))
append(ch);
search_ddb(ch, k, s, cs, even_deleted);
}
}
}
示例5: menu_op
void CodChangeMsgDialog::menu_op()
{
QMenu m(0);
MenuFactory::addItem(m, tr("Choose"), -1);
m.addSeparator();
int index = list.indexOf(edoper->currentText().trimmed());
if (index != -1)
MenuFactory::addItem(m, tr("Select in browser"), 0);
BrowserNode * bn = BrowserView::selected_item();
if ((bn != 0) &&
(bn->get_type() == UmlOperation) &&
!bn->deletedp() &&
(opers.indexOf((OperationData *) bn->get_data()) != -1))
MenuFactory::addItem(m, tr("Choose operation selected in browser"), 1);
else
bn = 0;
if (cl != 0)
MenuFactory::addItem(m, tr("Create operation and choose it"), 2);
if ((index != -1) || (bn != 0) || (cl != 0)) {
QAction* retAction = m.exec(QCursor::pos());
if(retAction)
{
switch (retAction->data().toInt()) {
case 0:
opers[index]->get_browser_node()->select_in_browser();
break;
case 2:
bn = cl->add_operation();
if (bn == 0)
return;
bn->select_in_browser();
// no break
case 1: {
OperationData * od = (OperationData *) bn->get_data();
if ((index = opers.indexOf(od)) == -1) {
index = opers.count();
opers.append(od);
QString s = od->definition(TRUE, FALSE);
list.append(s);
edoper->addItem(s);
}
}
edoper->setCurrentIndex(index + 1);
}
}
}
}
示例6: add_related_elements
void ComponentDiagramView::add_related_elements(DiagramItem * di, QString what,
bool inh, bool assoc) {
BrowserNodeList l;
RelatedElementsDialog dialog(di->get_bn(), what, inh, assoc, l);
dialog.raise();
if (dialog.exec() == QDialog::Accepted) {
QApplication::setOverrideCursor(Qt::waitCursor);
DiagramItemList items(canvas()->allItems());
Q3PtrDict<DiagramItem> drawn;
get_drawn(items, drawn);
history_save();
history_protected = TRUE;
int xmax = canvas()->width() - Diagram_Margin;
int ymax = canvas()->height() - Diagram_Margin;
QRect re = di->rect();
int x = re.x();
int y = re.bottom() + Diagram_Margin;
int future_y = y;
Q3PtrListIterator<BrowserNode> it(l);
BrowserNode * bn;
for (; (bn = it.current()) != 0; ++it) {
if (drawn[bn->get_data()] == 0) {
DiagramCanvas * dc;
switch (bn->get_type()) {
case UmlComponent:
dc = new ComponentCanvas(bn, the_canvas(), x, y);
break;
case UmlPackage:
dc = new PackageCanvas(bn, the_canvas(), x, y, 0);
break;
default:
continue;
}
drawn.replace(dc->get_bn()->get_data(), dc);
if ((x + dc->width()) > xmax)
dc->move(x = Diagram_Margin, y = future_y);
if (y + dc->height() > ymax) {
dc->move(x = Diagram_Margin, y = Diagram_Margin);
future_y = y + dc->height() + Diagram_Margin;
}
else {
int bot = y + dc->height() + Diagram_Margin;
if (bot > future_y)
future_y = bot;
}
x = x + dc->width() + Diagram_Margin;
dc->show();
dc->upper();
}
}
canvas()->update();
history_protected = FALSE;
window()->package_modified();
QApplication::restoreOverrideCursor();
}
}
示例7: add_marked_elements
void ComponentDiagramView::add_marked_elements(const QPoint& p,
Q3PtrDict<DiagramItem> & drawn) {
QApplication::setOverrideCursor(Qt::waitCursor);
history_save();
history_protected = TRUE;
int xmax = canvas()->width() - Diagram_Margin;
int ymax = canvas()->height() - Diagram_Margin;
int x = p.x();
int y = p.y();
int future_y = y;
const Q3PtrList<BrowserNode> & l = BrowserNode::marked_nodes();
Q3PtrListIterator<BrowserNode> it(l);
BrowserNode * bn;
for (; (bn = it.current()) != 0; ++it) {
if (drawn[bn->get_data()] == 0) {
DiagramCanvas * dc;
switch (bn->get_type()) {
case UmlComponent:
dc = new ComponentCanvas(bn, the_canvas(), x, y);
break;
case UmlPackage:
dc = new PackageCanvas(bn, the_canvas(), x, y, 0);
break;
default:
continue;
}
drawn.replace(dc->get_bn()->get_data(), dc);
if ((x + dc->width()) > xmax)
dc->move(x = Diagram_Margin, y = future_y);
if (y + dc->height() > ymax) {
dc->move(x = Diagram_Margin, y = Diagram_Margin);
future_y = y + dc->height() + Diagram_Margin;
}
else {
int bot = y + dc->height() + Diagram_Margin;
if (bot > future_y)
future_y = bot;
}
x = x + dc->width() + Diagram_Margin;
dc->show();
dc->upper();
}
}
UmlCanvas * cnv = (UmlCanvas *) canvas();
if (! cnv->must_draw_all_relations()) {
for (it.toFirst(); (bn = it.current()) != 0; ++it) {
if ((drawn[bn->get_data()] == 0) &&
IsaSimpleRelation(bn->get_type()))
SimpleRelationCanvas::drop(bn, cnv, drawn);
}
}
canvas()->update();
history_protected = FALSE;
window()->package_modified();
QApplication::restoreOverrideCursor();
}
示例8: mousePressEvent
//.........这里部分代码省略.........
case ShallowHistoryPS:
case JunctionPS:
case ChoicePS:
case ForkPS:
case JoinPS: {
history_protected = TRUE;
unselect_all();
window()->selectOn();
history_save();
QGraphicsItem * ci = the_canvas()->collision(scenePoint.toPoint());
DiagramItem * di;
bool specified = ((ci != 0) &&
((di = QCanvasItemToDiagramItem(ci)) != 0) &&
(di->typeUmlCode() == UmlState) &&
((BrowserState *)((StateCanvas *) di)->get_bn())->may_contains(action));
BrowserNode * parent;
if (specified) {
if ((parent = ((StateCanvas *) di)->pointed_region(scenePoint.toPoint())) == 0)
parent = ((StateCanvas *) di)->get_bn();
}
else
parent = (BrowserNode *) window()->browser_diagram()->parent();
BrowserNode * b = BrowserPseudoState::get_pseudostate(parent, action);
if (b != 0) {
PseudoStateCanvas * c =
// may be added in a the state's region rather than the state
new PseudoStateCanvas(b, the_canvas(), scenePoint.x(), scenePoint.y());
c->show();
c->upper();
StateCanvas::force_inside(c, FALSE);
window()->package_modified();
}
}
break;
case UmlStateAction:
case UmlSignalIn:
case UmlSignalOut: {
history_protected = TRUE;
unselect_all();
window()->selectOn();
history_save();
QGraphicsItem * ci = the_canvas()->collision(scenePoint.toPoint());
DiagramItem * di;
bool specified = ((ci != 0) &&
((di = QCanvasItemToDiagramItem(ci)) != 0) &&
(di->typeUmlCode() == UmlState) &&
((BrowserState *)((StateCanvas *) di)->get_bn())->may_contains(UmlStateAction));
BrowserNode * parent;
if (specified) {
if ((parent = ((StateCanvas *) di)->pointed_region(scenePoint.toPoint())) == 0)
parent = ((StateCanvas *) di)->get_bn();
}
else
parent = (BrowserNode *) window()->browser_diagram()->parent();
BrowserNode * b = BrowserStateAction::add_stateaction(parent);
switch (action) {
case UmlSignalIn:
((StateActionData *) b->get_data())->set_stereotype("receive-signal");
break;
case UmlSignalOut:
((StateActionData *) b->get_data())->set_stereotype("send-signal");
break;
default: // to avoid warning
break;
}
StateActionCanvas * c =
// may be added in a the state's region rather than the state
new StateActionCanvas(b, the_canvas(), scenePoint.x(), scenePoint.y());
c->show();
c->upper();
StateCanvas::force_inside(c, FALSE);
window()->package_modified();
}
break;
default:
DiagramView::mousePressEvent(e);
return;
}
canvas()->update();
history_protected = FALSE;
}
else
DiagramView::mousePressEvent(e);
}
示例9: if
UcClassCanvas * UcClassCanvas::read(char * & st, UmlCanvas * canvas, char * k)
{
if (!strcmp(k, "classcanvas_ref"))
return ((UcClassCanvas *) dict_get(read_id(st), "classcanvas", canvas));
else if (!strcmp(k, "classcanvas")) {
int id = read_id(st);
BrowserNode * br = BrowserClass::read_ref(st);
UcClassCanvas * result;
if (read_file_format() < 52) {
read_keyword(st, "xyz");
int x = (int) read_double(st);
result =
new UcClassCanvas(br, canvas, x, (int) read_double(st), id);
result->setZ(read_double(st));
// move the actor in its initial position
x = ACTOR_CANVAS_SIZE - result->width();
if (x < 0)
result->Q3CanvasRectangle::moveBy(x/2, 0);
k = read_keyword(st);
read_double(st);
read_double(st);
if (!strcmp(k, "label_xyz"))
// old version
read_double(st);
else if (strcmp(k, "label_xy"))
wrong_keyword(k, "label_xy/label_xyz");
}
else {
result = new UcClassCanvas(canvas, id);
result->browser_node = br;
connect(br->get_data(), SIGNAL(changed()), result, SLOT(modified()));
connect(br->get_data(), SIGNAL(deleted()), result, SLOT(deleted()));
k = read_keyword(st);
result->settings.read(st, k); // updates k
read_color(st, "color", result->itscolor, k); // updates k
if (strcmp(k, "xyz"))
wrong_keyword(k, "xyz");
read_xyz(st, result);
result->compute_size();
if ((read_file_format() < 72) &&
(result->used_view_mode == asInterface)) {
result->settings.class_drawing_mode = asClass;
result->compute_size();
}
if (read_file_format() >= 58) {
k = read_keyword(st);
result->read_stereotype_property(st, k);
if (strcmp(k, "end"))
wrong_keyword(k, "end");
}
}
result->set_center100();
result->show();
result->check_stereotypeproperties();
return result;
}
else
return 0;
}
示例10: dropEvent
//.........这里部分代码省略.........
break;
case 4:
bn = BrowserActivityAction::add_remove_variable_value(container(p), bn);
break;
default:
return;
}
if (bn != 0) {
history_save();
history_protected = TRUE;
ActivityActionCanvas * c =
new ActivityActionCanvas(bn, the_canvas(), p.x(), p.y());
history_protected = TRUE;
c->show();
(void) ActivityContainerCanvas::force_inside(c, FALSE);
history_protected = TRUE;
canvas()->update();
history_protected = FALSE;
window()->package_modified();
}
}
else if ((bn = UmlDrag::decode(e, UmlClass)) != 0) {
history_protected = FALSE;
BrowserActivityObject * obj =
BrowserActivityObject::add_activityobject(container(p), 0);
if (obj != 0) {
((ActivityObjectData *) obj->get_data())->set_type((BrowserClass *) bn);
history_save();
history_protected = TRUE;
ActivityObjectCanvas * c =
new ActivityObjectCanvas(obj, the_canvas(), p.x(), p.y());
history_protected = TRUE;
c->show();
(void) ActivityContainerCanvas::force_inside(c, FALSE);
history_protected = TRUE;
canvas()->update();
history_protected = FALSE;
window()->package_modified();
}
}
else if ((bn = UmlDrag::decode(e, UmlClassInstance)) != 0) {
history_protected = FALSE;
BrowserActivityObject * obj =
BrowserActivityObject::add_activityobject(container(p), bn->get_name());
if (obj != 0) {
((ActivityObjectData *) obj->get_data())
->set_type(((ClassInstanceData *) bn->get_data())->get_class());
history_save();
history_protected = TRUE;
ActivityObjectCanvas * c =
new ActivityObjectCanvas(obj, the_canvas(), p.x(), p.y());
history_protected = TRUE;
c->show();
(void) ActivityContainerCanvas::force_inside(c, FALSE);
history_protected = TRUE;
canvas()->update();
history_protected = FALSE;
window()->package_modified();
}
}
else if ((bn = UmlDrag::decode(e, UmlState, TRUE)) != 0) {
history_protected = FALSE;
bn = BrowserActivityAction::add_call_behavior(container(p), bn);
if (bn != 0) {
history_save();
history_protected = TRUE;
ActivityActionCanvas * c =
new ActivityActionCanvas(bn, the_canvas(), p.x(), p.y());
history_protected = TRUE;
c->show();
(void) ActivityContainerCanvas::force_inside(c, FALSE);
history_protected = TRUE;
canvas()->update();
history_protected = FALSE;
window()->package_modified();
}
}
}
示例11: accept
void RelatedElementsDialog::accept() {
bool inh = (inh_rb != 0) && inh_rb->isChecked();
bool dep = dep_rb->isChecked();
bool assoc = (assoc_rb != 0) && assoc_rb->isChecked();
if (!inh && !dep && !assoc)
return;
bool sametype = sametype_rb->isChecked();
UmlCode k = elt->get_type();
elts.clear();
Q3PtrDict<BrowserNode> d(71);
BrowserNodeList added;
int lvl = sb_level->value();
added.append(elt);
d.insert(elt, elt);
do {
BrowserNodeList newones;
Q3PtrListIterator<BrowserNode> it(added);
for (; it.current() != 0; ++it) {
BrowserNode * e = (BrowserNode *) it.current();
BrowserNode * bn;
if (referenced_rb->isChecked()) {
for (bn = (BrowserNode *) e->firstChild();
bn != 0;
bn = (BrowserNode *) bn->nextSibling()) {
if (! bn->deletedp()) {
BrowserNode * target;
switch (bn->get_type()) {
case UmlAssociation:
case UmlDirectionalAssociation:
case UmlAggregation:
case UmlAggregationByValue:
case UmlDirectionalAggregation:
case UmlDirectionalAggregationByValue:
if (! assoc) continue;
target = ((RelationData *) bn->get_data())->get_end_class();
break;
case UmlDependency:
if (! dep) continue;
target = ((RelationData *) bn->get_data())->get_end_class();
break;
case UmlGeneralisation:
case UmlRealize:
if (! inh) continue;
target = ((RelationData *) bn->get_data())->get_end_class();
break;
case UmlDependOn:
if (! dep) continue;
target = ((SimpleRelationData *) bn->get_data())->get_end_node();
break;
case UmlInherit:
if (! inh) continue;
target = ((SimpleRelationData *) bn->get_data())->get_end_node();
break;
default:
continue;
}
if ((sametype && (target->get_type() != k)) ||
(d[target] != 0))
continue;
d.insert(target, target);
newones.append(target);
}
}
}
if (referencing_rb->isChecked()) {
if (e->get_type() == UmlClass)
BrowserRelation::get_relating(e, d, newones, inh, dep, assoc);
BrowserSimpleRelation::get_relating(e, d, newones, inh, dep, sametype, k);
}
}
added = newones;
} while (--lvl != 0);
d.remove(elt);
Q3PtrDictIterator<BrowserNode> it(d);
while (it.current()) {
elts.append(it.current());
++it;
}
QDialog::accept();
}