messagingfw/msgsrvnstore/server/inc/msvcachevisiblefolder.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CMSVCACHEVISIBLEFOLDER.H
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CMSVCACHEVISIBLEFOLDER_H__
       
    19 #define __CMSVCACHEVISIBLEFOLDER_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32std.h>
       
    23 #include <msvstd.h>
       
    24 #include <flogger.h>
       
    25 
       
    26 /**
       
    27 Forward declarations.
       
    28 */
       
    29 class CMsvCacheIndexTableEntry;
       
    30 class CMsvDBAdapter;
       
    31 class CMsvCacheEntry;
       
    32 
       
    33 
       
    34 
       
    35 /**
       
    36 Provides the implementation of the Cache Visible Folder list.
       
    37 
       
    38 This Class represents the list of visible folders, which holds the information
       
    39 about the blocks and childrens which it corresponds to.
       
    40 
       
    41 @internalComponent
       
    42 @prototype
       
    43 */
       
    44 NONSHARABLE_CLASS (CMsvCacheVisibleFolder) : public CBase
       
    45 	{
       
    46 public:
       
    47 	static CMsvCacheVisibleFolder* NewL(TMsvId aId);
       
    48 	static CMsvCacheVisibleFolder* NewL(TMsvId aId, RPointerArray<CMsvCacheEntry>& aEntries);
       
    49 	~CMsvCacheVisibleFolder();
       
    50 	
       
    51 	void AddEntryL(CMsvCacheEntry*& aEntry,  TBool aReplace = EFalse);
       
    52 	void AddEntryListL(RPointerArray<CMsvCacheEntry>& aEntries, TBool aIsCompleteChildOfFolder = EFalse);
       
    53 	TBool GetEntry(TMsvId aId, CMsvCacheEntry*& aEntry);
       
    54 	TBool GetChildrenL(TMsvId aId, CMsvDBAdapter* aDbAdapter, RPointerArray<CMsvCacheEntry>& aEntries);
       
    55 	TBool GetChildrenIdL(CMsvEntrySelection& aSelection);
       
    56 	void DeleteEntryL(TMsvId aId, TBool aForceDelete = EFalse);
       
    57 	void DeleteEntryListL(CMsvEntrySelection& aEntrySelection);
       
    58 	TBool EntryExists(TMsvId aId) const;
       
    59 	TBool IsAllBlocksDirty() const;
       
    60 	TBool ReleaseAllBlocks(TInt& aCount);
       
    61 	TInt ReleaseBlocks(TInt aNumberOfEntriesToRelease, TBool& aIsFolderEmpty);
       
    62 	void UpdateChildMsvIdsL(TMsvId aParentId, TMsvId aChildId, TBool aAppend = ETrue);
       
    63 	void UpdateChildMsvIdsL(RPointerArray<CMsvCacheEntry>& aEntries);
       
    64 	void SplitBlockL();
       
    65 	RPointerArray<CMsvCacheIndexTableEntry>* GetIndexTableEntry();
       
    66 	inline TBool IsComplete() const;
       
    67 	inline void SetComplete(TBool aStatus);
       
    68 	inline TMsvId GetFolderId() const;	
       
    69 	inline void SetGetChildrenFromVisibleFolder(TBool aFlag);
       
    70 	inline TBool GetChildrenFromVisibleFolder();
       
    71 
       
    72 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)
       
    73 	inline TUint GetDrive() const;
       
    74 	inline void SetDrive(TUint aDriveId);
       
    75 #endif
       
    76 
       
    77 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
       
    78 #ifdef _DEBUG
       
    79 	void Print(RFileLogger& aLogger);
       
    80 #endif
       
    81 #endif
       
    82 
       
    83 private:
       
    84 	CMsvCacheVisibleFolder(TMsvId aId);
       
    85 	void ConstructL(RPointerArray<CMsvCacheEntry>& aEntries);
       
    86 	void SplitAndAppendL(RPointerArray<CMsvCacheEntry>& aEntryList, TInt aInitIndex=0);
       
    87 public:
       
    88 	TDblQueLink  iDlink;
       
    89 	static const TInt iOffset;
       
    90 
       
    91 private:
       
    92 	TMsvId iVisibleFolderId;
       
    93 	TInt8 iFlags;
       
    94 	TTime iAccessTime;
       
    95 	RPointerArray<CMsvCacheIndexTableEntry> iIndexTable;
       
    96 
       
    97 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)
       
    98 	TUint iDriveId;
       
    99 #endif
       
   100 
       
   101 	enum 
       
   102 		{	
       
   103 		EMsvCacheVisibleFolderClearFlag				= 0X00,
       
   104 		EMsvCacheVisibleFolderComplete				= 0X02,
       
   105 		EMsvCacheVisibleFolderClearComplete			= 0XF9,
       
   106 		EMsvGetChildrenFromVisibleFolder			= 0X04,
       
   107 		};
       
   108 
       
   109 private:
       
   110 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
       
   111 	friend class CTestVisibleFolder; //only for testing
       
   112 #endif
       
   113 	};
       
   114 
       
   115 
       
   116 #include "msvcachevisiblefolder.Inl"
       
   117 
       
   118 #endif // __CMSVCACHEVISIBLEFOLDER_H__
       
   119 
       
   120