本文整理汇总了C++中Directory::getFirstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Directory::getFirstChild方法的具体用法?C++ Directory::getFirstChild怎么用?C++ Directory::getFirstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory::getFirstChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createScriptEntry
static void createScriptEntry(Directory & container, MultipartStream * out, const char * objname, const char * member, bool mode = true)
{
string work;
string inib;
Directory * scope;
int i, j;
(*out) << container.format("\n\t\t/* [email protected] */\n\n");
if(mode)
{
scope = container.getFirstChild();
while(scope != 0)
{
work = scope->getKey();
if(work[0] < '0' || work[1] > '9')
(*out) << "\tOBJECT(" << container.getKey() << '_' << scope->toInteger() << ',' << work << ");\n";
scope = scope->getNext();
}
(*out) << container.format("\tEVAR(ID,_kernel_tmax_$(/prefix/[email protected]/id)id);\n");
}else
{
i = 0;
scope = container.getFirstChild();
while(scope != 0)
{
work = scope->getKey();
(*out) << "\tOBJECT(" << container.getKey() << '_' << (i++) << ',' << scope->getKey() << ");\n";
scope = scope->getNext();
}
(*out) << container.format("\tEVAR(ID,_kernel_tnum_$(/prefix/[email protected]/id)no);\n");
}
(*out) << container.format("\tEVAR($(/prefix/[email protected]/SID)INIB,_kernel_$(/prefix/[email protected]/sid)inib_table);\n");
work.assign(member);
i = 0;
j = work.find_first_of(',');
if(objname == NULL)
inib = container.getKey();
else
inib = objname;
do {
(*out) << "\tMEMBER(" << inib << "_initialization_block," << work.substr(i, j-i) << ");\n";
i = j + 1;
j = work.find_first_of(',', i);
} while(i != string::npos+1);
(*out) << '\n';
}
示例2: assignID
//ID値のアサインメント
// (他の場所からも使うのでここに移動)
int Common::assignID(Directory & container, const char * category, const char * top, enum tagAssignmentOrder order)
{
Directory * node = 0;
Directory * scope = 0;
Directory * work = 0;
set<int> idpool;
map<int, Directory *> sorter;
map<int, Directory *>::iterator p_sorter;
int i;
//下準備
node = container.findChild(top,category,NULL);
if(node == 0)
return 0;
for(i=1;i< (signed int) node->size() + 32; i++)
idpool.insert(i);
//割付順の決定と,割当済みIDの削除
i = 0;
scope = node->getFirstChild();
while(scope != 0)
{
if( *scope == Directory::INTEGER )
idpool.erase(*scope);
else
{
//重複名称の存在チェック
work = container.openChild("/","identifier",scope->getKey().c_str(),NULL);
if( *work == Directory::INTEGER)
{
VerboseMessage("Assigning the same ID (%) since the name (%[%]) is duplicated\n","ID番号(%)を異種同名のオブジェクト(%[%])に割り当てます.\n") << work->toInteger() << scope->getKey() << category;
idpool.erase(*scope = work->toInteger());
} else
{
//割当方法に従って割当候補に追加
switch(order)
{
case ALPHABETIC:
sorter[i++] = scope;
break;
case REVERSE_ALPHABETIC:
sorter[i--] = scope;
break;
case FCFS:
default:
sorter[scope->openChild("#order")->toInteger()] = scope;
break;
case REVERSE_FCFS:
sorter[-scope->openChild("#order")->toInteger()] = scope;
break;
}
}
}
scope = scope->getNext();
}
//ID割当
p_sorter = sorter.begin();
while(p_sorter != sorter.end())
{
scope = (*p_sorter).second;
if( !(*scope == Directory::INTEGER) )
{
i = *(idpool.begin());
idpool.erase(idpool.begin());
work = container.openChild("/","identifier",scope->getKey().c_str(),NULL);
*work = i;
*scope = i;
}
++ p_sorter;
}
//割当表作成
if(node->size() != 0 && VerboseMessage::getVerbose())
{
VerboseMessage("Object ID assignment list [%]\n","オブジェクトID割付表 [%]\n") << category;
sorter.clear();
scope = node->getFirstChild();
while(scope != 0)
{
sorter[scope->toInteger()] = scope;
scope = scope->getNext();
}
p_sorter = sorter.begin();
while(p_sorter != sorter.end())
{
VerboseMessage(" % : %\n") << setw(3) << (*p_sorter).first << (*p_sorter).second->getKey();
++ p_sorter;
}
}
//妥当性の判定
if((signed)node->size()+1 != *(idpool.begin()))
ExceptionMessage("Discontinuous % ID assignment occured","不連続なオブジェクトID(%)") << category << throwException;
//.........这里部分代码省略.........