本文整理汇总了C++中TreeKeyIdx::getOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeKeyIdx::getOffset方法的具体用法?C++ TreeKeyIdx::getOffset怎么用?C++ TreeKeyIdx::getOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeKeyIdx
的用法示例。
在下文中一共展示了TreeKeyIdx::getOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printTree
void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
if (!target)
target = &treeKey;
unsigned long currentOffset = target->getOffset();
std::cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
for (int i = 0; i < level; i++) std::cout << "\t";
std::cout << treeKey.getLocalName() << "/\n";
if (treeKey.firstChild()) {
printTree(treeKey, target, level+1);
treeKey.parent();
}
if (treeKey.nextSibling())
printTree(treeKey, target, level);
}
示例2: setEntryText
void setEntryText(RawGenBook *book) {
SWBuf body;
TreeKeyIdx *treeKey = (TreeKeyIdx *)(SWKey *)(*book);
if (treeKey->getOffset()) {
char buf[1023];
std::cout << "Enter New Entry Text ('.' on a line by itself to end): \n";
do {
fgets(buf, 1000, stdin);
SWBuf text = buf;
text.trim();
if ((text[0] == '.') && (text[1] == 0))
break;
body += text;
body += "\n";
} while (true);
(*book) << body.c_str();
}
else std::cout << "Can't add entry text to root node\n";
}
示例3: _compare
int TreeKeyIdx::_compare (const TreeKeyIdx & ikey) {
return (getOffset() - ikey.getOffset());
}