MCPcopy Create free account
hub / github.com/ariccio/altWinDirStat / CountDepth

Method CountDepth

Reference code/AsyncWalk/AsyncWalk/AsyncWalk.cpp:284–291  ·  view source on GitHub ↗

std::uint64_t sumChildren( File* aFile ) { std::uint64_t size = 0; size += aFile->m_FileInfo.m_size; for ( auto& aChild : aFile->m_children ) { if ( aChild->m_type == IT_FILE ) { size += aChild->m_FileInfo.m_size; } else { size += sumChildren( aChild.get( ) ); } } return size; }

Source from the content-addressed store, hash-verified

282// return size;
283// }
284std::uint64_t File::CountDepth( ) {
285 std::uint64_t depth = 0;
286 auto parent = m_parent;
287 if ( parent != NULL ) {
288 return parent->CountDepth( ) + 1;
289 }
290 return depth;
291 }
292
293void printTree( File* treeRoot ) {
294 auto depth = treeRoot->CountDepth( );

Callers 1

printTreeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected