messagingfw/msgsrvnstore/server/inc/msvcacheindextableentry.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     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 // CMSVCACHEINDEXTABLEENTRY.H
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CMSVCACHEINDEXTABLEENTRY_H__
       
    19 #define __CMSVCACHEINDEXTABLEENTRY_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <msvstd.h>
       
    23 #include <flogger.h>
       
    24 
       
    25 class CMsvCacheEntry;
       
    26 
       
    27 /**
       
    28 Provides the implementation of the Cache Index Table.
       
    29 
       
    30 The class implements a row in a folder's index table.
       
    31 The class holds information about each child block associated with the folder. 
       
    32 This class is used by CMsvCacheVisibleFolder.
       
    33 
       
    34 @internalComponent
       
    35 @prototype
       
    36 */
       
    37 NONSHARABLE_CLASS (CMsvCacheIndexTableEntry) : public CBase
       
    38 	{
       
    39 public:
       
    40 	static CMsvCacheIndexTableEntry* NewL();
       
    41 	static CMsvCacheIndexTableEntry* NewL(CMsvCacheEntry*& aEntry);
       
    42 	static CMsvCacheIndexTableEntry* NewLC(CMsvCacheEntry*& aEntry);
       
    43 	static CMsvCacheIndexTableEntry* NewL(RPointerArray<CMsvCacheEntry>& aEntries, TInt aInitIndex = 0, TInt aCount = -1);
       
    44 	static CMsvCacheIndexTableEntry* NewLC(RPointerArray<CMsvCacheEntry>& aEntries, TInt aInitIndex = 0, TInt aCount = -1);
       
    45 	~CMsvCacheIndexTableEntry();
       
    46 	
       
    47 	void AddEntryL(CMsvCacheEntry*& aEntry, TBool aReplace = EFalse);
       
    48 	void AddEntrySetL(RPointerArray<CMsvCacheEntry>& aEntries, TInt aInitIndex = 0, TInt aCount = -1);
       
    49 	TBool GetEntry(TMsvId aId, CMsvCacheEntry*& aEntry);
       
    50 	void GetChildrenL(TMsvId aParentId, RPointerArray<CMsvCacheEntry>& aEntries) /*const*/;
       
    51 	void SortBlock();
       
    52 	TBool EntryExists(TMsvId aId) const;
       
    53 	void UpdateChildMsvIdsL(TMsvId aParentId, TMsvId aChildId, TBool aAdd = ETrue);
       
    54 	void UpdateChildMsvIdsL(RPointerArray<CMsvCacheEntry>& aEntries);
       
    55 	void DeleteEntryL(TMsvId aId, TMsvId& aParentIdOfEntry, TBool aForceDelete = EFalse);
       
    56 	TBool ReleaseBlock(TBool aForceRelease = EFalse);
       
    57 	void SplitBlockL(RPointerArray<CMsvCacheEntry>& aSplitBlock);
       
    58 	inline TBool IsInRange(TMsvId aId) const;
       
    59 	inline TBool IsDirty() const;
       
    60 	inline void SetDirty();
       
    61 	inline void ClearDirty();
       
    62 	inline void ClearFlags();
       
    63 	inline TMsvId GetMinMsvIdRange() const;
       
    64 	inline TMsvId GetMaxMsvIdRange() const;
       
    65 	inline TInt Size() const;
       
    66 	inline void SetGrandChildPresent();
       
    67 	inline void ClearGrandChildPresent();
       
    68 	inline TBool IsGrandChildPresent() const;
       
    69 	inline void SetMinMsvIdRange(TMsvId aId);
       
    70 	inline void SetMaxMsvIdRange(TMsvId aId);	
       
    71 	inline RPointerArray<CMsvCacheEntry>* BlockPtr();
       
    72 	inline const TTime AccessTime() const;
       
    73 	inline void SetAccessTime(TTime aNewTime);
       
    74 	
       
    75 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
       
    76 #ifdef _DEBUG	
       
    77 	void Print(RFileLogger& aLogger);
       
    78 #endif
       
    79 #endif
       
    80 
       
    81 private:
       
    82 	CMsvCacheIndexTableEntry();
       
    83 	void ConstructL(RPointerArray<CMsvCacheEntry>& aEntries);
       
    84 
       
    85 public:
       
    86 	enum
       
    87 		{	
       
    88 		EMsvCacheIndexTableClearFlag		= 0x0000,
       
    89 		EMsvCacheIndexTableSetDirtyFlag		= 0x0001,
       
    90 		EMsvCacheIndexTableClearDirtyFlag	= 0xFFFE,
       
    91 		EMsvCacheIndexTableEntrySetGrandChildPresent = 0x0002,
       
    92 		EMsvCacheIndexTableEntryClearGrandChildPresent = 0xFFFD,
       
    93 		};
       
    94 		
       
    95 private:
       
    96 	TTime iTimeStamp;
       
    97 	TMsvId iMinMsvId;
       
    98 	TMsvId iMaxMsvId;
       
    99 	TInt16 iFlags;
       
   100 	RPointerArray<CMsvCacheEntry>* iBlockPtr; 
       
   101 
       
   102 private:	
       
   103 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
       
   104 	friend class CTestIndexTableEntry; //only for testing
       
   105 #endif
       
   106 	};
       
   107 
       
   108 
       
   109 
       
   110 #include "msvcacheindextableentry.Inl"
       
   111 
       
   112 #endif // __CMSVCACHEINDEXTABLEENTRY_H__