本文整理汇总了C++中BrowserNode::get_type方法的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNode::get_type方法的具体用法?C++ BrowserNode::get_type怎么用?C++ BrowserNode::get_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserNode
的用法示例。
在下文中一共展示了BrowserNode::get_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: search
void BrowserNodeList::search(BrowserNode * bn, UmlCode k, const QString & s,
bool cs, bool even_deleted, bool for_name,
bool for_stereotype)
{
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() ||
(QString((for_name)
? ch->get_name()
: ((for_stereotype) ? ch->get_stereotype()
: ch->get_comment()))
.find(s, 0, cs) != -1)))
append((BrowserNode *) child);
search((BrowserNode *) child, k, s, cs, even_deleted,
for_name, for_stereotype);
}
}
}
示例2: prepare_for_move
void PackageCanvas::prepare_for_move(bool on_resize) {
if (! on_resize) {
DiagramCanvas::prepare_for_move(on_resize);
Q3CanvasItemList l = collisions(TRUE);
Q3CanvasItemList::ConstIterator it;
Q3CanvasItemList::ConstIterator end = l.end();
DiagramItem * di;
BrowserNode * p = get_bn();
for (it = l.begin(); it != end; ++it) {
if ((*it)->visible() && // at least not deleted
!(*it)->selected() &&
((di = QCanvasItemToDiagramItem(*it)) != 0) &&
di->move_with_its_package()) {
BrowserNode * bn = di->get_bn();
do
bn = (BrowserNode *) bn->parent();
while (bn->get_type() != UmlPackage);
if (bn == p) {
the_canvas()->select(*it);
di->prepare_for_move(FALSE);
}
}
}
}
}
示例3: accept
void BasicDialog::accept() {
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = data->get_browser_node();
if (edname != 0) {
QString s = edname->text().stripWhiteSpace();
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, bn->get_type(),
bn->allow_spaces(),
bn->allow_empty())) {
msg_critical(TR("Error"), edname->text() + TR("\n\nillegal name or already used"));
return;
}
else
bn->set_name(s);
}
bool newst = data->set_stereotype(fromUnicode(edstereotype->currentText().stripWhiteSpace()));
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->update(bn);
ProfiledStereotypes::modified(bn, newst);
bn->package_modified();
data->modified();
Q3TabDialog::accept();
}
示例4: while
BrowserNode * BrowserNode::get_container(UmlCode k) const {
BrowserNode * p = (BrowserNode *) this;
while ((p != 0) && (p->get_type() != k))
p = (BrowserNode *) p->parent();
return p;
}
示例5: menu_specification
void ActivityDialog::menu_specification()
{
Q3PopupMenu m(0);
m.insertItem(TR("Choose"), -1);
m.insertSeparator();
int index = list.findIndex(edspecification->currentText().stripWhiteSpace());
if (index != -1)
m.insertItem(TR("Select in browser"), 0);
BrowserNode * bn = 0;
if (! visit) {
bn = BrowserView::selected_item();
if ((bn != 0) && (bn->get_type() == UmlOperation) && !bn->deletedp())
m.insertItem(TR("Choose operation selected in browser"), 1);
else
bn = 0;
}
if ((index != -1) || (bn != 0)) {
switch (m.exec(QCursor::pos())) {
case 0:
opers.at(index)->select_in_browser();
break;
case 1: {
QString s = bn->full_name(TRUE);
if ((index = list.findIndex(s)) == -1) {
// new operation, may be created through an other dialog
index = 0;
QStringList::Iterator iter = list.begin();
QStringList::Iterator iter_end = list.end();
while ((iter != iter_end) && (*iter < s)) {
++iter;
index += 1;
}
opers.insert((unsigned) index, bn);
list.insert(iter, s);
edspecification->insertItem(s, index + 1);
}
}
edspecification->setCurrentItem(index + 1);
break;
default:
break;
}
}
}
示例6: 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);
}
}
}
示例7: 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);
}
示例8: 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");
}
示例9: 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;
}
示例10: accept
void ExpansionRegionDialog::accept()
{
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = data->get_browser_node();
if (edname != 0) {
QString s = edname->text().trimmed();
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, bn->get_type(),
bn->allow_spaces(),
bn->allow_empty())) {
msg_critical(TR("Error"), edname->text() + TR("\n\nillegal name or already used"));
return;
}
else
bn->set_name(s);
}
data->must_isolate = must_isolate_cb->isChecked();
data->mode = expansion_mode_kind(edmode->currentText().toLatin1().constData());
bool newst = data->set_stereotype(fromUnicode(edstereotype->currentText().trimmed()));
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->updateNodeFromThis(bn);
ProfiledStereotypes::modified(bn, newst);
bn->package_modified();
data->modified();
TabDialog::accept();
}
示例11: menu_type
void ActivityObjectDialog::menu_type()
{
Q3PopupMenu m(0);
m.insertItem(TR("Choose"), -1);
m.insertSeparator();
int index = list.findIndex(edtype->currentText().stripWhiteSpace());
if (index != -1)
m.insertItem(TR("Select in browser"), 0);
BrowserNode * bn = 0;
if (! visit) {
bn = BrowserView::selected_item();
if ((bn != 0) && (bn->get_type() == UmlClass) && !bn->deletedp())
m.insertItem(TR("Choose class selected in browser"), 1);
else
bn = 0;
m.insertItem(TR("Create class and choose it"), 2);
}
if (!visit || (index != -1) || (bn != 0)) {
switch (m.exec(QCursor::pos())) {
case 0:
nodes.at(index)->select_in_browser();
break;
case 2:
bn = BrowserClass::add_class(FALSE, view);
if (bn == 0)
return;
bn->select_in_browser();
// no break
case 1: {
QString s = bn->full_name(TRUE);
if ((index = list.findIndex(s)) == -1) {
// new class, may be created through an other dialog
QStringList::Iterator iter = list.begin();
QStringList::Iterator iter_end = list.end();
index = 0;
while ((iter != iter_end) && (*iter < s)) {
++iter;
index += 1;
}
nodes.insert((unsigned) index, bn);
list.insert(iter, s);
edtype->insertItem(s, index + offset);
}
}
edtype->setCurrentItem(index + offset);
break;
default:
break;
}
}
}
示例12: 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);
}
}
}
}
示例13: 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();
}
}
示例14: 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();
}
示例15: 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();
}