pimappservices/calendar/server/inc/agsindex.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 1997-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 //
       
    15 
       
    16 #ifndef __AGSINDEX_H__
       
    17 #define __AGSINDEX_H__
       
    18 
       
    19 #include "agsindexbase.h"
       
    20 #include <calcommon.h>
       
    21 #include "agsextractor.h"
       
    22 
       
    23 // -------------------------------- Local classes ------------------------------
       
    24 
       
    25 class CAgnEntry;
       
    26 class CAgnEntryNonRptIndex;
       
    27 class CAgnEntryRptIndex;
       
    28 class CAgnSimpleEntry;
       
    29 class CAgnSimpleEntryAllocator;
       
    30 class CAgnSimpleEntryTable;
       
    31 class CAgnTodoNonRptIndex;
       
    32 class CAgnTodoRptIndex;
       
    33 class CAgnLocalUidIndex;
       
    34 class CGsGuidHashIndex;
       
    35 class TAgnFilter;
       
    36 class TAgnInstanceExtractorBase;
       
    37 class TAgnKeyEntryInfo;
       
    38 class CAgnTzRuleIndex;
       
    39 
       
    40 // -------------------------------- Referenced classes--------------------------
       
    41 
       
    42 class CAgnEntryModel;
       
    43 
       
    44 //-------------------------------- CAgnEntryNonRptIndex-----------------------------
       
    45 //
       
    46 class CAgnEntryNonRptIndex : public CAgnIndex
       
    47 	{
       
    48 public:
       
    49 	static CAgnEntryNonRptIndex* NewL(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    50 	
       
    51 	// from CAgnIndex
       
    52 	TBool IsValid(const CAgnSimpleEntry* aEntry) const;
       
    53 private:
       
    54 	CAgnEntryNonRptIndex(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    55 private:
       
    56 	TAgnKeyStartDate iKey;
       
    57 	};
       
    58 //-------------------------------- CAgnEntryRptIndex-----------------------------
       
    59 //
       
    60 class CAgnEntryRptIndex : public CAgnIndex
       
    61 	{
       
    62 public:
       
    63 	static CAgnEntryRptIndex* NewL(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    64 
       
    65 	// from CAgnIndex
       
    66 	TBool IsValid(const CAgnSimpleEntry* aEntry) const;
       
    67 private:
       
    68 	CAgnEntryRptIndex(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    69 private:
       
    70 	TAgnKeyRptDate iKey;
       
    71 	};
       
    72 
       
    73 //-------------------------------- CAgnTodoNonRptIndex -------------------------
       
    74 class CAgnTodoNonRptIndex : public CAgnIndex
       
    75 	{
       
    76 public:
       
    77 	static CAgnTodoNonRptIndex* NewL(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    78 
       
    79 	// from CAgnIndex
       
    80 	TBool IsValid(const CAgnSimpleEntry* aEntry) const;
       
    81 	TBool FirstL(TTime& aKeyValue, TInt& aPos) const;
       
    82     TBool NextL(TTime& aKeyValue, TInt& aPos) const;
       
    83 private:
       
    84 	CAgnTodoNonRptIndex(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    85 private:
       
    86 	TAgnKeyTodoNonRptDate iKey;
       
    87 	};
       
    88 
       
    89 //-------------------------------- CAgnTodoRptIndex-----------------------------
       
    90 //
       
    91 class CAgnTodoRptIndex : public CAgnIndex
       
    92 	{
       
    93 public:
       
    94 	static CAgnTodoRptIndex* NewL(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    95 
       
    96 	// from CAgnIndex
       
    97 	TBool IsValid(const CAgnSimpleEntry* aEntry) const;
       
    98 private:
       
    99 	CAgnTodoRptIndex(MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
   100 private:
       
   101 	TAgnKeyRptDate iKey;
       
   102 	};
       
   103 
       
   104 //-------------------------------- CAgnSimpleEntryTable --------------------------
       
   105 
       
   106 class CAgnSimpleEntryTable : public CBase
       
   107 	{
       
   108 	// friend classes for iterating through entries
       
   109 	friend class TAgnEntryDateIterator;
       
   110 	
       
   111 public:
       
   112 
       
   113 	enum TAgnSimpleEntryIndex
       
   114 		{
       
   115 		EAgnEntryNonRptFixedIndex,
       
   116 		EAgnEntryRptFixedIndex,
       
   117 		EAgnTodoNonRptFixedIndex,
       
   118 		EAgnTodoRptFixedIndex,
       
   119 		EAgnEntryNonRptFloatingIndex,
       
   120 		EAgnEntryRptFloatingIndex,
       
   121 		EAgnTodoNonRptFloatingIndex,
       
   122 		EAgnTodoRptFloatingIndex,
       
   123 		EAgnMaxIndex,
       
   124 		};
       
   125 
       
   126 	static CAgnSimpleEntryTable* NewL(CAgnEntryModel& aEntryModel);
       
   127 	~CAgnSimpleEntryTable();
       
   128 	
       
   129 	void  AddEntryL(const CAgnEntry& aEntry);	
       
   130 	void  DeleteEntry(const TAgnEntryId& aId);
       
   131 
       
   132  	void  Commit();
       
   133 	void  Reset();		// clear all entries from indices
       
   134 
       
   135 	CAgnSimpleEntry* GetEntry(const TAgnEntryId& aEntryId) const;
       
   136 	CAgnSimpleEntry* GetEntry(TCalLocalUid aUniqueId) const;
       
   137 
       
   138 	void  FindByLastModifiedDateUtcL(const TTime& aLastModifiedDateUtcFilter, 
       
   139 								  	 RArray<TCalLocalUid>& aFoundIdList) const;
       
   140 	void  FindByHashL(const TUint32& aGuidHash, RArray<TAgnEntryId>& aFoundIdList) const;								  	
       
   141 	
       
   142 	void  GetFilteredIndexListL(RArray<TInt>& aIndexList,const TAgnFilter& aFilter) const;
       
   143 	CAgnInstanceExtractor* GetExtractor(TInt aEntryIndex,MAgnCalendarTimeMode::TTimeMode aTimeMode, const TAgnFilter& aFilter, const TTime& aUndatedTodoTime);
       
   144 
       
   145 	void InternalizeL(RReadStream& aReadStream, CAgnTzRuleIndex* aTzRuleIndex);
       
   146 	void ExternalizeL(RWriteStream& aWriteStream) const;
       
   147 
       
   148 private:
       
   149 
       
   150 	// constructor
       
   151 	CAgnSimpleEntryTable(CAgnEntryModel& aAgnEntryModel);
       
   152 	void ConstructL();
       
   153 
       
   154 	void AddEntryL(CAgnSimpleEntry* aSimpleEntry);
       
   155 	// Delete entry
       
   156 	void DeleteEntryFromIndexes(CAgnSimpleEntry* aEntry);
       
   157 
       
   158 	TBool Find(const TAgnEntryId& aId, TInt& aPos) const;
       
   159 
       
   160 	static TInt CompareEntries(const CAgnSimpleEntry& aLeft, const CAgnSimpleEntry& aRight);
       
   161 	
       
   162 	CAgnIndex* Index(TInt aIndex) const;
       
   163 	CAgnIndex* EntryNonRptIndex(const MAgnCalendarTimeMode::TTimeMode aTimeMode) const;
       
   164 	CAgnIndex* EntryRptIndex(const MAgnCalendarTimeMode::TTimeMode aTimeMode) const;
       
   165 	CAgnIndex* TodoNonRptIndex(const MAgnCalendarTimeMode::TTimeMode aTimeMode) const;
       
   166 	CAgnIndex* TodoRptIndex(const MAgnCalendarTimeMode::TTimeMode aTimeMode) const;
       
   167 
       
   168 	RPointerArray<CAgnIndex>			iIndexes;
       
   169 	RPointerArray<CAgnSimpleEntry>		iArray;
       
   170 	CAgnSimpleEntry*					iFindEntry;
       
   171 	CAgnSimpleEntryAllocator*			iSimpleEntryAllocator;
       
   172 
       
   173 	CAgnInstanceExtractor*				iNonRptExtractor;
       
   174 	CAgnInstanceExtractor*				iRptExtractor;
       
   175 	CAgnInstanceExtractor*				iTodoNonRptExtractor;
       
   176 	CAgnInstanceExtractor*				iTodoRptExtractor;
       
   177 	
       
   178 	CAgnLocalUidIndex*					iLocalUidIndex;
       
   179     CGsGuidHashIndex*					iGuidHashIdIndex;	
       
   180 	CAgnEntryModel* 					iOwningModel;  	// the entry model that owns this table
       
   181 														// used for updating the cached index
       
   182 
       
   183 	};
       
   184 
       
   185 #endif