本文整理汇总了C++中BrowserNodeList::first方法的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNodeList::first方法的具体用法?C++ BrowserNodeList::first怎么用?C++ BrowserNodeList::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserNodeList
的用法示例。
在下文中一共展示了BrowserNodeList::first方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tool_cmd
bool ClassInstanceData::tool_cmd(ToolCom * com, const char * args,
BrowserNode * bn, const QString & comment) {
if (((unsigned char) args[-1]) >= firstSetCmd) {
if (!bn->is_writable() && !root_permission())
com->write_ack(FALSE);
else {
switch ((unsigned char) args[-1]) {
case setTypeCmd:
set_class((BrowserClass *) com->get_id(args));
break;
case setAttributeCmd:
{
BrowserAttribute * at = (BrowserAttribute *) com->get_id(args);
bool find = FALSE;
Q3ValueList<SlotAttr>::Iterator it_attr;
for (it_attr = attributes.begin(); it_attr != attributes.end(); ++it_attr) {
SlotAttr & slot_attr = *it_attr;
if (slot_attr.att == at) {
find = TRUE;
if (*args == 0)
// remove it
attributes.remove(it_attr);
else
// replace it
slot_attr.value = args;
break;
}
}
if (! find) {
// add it
Q3PtrList<BrowserClass> l;
cl->get_all_parents(l);
l.append(cl);
if (at->deletedp() ||
(l.findRef((BrowserClass *) at->parent()) == -1)) {
// illegal
com->write_ack(FALSE);
return TRUE;
}
attributes.append(SlotAttr(at, args));
}
}
break;
case addRelationCmd:
if (! change_rel(com, args, TRUE))
return TRUE;
break;
case removeRelationCmd:
if (! change_rel(com, args, FALSE))
return TRUE;
break;
default:
return BasicData::tool_cmd(com, args, bn, comment);
}
// ok case
bn->modified();
modified();
com->write_ack(TRUE);
}
}
else {
switch ((unsigned char) args[-1]) {
case attributesCmd:
if (args[0] == 0) {
com->write_unsigned(attributes.count());
Q3ValueList<SlotAttr>::Iterator it;
for (it = attributes.begin(); it != attributes.end(); ++it) {
const SlotAttr & slot = *it;
slot.att->write_id(com);
com->write_string(slot.value);
}
}
else {
// get all available attributes
BrowserNodeList l;
BrowserNode * bn;
cl->get_attrs(l);
com->write_unsigned(l.count());
for (bn = l.first(); bn != 0; bn = l.next())
bn->write_id(com);
}
break;
case relationsCmd:
{
BrowserClassInstance * other =
(BrowserClassInstance *) com->get_id(args);
if (other == 0) {
com->write_unsigned(relations.count());
//.........这里部分代码省略.........
示例2: tool_cmd
bool BrowserNode::tool_cmd(ToolCom * com, const char * args) {
switch ((unsigned char) args[-1]) {
case applyCmd:
{
QLOG_FATAL() << Q_FUNC_INFO << "If this got called then we have a logic flaw going on and BrowserNode needs to have Q_OBJECT in it to properly catch ToolCom::Run execution result";
Q_ASSERT_X(0, "applyCmd happened", "very bad");
int runResult = ToolCom::run(args, this, FALSE, FALSE);
com->write_unsigned(runResult);
break;
}
case createCmd:
// invalid creation
com->write_id(0);
break;
case parentCmd:
if (this != BrowserView::get_project())
((BrowserNode *) parent())->write_id(com);
else
com->write_id(0);
break;
case childrenCmd:
{
unsigned v = com->api_format();
unsigned n = 0;
Q3ListViewItem * child;
for (child = firstChild(); child != 0; child = child->nextSibling())
if (!((BrowserNode *) child)->deletedp() &&
((BrowserNode *) child)->api_compatible(v))
n += 1;
com->write_unsigned(n);
for (child = firstChild(); child != 0; child = child->nextSibling())
if (!((BrowserNode *) child)->deletedp() &&
((BrowserNode *) child)->api_compatible(v))
((BrowserNode *) child)->write_id(com);
}
break;
case getDefCmd:
case getUmlDefCmd:
case getCppDefCmd:
case getJavaDefCmd:
case getPhpDefCmd:
case getPythonDefCmd:
case getIdlDefCmd:
get_data()->send_uml_def(com, this, comment);
break;
case isWritableCmd:
com->write_bool(!is_read_only);
break;
case supportFileCmd:
// goes up to the package
return ((BrowserNode *) parent())->tool_cmd(com, args);
case isOpenCmd:
com->write_bool(isOpen());
break;
case referencedByCmd:
{
BrowserNodeList targetof;
referenced_by(targetof);
// remove duplicats
targetof.sort_it();
BrowserNode * bn;
targetof.first();
while ((bn = targetof.current()) != 0)
if (bn == targetof.next())
targetof.remove();
com->write_unsigned(targetof.count());
for (bn = targetof.first(); bn != 0; bn = targetof.next())
bn->write_id(com);
}
break;
case setCoupleValueCmd:
if (is_read_only && !root_permission())
com->write_ack(FALSE);
else {
set_value(args, args + strlen(args) + 1);
package_modified();
get_data()->modified();
com->write_ack(TRUE);
}
break;
case setDescriptionCmd:
if (is_read_only && !root_permission())
com->write_ack(FALSE);
else {
set_comment(args);
package_modified();
com->write_ack(TRUE);
}
break;
case setNameCmd:
if (is_read_only && !root_permission())
com->write_ack(FALSE);
//.........这里部分代码省略.........