/** Implementation of pure virtual function. @see MWTCacheInterface::Control() */ TInt CDynamicDirCache::Control(TUint32 aFunction, TUint32 aParam1, TAny* aParam2) { TInt r = KErrNotSupported; #ifdef _DEBUG (void)aParam2; switch(aFunction) { // disable / enable cache, for debug // if aParam1 != 0 cache will be disabled, enabled otherwise case EDisableCache: iCacheDisabled = aParam1 ? 1 : 0; r = KErrNone; break; // dump cache, for debug case EDumpCache: { RFs fs; fs.Connect(); const TUint32 debugRegister = DebugRegister(); fs.SetDebugRegister(debugRegister|KFSYS); Dump(); fs.SetDebugRegister(debugRegister); fs.Close(); break; } case ECacheInfo: { RFs fs; fs.Connect(); const TUint32 debugRegister = DebugRegister(); fs.SetDebugRegister(debugRegister|KFSYS); Info(); fs.SetDebugRegister(debugRegister); fs.Close(); break; } default: __PRINT1(_L("CDynamicDirCache::Control() invalid function: %d"), aFunction); ASSERT(0); break; } #else (void)aFunction; //-- supress warnings (void)aParam1; (void)aParam2; User::Invariant(); //-- don't call this method in release build #endif //_DEBUG return r; }
/* Print out current tree content */ void CLeafDirTree::DumpTreeContentL() const { RPointerArray<CLeafDirTreeNode>* nodeStack = new(ELeave) RPointerArray<CLeafDirTreeNode>(4); RFs fs; TInt nRes = fs.Connect(); User::LeaveIfError(nRes); const TUint32 debugRegister = DebugRegister(); fs.SetDebugRegister(debugRegister|KFSYS); if (iRoot != NULL) { nodeStack->Insert(iRoot, 0); while(nodeStack->Count() > 0) { CLeafDirTreeNode* current = (*nodeStack)[0]; if (current->Parent() != NULL) { __PRINT3(_L("(\"%S\") -> \"%S\" : (%d)\n"), ¤t->Parent()->Path(), ¤t->Path(), current->StartClusterNum()); } else { __PRINT2(_L("\"%S\" : (%d)\n"), ¤t->Path(), current->StartClusterNum()); } nodeStack->Remove(0); TInt currentCount = current->Children().Count(); if (currentCount > 0) { RPointerArray<CLeafDirTreeNode> children = current->Children(); for (TInt i = 0; i < currentCount; i++) { nodeStack->Insert(children[i], 0); } } } } fs.SetDebugRegister(debugRegister); fs.Close(); nodeStack->Close(); delete nodeStack; }