本文整理汇总了C++中Sxmlelement::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Sxmlelement::begin方法的具体用法?C++ Sxmlelement::begin怎么用?C++ Sxmlelement::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sxmlelement
的用法示例。
在下文中一共展示了Sxmlelement::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//_______________________________________________________________________________
static void test1(Sxmlelement elt)
{
cerr << "test1: iterate thru the tree" << endl;
ctree<xmlelement>::iterator iter = elt->begin();
cerr << "=> test1: iterate thru the tree" << endl;
while (iter != elt->end()) {
Sxmlelement xml = *iter;
if (xml)
cerr << " element type " << xml->getType()
<< " - " << xml->getName()
<< " - size: " << xml->size() << endl;
else
cerr << "iterate thru unknown element type " << endl;
iter++;
}
}
示例2: if
//_______________________________________________________________________________
static void test2(Sxmlelement elt)
{
cerr << "test2: erasing all the par measures" << endl;
ctree<xmlelement>::iterator next, iter = elt->begin();
int measure=1;
while (iter != elt->end()) {
Sxmlelement xml = *iter;
next = iter;
next++;
assert (xml);
if (xml->getType() == k_software) {
next = elt->erase(iter);
}
else if (xml->getType() == k_measure) {
if (!(measure & 1)) {
next = elt->erase(iter);
}
measure++;
}
iter = next;
}
}
示例3: count
//_______________________________________________________________________________
static void count(Sxmlelement elt, int type)
{
predicate p(type);
cerr << " count of type " << type << " elements: "
<< count_if(elt->begin(), elt->end(), p) << endl;
}