本文整理汇总了C++中PNode::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ PNode::Name方法的具体用法?C++ PNode::Name怎么用?C++ PNode::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNode
的用法示例。
在下文中一共展示了PNode::Name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Remove
bool DataList::Remove(PNode node)
{
if (!node.Ok())
return false;
if (nodes.erase(BA::to_lower_copy(node->Name())) <= 0)
return false;
node->parent = NULL;
node->ListRemove();
return true;
}
示例2: Rename
bool DataList::Rename(const std::string& old_name, const std::string& new_name)
{
// check that new name is not used up.
if (nodes.find(BA::to_lower_copy(new_name)) != nodes.end())
return false;
nodes_iterator i = nodes.find(BA::to_lower_copy(old_name));
if (i == nodes.end())
return false;
PNode node = i->second;
ASSERT_LOGIC(node.Ok(), "Internal TDF tree consistency (1)");
ASSERT_LOGIC(node->Name().Lower() == old_name.Lower(), "Internal TDF tree consistency (2)");
node->name = BA::to_lower_copy(new_name);
nodes.erase(i);
bool inserted = nodes.insert(std::pair<std::string, PNode>(BA::to_lower_copy(node->name), node)).second;
ASSERT_LOGIC(inserted, "DataList::Rename failed");
return inserted;
}
示例3: InsertRenameAt
void DataList::InsertRenameAt(PNode node, PNode where)
{ // rename if such entry already exists. str contains new name.
if (!node.Ok())
return;
if (!where->list_prev)
return;
if (!InsertAt(node, where)) {
for (int n = 0; n < 10000; ++n) {
std::ostringstream os;
os << node->Name() << rename_prefix << n;
node->name = os.str();
if (InsertAt(node, where)) {
return;
}
}
LslError("insertRename: iterated over 10 000 names, way too many");
}
}
示例4: InsertRename
void DataList::InsertRename(PNode node)
{ /// rename if such entry already exists. str contains new name.
if (!node.Ok())
return;
if (!Insert(node)) {
std::string original_name = node->Name();
for (int n = 0; n < 10000; ++n) {
//std::string tmp=str+std::string(rename_prefix);
std::ostringstream os;
os << original_name << rename_prefix << n;
node->name = os.str();
if (Insert(node)) {
return;
}
}
LslError("insertRename: iterated over 10 000 names, way too many");
}
}