本文整理汇总了C++中Q3PtrVector::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrVector::count方法的具体用法?C++ Q3PtrVector::count怎么用?C++ Q3PtrVector::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3PtrVector
的用法示例。
在下文中一共展示了Q3PtrVector::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_cmd
void UmlCom::send_cmd(const void * id, OnInstanceCmd cmd, const Q3PtrVector<UmlClass> & l1, const Q3PtrVector<UmlClass> & l2, const Q3PtrVector<UmlClass> & l3)
{
#ifdef TRACE
cout << "UmlCom::send_cmd(id, " << cmd << ", const Q3PtrVector<UmlClass> & l1, const Q3PtrVector<UmlClass> & l2, const Q3PtrVector<UmlClass> & l3)\n";
#endif
write_char(onInstanceCmd);
write_id(id);
write_char(cmd);
unsigned n;
unsigned i;
n = l1.count();
write_unsigned(n);
for (i = 0; i != n; i += 1)
write_id(((UmlBaseItem *) l1[i])->_identifier);
n = l2.count();
write_unsigned(n);
for (i = 0; i != n; i += 1)
write_id(((UmlBaseItem *) l2[i])->_identifier);
n = l3.count();
write_unsigned(n);
for (i = 0; i != n; i += 1)
write_id(((UmlBaseItem *) l3[i])->_identifier);
flush();
}
示例2: generate
void UmlJunctionPseudoState::generate(UmlClass * machine, UmlClass * anystate, UmlState * state) {
// create an operation because a priori shared
if (_oper.isEmpty())
_oper.sprintf("_junction%d", ++_rank);
UmlClass * cl = state->assocClass();
UmlOperation * junction;
if (((junction = (UmlOperation *) cl->getChild(anOperation, _oper)) == 0) &&
((junction = UmlBaseOperation::create(cl, _oper)) == 0)) {
UmlCom::trace("Error : cannot create operation '" + _oper
+ "' in class '" + cl->name() + "'<br>");
throw 0;
}
junction->defaultDef();
junction->setComment("implement a junction, through an operation because shared, internal");
junction->setType("void", "${type}");
junction->addParam(0, InputOutputDirection, "stm", machine);
junction->setParams("${t0} & ${p0}");
Q3CString body;
const Q3PtrVector<UmlItem> ch = children();
Q3PtrList<UmlTransition> trs;
unsigned index;
for (index = 0; index != ch.count(); index += 1)
if (ch[index]->kind() == aTransition)
// theo mandatory
trs.append((UmlTransition *) ch[index]);
UmlTransition::generate(trs, machine, anystate, state, body, " ", FALSE);
junction->set_CppBody(body);
}
示例3: generate
void UmlTransition::generate(UmlClass * machine, UmlClass * anystate, UmlState * state)
{
if (_already_managed)
return;
Q3CString s = triggerName();
// group transitions having the same trigger
const Q3PtrVector<UmlItem> ch = parent()->children();
unsigned index = ch.findRef(this);
Q3PtrList<UmlTransition> trs;
UmlTransition * tr_no_guard = 0;
if (cppGuard().isEmpty())
tr_no_guard = this;
else
trs.append(this);
while (++index != ch.count()) {
if ((ch[index]->kind() == aTransition) &&
(((UmlTransition *) ch[index])->triggerName() == s)) {
if (!((UmlTransition *) ch[index])->cppGuard().isEmpty())
trs.append((UmlTransition *) ch[index]);
else if (tr_no_guard != 0) {
UmlCom::trace("Error : several transitions from '" + parent()->name()
+ "' don't have guard");
throw 0;
}
else
tr_no_guard = (UmlTransition *) ch[index];
((UmlTransition *) ch[index])->_already_managed = TRUE;
}
}
if (tr_no_guard != 0)
// place it at end
trs.append(tr_no_guard);
// made the trigger
UmlOperation * trg = state->assocClass()->trigger(s, machine, anystate);
Q3CString body;
if (s == "create") {
// manage entry
if (!state->cppEntryBehavior().isEmpty())
body = " _doentry(stm);\n";
}
if (!state->cppDoActivity().isEmpty())
// state do activity before each event except create
body += " _do(stm);\n";
bool completion = (s == "_completion");
if (!completion && state->isLeaf() && state->hasCompletion())
// manage completion
body += " if (_completion(stm)) return;\n";
UmlTransition::generate(trs, machine, anystate, state,
body, " ", completion);
trg->set_CppBody(body);
}
示例4: import
void UmlRelation::import(File & f)
{
if (scanning)
f.skipBlock();
else {
Q3CString s;
if (f.read(s) != STRING)
f.syntaxError(s, "relation's name");
else if (*s == '$')
// unnamed
s = "";
Q3CString id;
Q3CString ste;
Q3CString doc;
Q3Dict<Q3CString> prop;
Q3CString s2;
int k;
do {
k = f.readDefinitionBeginning(s2, id, ste, doc, prop);
} while (id.isEmpty());
for (;;) {
if (k == ATOM) {
if (s2 == "roles")
break;
f.skipNextForm();
k = f.read(s2);
}
else
f.syntaxError(s);
}
f.read("(");
f.read("list");
f.read("role_list");
Role role_1;
Role role_2;
Role * role1 = &role_1;
Role * role2 = &role_2;
role_1.import(f);
role_2.import(f);
UmlRelation * r = 0;
bool bidir = role_1.is_navigable && role_2.is_navigable;
// place information in the logical side !
bool b = role_1.is_aggregate;
role_1.is_aggregate = role_2.is_aggregate;
role_2.is_aggregate = b;
role_1.is_aggregate |= role_1.is_byvalue;
role_2.is_aggregate |= role_2.is_byvalue;
if (bidir && role_2.is_aggregate) {
// manage bouml limitation : only role1 may be an aggregate
if (role_1.is_aggregate)
bidir = FALSE;
else {
// exchange roles
role1 = &role_2;
role2 = &role_1;
}
}
if ((role1->target != 0) && (role2->target != 0)) {
if (role1->is_navigable) {
r = UmlRelation::create(role1->rel_kind(bidir), role2->target, role1->target);
if (r == 0) {
UmlCom::trace("<br>cannot create relation '" + role1->name + "' from '" +
role2->target->fullName() + "' to '" +
role1->target->fullName() + "'");
f.read(")");
f.skipBlock();
return;
}
if (!ste.isEmpty())
r->set_Stereotype(ste);
if (! s.isEmpty())
r->set_Name(s);
r->import(role1);
}
if (role2->is_navigable) {
if (bidir) {
const Q3PtrVector<UmlItem> ch = role2->target->children();
r = (UmlRelation *) ch.at(ch.count() - 1);
}
else {
r = UmlRelation::create(role2->rel_kind(FALSE),role1->target, role2->target);
//.........这里部分代码省略.........