本文整理汇总了C++中idStr::Icmpn方法的典型用法代码示例。如果您正苦于以下问题:C++ idStr::Icmpn方法的具体用法?C++ idStr::Icmpn怎么用?C++ idStr::Icmpn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idStr
的用法示例。
在下文中一共展示了idStr::Icmpn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddPathToTree
/*
================
CPathTreeCtrl::AddPathToTree
Adds a new item to the tree.
Assumes new paths after the current stack path do not yet exist.
================
*/
HTREEITEM CPathTreeCtrl::AddPathToTree( const idStr &pathName, const int id, idPathTreeStack &stack ) {
int lastSlash;
idStr itemName, tmpPath;
HTREEITEM item;
lastSlash = pathName.Last( '/' );
while( stack.Num() > 1 ) {
if ( pathName.Icmpn( stack.TopName(), stack.TopNameLength() ) == 0 ) {
break;
}
stack.Pop();
}
while( lastSlash > stack.TopNameLength() ) {
pathName.Mid( stack.TopNameLength(), pathName.Length(), tmpPath );
tmpPath.Left( tmpPath.Find( '/' ), itemName );
item = InsertItem( itemName, stack.TopItem() );
stack.Push( item, itemName );
}
pathName.Mid( stack.TopNameLength(), pathName.Length(), itemName );
item = InsertItem( itemName, stack.TopItem() );
SetItemData( item, id );
return item;
}
示例2: FindItem
/*
================
CPathTreeCtrl::FindItem
Find the given path in the tree.
================
*/
HTREEITEM CPathTreeCtrl::FindItem( const idStr &pathName ) {
int lastSlash;
idStr path, tmpPath, itemName;
HTREEITEM item, parentItem;
parentItem = NULL;
item = GetRootItem();
lastSlash = pathName.Last( '/' );
while( item && lastSlash > path.Length() ) {
itemName = GetItemText( item );
tmpPath = path + itemName;
if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
parentItem = item;
item = GetChildItem( item );
path = tmpPath + "/";
} else {
item = GetNextSiblingItem( item );
}
}
for ( item = GetChildItem( parentItem ); item; item = GetNextSiblingItem( item ) ) {
itemName = GetItemText( item );
if ( pathName.Icmp( path + itemName ) == 0 ) {
return item;
}
}
return NULL;
}
示例3: InsertPathIntoTree
/*
================
CPathTreeCtrl::InsertPathIntoTree
Inserts a new item going from the root down the tree only creating paths where necessary.
This is slow and should only be used to insert single items.
================
*/
HTREEITEM CPathTreeCtrl::InsertPathIntoTree( const idStr &pathName, const int id ) {
int lastSlash;
idStr path, tmpPath, itemName;
HTREEITEM item, parentItem;
parentItem = NULL;
item = GetRootItem();
lastSlash = pathName.Last( '/' );
while( item && lastSlash > path.Length() ) {
itemName = GetItemText( item );
tmpPath = path + itemName;
if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
parentItem = item;
item = GetChildItem( item );
path = tmpPath + "/";
} else {
item = GetNextSiblingItem( item );
}
}
while( lastSlash > path.Length() ) {
pathName.Mid( path.Length(), pathName.Length(), tmpPath );
tmpPath.Left( tmpPath.Find( '/' ), itemName );
parentItem = InsertItem( itemName, parentItem );
path += itemName + "/";
}
pathName.Mid( path.Length(), pathName.Length(), itemName );
item = InsertItem( itemName, parentItem, TVI_SORT );
SetItemData( item, id );
return item;
}