pimappservices/calendar/server/inc/agsindexbase.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 __AGSINDEXBASE_H__
       
    17 #define __AGSINDEXBASE_H__
       
    18 
       
    19 #include "agsindexkey.h"
       
    20 
       
    21 // ----------------------------------- Referenced classes ----------------------
       
    22 class CAgnSimpleEntry;
       
    23 class CAgnEntry;
       
    24 class CAgnSimpleEntryAllocator;
       
    25 
       
    26 // ------------------------- CAgnIndex<Entry, Key, KeyValue> -------------------
       
    27 class CAgnIndex : public CBase
       
    28 	{
       
    29 public:
       
    30 	CAgnIndex(TAgnKeyBase<CAgnSimpleEntry,TTime>& aKey,MAgnCalendarTimeMode::TTimeMode aTimeMode);
       
    31 	~CAgnIndex();
       
    32 	TBool AddL(CAgnSimpleEntry* const aEntry);
       
    33 	TBool FindL(const TTime& aDate, TInt& aPos,TBool aFirst = ETrue) const;
       
    34 	virtual TBool FirstL(TTime& aDate, TInt& aPos) const;
       
    35 	virtual TBool FirstLessOrEqualL(TTime& aDate, TInt& aPos) const;
       
    36 	virtual TBool NextL(TTime& aDate, TInt& aPos) const;
       
    37 	virtual TBool PreviousL(TTime& aDate, TInt& aPos) const;
       
    38 	void GetKeyValueL(TInt Pos, TTime& aDate) const;
       
    39 	virtual void GetKeyValueL(CAgnSimpleEntry* const, TTime& aDate) const;
       
    40 	TBool DeleteEntry(CAgnSimpleEntry* const aEntry); 
       
    41 	
       
    42 	virtual TBool IsValid(const CAgnSimpleEntry* aInfo) const;
       
    43 	TInt Count() const;
       
    44 	TBool AppendL(CAgnSimpleEntry* const aEntry);
       
    45 	CAgnSimpleEntry* operator[](TInt anIndex) const;
       
    46 	CAgnSimpleEntry* Get(TInt anIndex) const;
       
    47 	void Delete(TInt aPos);
       
    48 	void Compress();
       
    49 	void Reset();
       
    50 	void SetUndatedTodoTime(TTime& aUndatedTodoTime);
       
    51 
       
    52 	MAgnCalendarTimeMode::TTimeMode TimeMode() const;
       
    53 
       
    54 	void InternalizeL(RReadStream& aReadStream, CAgnSimpleEntryAllocator* aAllocator);
       
    55 	void ExternalizeL(RWriteStream& aWriteStream) const;
       
    56 
       
    57 protected:
       
    58 	void ConstructL();
       
    59 	TBool FirstValidL(TTime& aKeyValue, TInt& aPos) const;
       
    60 private:
       
    61 	TInt FindWithEntry(CAgnSimpleEntry* const aEntry);
       
    62 	CArrayFixSeg<CAgnSimpleEntry*>* Array() const;
       
    63 	
       
    64 private:
       
    65 	CArrayFixSeg<CAgnSimpleEntry*>* iArray;
       
    66 	TAgnKeyBase<CAgnSimpleEntry,TTime>& iKey;						// defines the index ordering
       
    67 	const MAgnCalendarTimeMode::TTimeMode iTimeMode;
       
    68 	};
       
    69 
       
    70 #endif