本文整理汇总了C++中BrowserClass类的典型用法代码示例。如果您正苦于以下问题:C++ BrowserClass类的具体用法?C++ BrowserClass怎么用?C++ BrowserClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BrowserClass类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BasicData
ClassData::ClassData(const ClassData * model, BrowserNode * bn)
: BasicData(model), constraint(model->constraint)
{
browser_node = bn;
if ((nformals = model->nformals) == 0)
formals = 0;
else {
FormalParamData * mformals = model->formals;
formals = new FormalParamData[nformals];
for (int index = 0; index != nformals; index += 1)
formals[index] = mformals[index];
}
Q3PtrListIterator<ActualParamData> it(model->actuals);
BrowserClass * cl = 0;
for (; it.current(); ++it) {
ActualParamData * actual = new ActualParamData(*(it.current()));
if (actual->get_class() != cl) {
cl = actual->get_class();
connect(cl->get_data(), SIGNAL(changed()),
this, SLOT(update_actuals()));
connect(cl->get_data(), SIGNAL(deleted()),
this, SLOT(update_actuals()));
}
actuals.append(actual);
}
set_base_type(model->base_type);
is_deleted = FALSE;
bodies_read = FALSE;
bodies_modified = FALSE;
is_abstract = model->is_abstract;
is_active = model->is_active;
cpp_external = model->cpp_external;
java_external = model->java_external;
java_final = model->java_final;
php_external = model->php_external;
php_final = model->php_final;
python_2_2 = model->python_2_2;
python_external = model->python_external;
idl_external = model->idl_external;
idl_local = model->idl_local;
idl_custom = model->idl_custom;
uml_visibility = model->uml_visibility;
cpp_visibility = model->cpp_visibility;
cpp_decl = model->cpp_decl;
java_decl = model->java_decl;
java_annotation = model->java_annotation;
php_decl = model->php_decl;
python_decl = model->python_decl;
set_switch_type(model->switch_type);
idl_decl = model->idl_decl;
connect(this, SIGNAL(changed()), this, SLOT(update_actuals()));
}
示例2: type_changed
void ClassInstanceDialog::type_changed(int i)
{
// made attribute list
BrowserClass * cl = (BrowserClass *) nodes.at(i);
cl->get_attrs(attributes);
attributes.sort();
// fill table
atbl->setRowCount(0);
atbl->setRowCount(attributes.count());
QList<SlotAttr> attrs = inst->attributes;
int index = 0;
foreach (BrowserNode * at, attributes) {
atbl->setItem(index, 0, new TableItem(atbl, TableItem::Never, at->get_name(), TableItem::TableItemType));
atbl->setItem(index, 1, new TableItem(atbl, TableItem::Never, ((BrowserNode *) at->parent())->get_name(), TableItem::TableItemType));
QList<SlotAttr>::Iterator it_attr;
for (it_attr = attrs.begin(); it_attr != attrs.end(); ++it_attr) {
if ((*it_attr).att == at) {
atbl->setText(index, 2, (*it_attr).value);
break;
}
}
if (it_attr == attrs.end())
atbl->setText(index, 2, QString());
++index;
}
示例3: get_type
void ParameterData::on_delete()
{
BrowserClass * cl = get_type().type;
if ((cl != 0) && cl->deletedp())
set_type((BrowserClass *) 0);
}
示例4: initializerDummy
void BrowserOperation::AddConstructorInitalizer()
{
ConstructorInitializerDialog ciDialog;
BrowserClass* container = static_cast<BrowserClass*>(get_container(UmlClass));
QList<BrowserNode *> parents = container->parents();
QString initializerDummy(" : ");
for(BrowserNode* parent : parents)
{
BrowserClass* parentClass = static_cast<BrowserClass*>(parent);
initializerDummy+=parentClass->get_name() + QString("(), ");
}
if(initializerDummy != " : ")
initializerDummy.chop(2);
QString constructorPrototype = static_cast<OperationData*>(this->get_data())->get_cppdef();
QString constructorActual = TagManagers::Cpp::updated_def(static_cast<OperationData*>(this->get_data()));
QString initializer(this->get_value("constructor-initializer"));
if(initializer.trimmed().isEmpty())
ciDialog.ui->edInitializer->setText(initializerDummy);
else
ciDialog.ui->edInitializer->setText(this->get_value("constructor-initializer"));
ciDialog.ui->edConstructorPrototype->setText(constructorPrototype);
ciDialog.ui->edActualConstructor->setText(constructorActual);
ciDialog.Init(static_cast<OperationData*>(this->get_data()));
ciDialog.resize(800, 400);
if(ciDialog.exec() == QDialog::Accepted)
{
this->set_value("constructor-initializer", ciDialog.ui->edInitializer->toPlainText());
this->modified();
this->get_data()->get_browser_node()->modified();
this->get_data()->get_browser_node()->package_modified();
}
}
示例5: if
void QuickEdit::AddOperation()
{
QModelIndex current = ui->tvEditor->selectionModel()->currentIndex();
if(!current.isValid())
return;
current = current.sibling(current.row(), 0);
TreeItemInterface *itemAsInterface = static_cast<TreeItemInterface*>(current.internalPointer());
BrowserNode* currentNode = static_cast<BrowserNode*>(itemAsInterface->InternalPointer());
BrowserClass* classNode;
int newItemPosition = 0;
if(currentNode->TypeID() == TypeIdentifier<BrowserClass>::id())
{
classNode = static_cast<BrowserClass*>(currentNode);
newItemPosition = itemAsInterface->childCount();
}
else if(currentNode->TypeID() == TypeIdentifier<BrowserOperation>::id() && current.parent().isValid())
{
itemAsInterface = static_cast<TreeItemInterface*>(current.parent().internalPointer());
classNode = static_cast<BrowserClass*>(itemAsInterface->InternalPointer());
newItemPosition = current.row()+1;
current = current.parent();
}
else
return;
if(!classNode)
return;
BrowserOperation* newOperation = static_cast<BrowserOperation*>(classNode->addOperation());
classNode->move(newOperation, currentNode);
classNode->select_in_browser();
QModelIndex parentIndex;
TreeItemInterface* parent;
if(treeModel->parent(current).isValid())
{
parentIndex = treeModel->parent(current);
parentIndex = parentIndex.sibling(parentIndex.row(), 0);
parent = static_cast<TreeItemInterface*>(parentIndex.internalPointer());
}
else
parent = treeModel->RootItem();
int insertIndex = parent->GetIndexOfChild(itemAsInterface);
QSharedPointer<TreeItemInterface> sharedOfOperation = parent->GetChildren()[insertIndex];
if(!treeModel->insertRows(newItemPosition-1, 1, current))
return;
if(!current.isValid())
return;
QModelIndex newItem = treeModel->index(newItemPosition-1,0,current);
TreeItemInterface *newItemInterface = static_cast<TreeItemInterface*>(newItem.internalPointer());
TreeItem<BrowserNode>* newItemAsNode = static_cast<TreeItem<BrowserNode>*>(newItemInterface);
newItemAsNode->SetController(operationController);
newItemAsNode->SetParent(sharedOfOperation);
newItemAsNode->SetInternalData(newOperation);
}
示例6: while
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) {
QList<BrowserClass *> l;
cl->get_all_parents(l);
remove |= (! l.contains(other));
}
}
if (remove) {
it_rel = relations.remove(it_rel);
modif = TRUE;
}
else
++it_rel;
}
if (modif)
modified();
}
示例7: read_keyword
void ClassData::read(char * & st, char * & k) {
if (!strcmp(k, "abstract")) {
is_abstract = TRUE;
k = read_keyword(st);
}
else
is_abstract = FALSE;
if (!strcmp(k, "active")) {
is_active = TRUE;
k = read_keyword(st);
}
else
is_active = FALSE;
if (!strcmp(k, "visibility")) {
uml_visibility = ::visibility(read_keyword(st));
k = read_keyword(st);
}
else {
// old non nested class
uml_visibility = UmlPackageVisibility;
}
if (!strcmp(k, "stereotype")) {
set_stereotype(read_string(st));
if (!strcmp(stereotype, "typedef")) {
AType t;
t.read(st, "base_type", "explicit_base_type");
set_base_type(t);
}
k = read_keyword(st);
}
unsigned n, i;
if (!strcmp(k, "nformals")) {
n = read_unsigned(st);
set_n_formalparams(n);
for (i = 0; i != n; i += 1)
formals[i].read(st);
k = read_keyword(st);
}
else
set_n_formalparams(0);
if (!strcmp(k, "nactuals")) {
n = read_unsigned(st);
BrowserClass * cl = 0;
for (i = 0; i != n; i += 1) {
ActualParamData * actual = ActualParamData::read(st);
actuals.append(actual);
if (actual->get_class() != cl) {
cl = actual->get_class();
connect(cl->get_data(), SIGNAL(deleted()),
this, SLOT(update_actuals()));
connect(cl->get_data(), SIGNAL(changed()),
this, SLOT(update_actuals()));
}
}
k = read_keyword(st);
}
else {
n = 0;
actuals.clear();
}
if (!strcmp(k, "constraint")) {
constraint = read_string(st);
k = read_keyword(st);
}
else
constraint = QString::null;
if (!strcmp(k, "cpp_external")) {
cpp_external = TRUE;
k = read_keyword(st);
}
else
cpp_external = FALSE;
if (!strcmp(k, "cpp_visibility")) {
cpp_visibility = ::visibility(read_keyword(st));
k = read_keyword(st);
}
else
cpp_visibility = UmlDefaultVisibility;
if (!strcmp(k, "cpp_decl")) {
cpp_decl = read_string(st);
//.........这里部分代码省略.........
示例8: the_canvas
void UcClassCanvas::compute_size() {
used_settings = settings;
((BrowserUseCaseDiagram *) the_canvas()->browser_diagram())
->get_simpleclassdiagramsettings(used_settings);
full_name = browser_node->get_name();
const MyStr & (PackageData::*f)() const = 0;
const char * sep = 0; // to avoid warning
switch (used_settings.show_context_mode) {
case umlContext:
full_name = browser_node->full_name();
break;
case namespaceContext:
f = &PackageData::get_cpp_namespace;
sep = "::";
break;
case javaPackageContext:
f = &PackageData::get_java_package;
sep = ".";
break;
case pythonPackageContext:
f = &PackageData::get_python_package;
sep = ".";
break;
case moduleContext:
f = &PackageData::get_idl_module;
sep = "::";
break;
default:
break;
}
if (f != 0) {
BrowserClass * cl = (BrowserClass *) browser_node;
while (cl->nestedp())
cl = (BrowserClass *) cl->parent();
if (((BrowserNode *) cl->parent())->get_type() == UmlClassView) {
// not under a use case
BrowserArtifact * cp = cl->get_associated_artifact();
QString context =
(((PackageData *)
((BrowserNode *)
(((cp == 0) ? (BrowserNode *) cl : (BrowserNode *) cp)
->parent()->parent()))->get_data())->*f)();
if (!context.isEmpty())
full_name = context + sep + full_name;
}
}
QFontMetrics fm(the_canvas()->get_font(UmlNormalFont));
QFontMetrics fim(the_canvas()->get_font(UmlNormalItalicFont));
const ClassData * data = ((ClassData *) browser_node->get_data());
int wi =
(data->get_is_abstract()) ? fim.width(full_name) : fm.width(full_name);
double zoom = the_canvas()->zoom();
const QPixmap * px = 0;
if (used_settings.class_drawing_mode == Natural) {
if ((px = ProfiledStereotypes::diagramPixmap(data->get_stereotype(), zoom)) != 0)
used_view_mode = Natural;
else {
const char * st = data->get_short_stereotype();
if (!strcmp(st, "control"))
used_view_mode = asControl;
else if (!strcmp(st, "entity"))
used_view_mode = asEntity;
else if (!strcmp(st, "boundary"))
used_view_mode = asBoundary;
else if (!strcmp(st, "actor"))
used_view_mode = asActor;
else if (!strcmp(st, "interface"))
used_view_mode = asInterface;
else
used_view_mode = asClass;
}
}
else
used_view_mode = used_settings.class_drawing_mode;
const int eight = (int) (8 * zoom);
int he = fm.height() + eight;
bool tmpl = data->get_n_formalparams() != 0;
if (tmpl)
he += fm.height();
if (used_view_mode == asClass) {
he += (int) (12 * zoom);
if (data->get_stereotype()[0]) {
int stw = fm.width(QString("<<") + toUnicode(data->get_short_stereotype()) + ">>");
//.........这里部分代码省略.........
示例9: rect
void OdClassInstCanvas::draw(QPainter & p) {
if (visible()) {
QRect r = rect();
QFontMetrics fm(the_canvas()->get_font(UmlNormalFont));
QColor bckgrnd = p.backgroundColor();
double zoom = the_canvas()->zoom();
p.setBackgroundMode((used_color == UmlTransparent) ? ::Qt::TransparentMode : ::Qt::OpaqueMode);
QColor co = color(used_color);
FILE * fp = svg();
if (fp != 0)
fputs("<g>\n", fp);
if (used_color != UmlTransparent) {
const int shadow = the_canvas()->shadow();
if (shadow != 0) {
r.setRight(r.right() - shadow);
r.setBottom(r.bottom() - shadow);
p.fillRect (r.right(), r.top() + shadow,
shadow, r.height() - 1,
::Qt::darkGray);
p.fillRect (r.left() + shadow, r.bottom(),
r.width() - 1, shadow,
::Qt::darkGray);
if (fp != 0) {
fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\""
" x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
::Qt::darkGray.rgb()&0xffffff,
r.right(), r.top() + shadow, shadow - 1, r.height() - 1 - 1);
fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\""
" x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
::Qt::darkGray.rgb()&0xffffff,
r.left() + shadow, r.bottom(), r.width() - 1 - 1, shadow - 1);
}
}
}
p.setBackgroundColor(co);
if (used_color != UmlTransparent)
p.fillRect(r, co);
if (fp != 0)
fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
" x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
svg_color(used_color),
r.x(), r.y(), r.width() - 1, r.height() - 1);
p.drawRect(r);
BrowserClass * cl =
((ClassInstanceData *) browser_node->get_data())->get_class();
if (((ClassData *) cl->get_data())->get_is_active()) {
const int eight = (int) (8 * zoom);
r.setLeft(r.left() + eight);
r.setRight(r.right() - eight);
p.drawLine(r.topLeft(), r.bottomLeft());
p.drawLine(r.topRight(), r.bottomRight());
if (fp != 0)
fprintf(fp,
"\t<line stroke=\"black\" stroke-opacity=\"1\""
" x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n"
"\t<line stroke=\"black\" stroke-opacity=\"1\""
" x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n",
r.left(), r.top(), r.left(), r.bottom(),
r.right(), r.top(), r.right(), r.bottom());
}
const int two = (int) (2 * zoom);
int he = fm.height() + two;
p.setFont(the_canvas()->get_font(UmlNormalUnderlinedFont));
r.setTop(r.top() + two);
if (horiz) {
p.drawText(r, ::Qt::AlignHCenter + ::Qt::AlignTop,
full_name());
if (fp != 0)
draw_text(r, ::Qt::AlignHCenter + ::Qt::AlignTop,
full_name(),
p.font(), fp);
}
else {
p.drawText(r, ::Qt::AlignHCenter + ::Qt::AlignTop,
get_name() + ":");
if (fp != 0)
draw_text(r, ::Qt::AlignHCenter + ::Qt::AlignTop,
get_name() + ":",
p.font(), fp);
r.setTop(r.top() + fm.height());
//.........这里部分代码省略.........