本文整理汇总了C++中Q3PtrVector类的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrVector类的具体用法?C++ Q3PtrVector怎么用?C++ Q3PtrVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Q3PtrVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: children
void UmlItem::loadFromProfile()
{
WrapperStr id;
if (propertyValue("xmiId", id) && (All.find(id) == All.end()))
All.insert(id, this);
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned u = 0; u != n; u += 1)
ch[u]->loadFromProfile();
}
示例2:
const Q3PtrVector<UmlComponent> UmlBaseClass::associatedComponents() {
UmlCom::send_cmd(_identifier, assocComponentCmd);
Q3PtrVector<UmlComponent> result;
unsigned n = UmlCom::read_unsigned();
result.resize(n);
for (unsigned index = 0; index != n; index += 1)
result.insert(index, (UmlComponent *) UmlBaseItem::read_());
return result;
}
示例3: read_item_list
void UmlCom::read_item_list(Q3PtrVector<UmlItem> & v)
{
unsigned n = read_unsigned();
v.resize(n);
#ifdef TRACE
//cout << "UmlCom::read_item_list " << n << " items\n";
#endif
for (unsigned index = 0; index != n; index += 1)
v.insert(index, UmlBaseItem::read_());
}
示例4: set_JavaDecl
void UmlClass::uml2java(bool rec) {
if (isJavaExternal())
set_JavaDecl(JavaSettings::externalClassDecl());
else {
Q3CString st = JavaSettings::classStereotype(stereotype());
UmlItem * pack = parent()->parent();
while (pack->kind() != aPackage)
pack = pack->parent();
if ((st == "stereotype") ||
(st == "metaclass") ||
(pack->stereotype() == "profile")) {
set_CppDecl("");
return;
}
if (st == "enum_pattern")
set_JavaDecl(JavaSettings::enumPatternDecl());
else if (st == "enum")
set_JavaDecl(JavaSettings::enumDecl());
else if (st == "interface")
set_JavaDecl(JavaSettings::interfaceDecl());
else if (st == "@interface") {
Q3CString s = JavaSettings::interfaceDecl();
int index = s.find("interface");
if (index != -1)
s.insert(index, '@');
set_JavaDecl(s);
}
else if (st == "ignored") {
set_JavaDecl("");
return;
}
else
set_JavaDecl(JavaSettings::classDecl());
if (rec) {
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2java(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_JavaSource(JavaSettings::sourceContent());
}
}
示例5: findStereotype
bool UmlClass::isAppliedStereotype(Token & tk, WrapperStr & prof_st, Q3ValueList<WrapperStr> & base_v)
{
static Q3Dict<WrapperStr> stereotypes;
static Q3Dict<Q3ValueList<WrapperStr> > bases;
WrapperStr s = tk.what();
WrapperStr * st = stereotypes[s];
if (st != 0) {
prof_st = *st;
base_v = *bases[s];
return TRUE;
}
base_v.clear();
if (tk.xmiType().isEmpty() && (getFct(tk) == 0)) {
int index = s.find(':');
if ((index != -1) &&
((index != 3) || ((s.left(3) != "uml") && (s.left(3) != "xmi")))) {
UmlClass * cl = findStereotype(s, FALSE);
if (cl != 0) {
const Q3PtrVector<UmlItem> ch = cl->children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1) {
UmlItem * x = ch[i];
if ((x->kind() == aRelation) &&
(((UmlRelation *) x)->relationKind() == aDirectionalAssociation) &&
(((UmlRelation *) x)->roleType()->stereotype() == "metaclass"))
base_v.append("base_" + ((UmlRelation *) x)->roleType()->name().lower());
}
if (base_v.isEmpty())
base_v.append("base_element");
prof_st = cl->parent()->parent()->name() + ":" + cl->name();
stereotypes.insert(s, new WrapperStr(prof_st));
bases.insert(s, new Q3ValueList<WrapperStr>(base_v));
return TRUE;
}
}
}
return FALSE;
}
示例6: set_CppDecl
void UmlClass::uml2cpp(bool rec) {
if (isCppExternal())
set_CppDecl(CppSettings::externalClassDecl());
else {
Q3CString st = CppSettings::classStereotype(stereotype());
UmlItem * pack = parent()->parent();
while (pack->kind() != aPackage)
pack = pack->parent();
if ((st == "stereotype") ||
(st == "metaclass") ||
(pack->stereotype() == "profile")) {
set_CppDecl("");
return;
}
if (st == "enum")
set_CppDecl(CppSettings::enumDecl());
else if (st == "union")
set_CppDecl(CppSettings::unionDecl());
else if (st == "struct")
set_CppDecl(CppSettings::structDecl());
else if (st == "typedef")
set_CppDecl(CppSettings::typedefDecl());
else if (st == "ignored") {
set_CppDecl("");
return;
}
else
set_CppDecl(CppSettings::classDecl());
if (rec) {
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2cpp(rec);
}
if (parent()->kind() == aClassView) {
// not nested
UmlArtifact * art = artifact();
art->set_CppSource(CppSettings::sourceContent());
art->set_CppHeader(CppSettings::headerContent());
}
}
}
示例7: set_IdlDecl
void UmlClass::uml2idl(bool rec) {
if (isIdlExternal())
set_IdlDecl(IdlSettings::externalClassDecl());
else {
Q3CString st = IdlSettings::classStereotype(stereotype());
UmlItem * pack = parent()->parent();
while (pack->kind() != aPackage)
pack = pack->parent();
if ((st == "stereotype") ||
(st == "metaclass") ||
(pack->stereotype() == "profile")) {
set_CppDecl("");
return;
}
if (st == "struct")
set_IdlDecl(IdlSettings::structDecl());
else if (st == "union")
set_IdlDecl(IdlSettings::unionDecl());
else if (st == "enum")
set_IdlDecl(IdlSettings::enumDecl());
else if (st == "exception")
set_IdlDecl(IdlSettings::exceptionDecl());
else if (st == "typedef")
set_IdlDecl(IdlSettings::typedefDecl());
else if (st == "interface")
set_IdlDecl(IdlSettings::interfaceDecl());
else if (st == "ignored") {
set_IdlDecl("");
return;
}
else
set_IdlDecl(IdlSettings::valuetypeDecl());
if (rec) {
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2idl(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_IdlSource(IdlSettings::sourceContent());
}
}
示例8: children
void UmlActivityAction::solve_output_flows() {
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1) {
UmlFlow * f = dynamic_cast<UmlFlow *>(ch[i]);
if ((f != 0) && (f->control_or_data() == Unset)) {
UmlActivityObject * o = dynamic_cast<UmlActivityObject *>(f->target());
f->set_control_or_data(((o == 0) || o->isControlType()) ? IsControl : IsData);
}
}
}
示例9: children
void UmlClass::generate_def(QTextOStream & f, Q3CString indent, bool h) {
if (! cppDecl().isEmpty()) {
Q3PtrVector<UmlItem> ch = children();
Q3CString templates;
Q3CString cl_names;
Q3CString templates_tmplop;
Q3CString cl_names_tmplop;
spec(templates, cl_names, templates_tmplop, cl_names_tmplop);
for (unsigned index = 0; index != ch.size(); index += 1)
if (ch[index]->kind() != aNcRelation)
((UmlClassItem *) ch[index])
->generate_def(f, indent, h, templates, cl_names,
templates_tmplop, cl_names_tmplop);
}
}
示例10: children
bool UmlBaseClass::set_Name(const Q3CString & s) {
if (!UmlBaseItem::set_Name(s))
return FALSE;
const Q3PtrVector<UmlItem> ch = children();
Q3CString destr = "~" + name();
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == anOperation) {
if (ch[i]->name() == name())
ch[i]->set_Name(s);
else if (ch[i]->name() == destr)
ch[i]->set_Name("~" + s);
}
}
return TRUE;
}
示例11: children
bool UmlComponentView::write_if_needed(FileOut & out) {
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
bool used = FALSE;
for (unsigned i = 0; i != n; i += 1)
used |= ch[i]->write_if_needed(out);
if (used && _gen_views) {
out.indent(-1);
out.indent();
out << "</UML:Namespace.ownedElement>\n";
out.indent(-1);
out.indent();
out << "</UML:Package>\n";
}
return used;
}
示例12: children
void UmlClass::get_extended(Q3ValueList<WrapperStr> & r)
{
r.clear();
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
unsigned i;
for (i = 0; i != n; i += 1) {
UmlItem * x = ch[i];
if ((x->kind() == aRelation) &&
(((UmlRelation *) x)->relationKind() == aDirectionalAssociation) &&
(((UmlRelation *) x)->roleType()->stereotype() == "metaclass"))
r.append(((UmlRelation *) x)->roleType()->name());
}
if (r.isEmpty())
r.append("Element");
}
示例13: children
UmlPackage * UmlPackage::findProfile(WrapperStr xmiId)
{
if (stereotype() == "profile") {
WrapperStr id;
if (propertyValue("xmiId", id) && (id == xmiId))
return this;
}
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
UmlPackage * r;
for (unsigned u = 0; u != n; u += 1) {
if ((ch[u]->kind() == aPackage) &&
((r = ((UmlPackage *) ch[u])->findProfile(xmiId)) != 0))
return r;
}
return 0;
}
示例14: set_PythonDecl
void UmlClass::uml2python(bool rec) {
if (isPythonExternal())
set_PythonDecl(PythonSettings::externalClassDecl());
else {
Q3CString st = PythonSettings::classStereotype(stereotype());
UmlItem * pack = parent()->parent();
while (pack->kind() != aPackage)
pack = pack->parent();
if ((st == "stereotype") ||
(st == "metaclass") ||
(pack->stereotype() == "profile")) {
set_CppDecl("");
return;
}
if (st == "enum")
set_PythonDecl(PythonSettings::enumDecl());
else if (st == "ignored") {
set_PythonDecl("");
return;
}
else
set_PythonDecl(PythonSettings::classDecl());
if (rec) {
const Q3PtrVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2python(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_PythonSource(PythonSettings::sourceContent());
}
}
示例15: text
UmlPackage * Package::get_uml(bool mandatory)
{
if (uml == 0) {
const char * name = text(0);
Package * pa = (Package *) parent();
UmlPackage * uml_pa = pa->get_uml(); // will end on project
Q3PtrVector<UmlItem> ch = uml_pa->children();
for (unsigned index = 0; index != ch.size(); index += 1) {
UmlItem * it = ch[index];
if ((it->kind() == aPackage) && (it->name() == name))
return uml = (UmlPackage *) it;
}
if ((uml = UmlBasePackage::create(uml_pa, name)) == 0) {
if (!mandatory)
return 0;
#ifdef REVERSE
UmlCom::trace(WrapperStr("<font face=helvetica><b>cannot create package <i>")
+ name + "</i> under package <i>" + uml_pa->name() +
"</b></font><br>");
UmlCom::message("");
throw 0;
#else
QMessageBox::critical(0, "Fatal Error",
QString("<font face=helvetica><b>cannot create package <i>")
+ name + "</i> under package <i>"
+ ((const char *) uml_pa->name()) + "</b></font><br>");
QApplication::exit(1);
#endif
}
}
return uml;
}