MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / AddPathToTree

Method AddPathToTree

neo/tools/comafx/CPathTreeCtrl.cpp:152–178  ·  view source on GitHub ↗

================ CPathTreeCtrl::AddPathToTree Adds a new item to the tree. Assumes new paths after the current stack path do not yet exist. ================ */

Source from the content-addressed store, hash-verified

150================
151*/
152HTREEITEM CPathTreeCtrl::AddPathToTree( const idStr &pathName, const int id, idPathTreeStack &stack ) {
153 int lastSlash;
154 idStr itemName, tmpPath;
155 HTREEITEM item;
156
157 lastSlash = pathName.Last( '/' );
158
159 while( stack.Num() > 1 ) {
160 if ( pathName.Icmpn( stack.TopName(), stack.TopNameLength() ) == 0 ) {
161 break;
162 }
163 stack.Pop();
164 }
165
166 while( lastSlash > stack.TopNameLength() ) {
167 pathName.Mid( stack.TopNameLength(), pathName.Length(), tmpPath );
168 tmpPath.Left( tmpPath.Find( '/' ), itemName );
169 item = InsertItem( itemName, stack.TopItem() );
170 stack.Push( item, itemName );
171 }
172
173 pathName.Mid( stack.TopNameLength(), pathName.Length(), itemName );
174 item = InsertItem( itemName, stack.TopItem() );
175 SetItemData( item, id );
176
177 return item;
178}
179
180/*
181================

Callers 4

AddDeclTypeToTreeMethod · 0.80
AddScriptsToTreeMethod · 0.80
AddGUIsToTreeMethod · 0.80
SearchTreeMethod · 0.80

Calls 12

LastMethod · 0.80
TopNameMethod · 0.80
TopNameLengthMethod · 0.80
PopMethod · 0.80
MidMethod · 0.80
LeftMethod · 0.80
TopItemMethod · 0.80
IcmpnMethod · 0.60
NumMethod · 0.45
LengthMethod · 0.45
FindMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected