pimappservices/calendar/shared/inc/agmgsentry.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 2004-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 __AGMGSENTRY_H__
       
    17 #define __AGMGSENTRY_H__
       
    18 
       
    19 #include "agmcalendartime.h"
       
    20 #include "calentry.h"
       
    21 
       
    22 class CAgnEntry;
       
    23 
       
    24 /**
       
    25 Class representing a child entry's unique id and its recurrence id. Held by parent classes.
       
    26 @internalComponent
       
    27 @released
       
    28 */	
       
    29 NONSHARABLE_CLASS(TGsChildRefData)
       
    30 	{
       
    31 public:
       
    32 
       
    33 	IMPORT_C TGsChildRefData(TCalLocalUid aChildId, const TAgnCalendarTime& aRecurId);
       
    34 	IMPORT_C TCalLocalUid ChildId() const;
       
    35 	IMPORT_C const TAgnCalendarTime& RecurrenceId() const;
       
    36 	
       
    37 private:
       
    38 	TCalLocalUid 	 	iChildId;        
       
    39 	TAgnCalendarTime	iRecurrenceId;    	
       
    40 	};
       
    41 	
       
    42 
       
    43 /**
       
    44 Abstract base class for storing group scheduling data.
       
    45 Parent entries contain data about all their child entries (modifying entries) - this is a list of local IDs.
       
    46 Child entries contain data about how they modiy their parent entry - their recurrence ID and range.
       
    47 Both types of entries contain a GUID, sequence number and method.
       
    48 
       
    49 @internalComponent
       
    50 @released
       
    51 */
       
    52 NONSHARABLE_CLASS (CGsData) : public CBase  
       
    53 	{
       
    54 public:
       
    55 
       
    56 	enum TGsDataType
       
    57 		{
       
    58 		EParent,
       
    59 		EChild
       
    60 		};
       
    61 		
       
    62 	virtual ~CGsData();
       
    63 
       
    64 	// These methods are common to child and parent entries - parent entries have a default (NULL) recurrence ID
       
    65 	// and default recurrence range of 'this only'
       
    66 	virtual TGsDataType GsDataType() const = 0;
       
    67 	virtual void CopyDataL(const CGsData& aSource) = 0;
       
    68 	virtual TAgnCalendarTime RecurrenceId() const = 0;
       
    69 	virtual CalCommon::TRecurrenceRange RecurrenceRange() const = 0;
       
    70 
       
    71 	void SetSequenceNumber(TInt aNum);
       
    72 	TInt SequenceNumber() const;
       
    73 
       
    74 	void SetMethod(CCalEntry::TMethod aMethod);
       
    75 	CCalEntry::TMethod Method() const;
       
    76 
       
    77 	void ExternalizeL(RWriteStream& aStream) const;
       
    78 	void InternalizeL(RReadStream& aStream);
       
    79 
       
    80 	void ExternalizeToBufferL(RWriteStream& aStream) const;
       
    81 	void InternalizeFromBufferL(RReadStream& aStream);
       
    82 	
       
    83 	const TDesC8& Guid() const;
       
    84  	void SetGuid(HBufC8* aGuid); // takes ownership
       
    85 	
       
    86 protected:
       
    87 	CGsData(TInt aSeq, CCalEntry::TMethod aMethod); 
       
    88 	CGsData();
       
    89 
       
    90 private:
       
    91 	virtual void InternalizeTypeSpecificDataL(RReadStream& aStream, TBool aFromBuffer)  = 0;
       
    92 	virtual void ExternalizeTypeSpecificDataL(RWriteStream& aStream, TBool aToBuffer) const = 0;
       
    93 
       
    94 private:
       
    95 	HBufC8* 				iGuid; 
       
    96 	TInt					iSeqNum;
       
    97 	CCalEntry::TMethod  	iMethod; 
       
    98 	};
       
    99  
       
   100 /**
       
   101 Class representing a child entry's group scheduling data.
       
   102 @internalComponent
       
   103 @released
       
   104 */ 
       
   105 NONSHARABLE_CLASS (CGsChildData) : public CGsData
       
   106 	{
       
   107 public:	
       
   108     
       
   109     // GsChild methods
       
   110     static CGsChildData* NewL(); //Used by CAgnEntry before internalise the object from the stream
       
   111   	static CGsChildData* NewL(HBufC8* aUid, TInt aSeq, CCalEntry::TMethod aMethod, const TAgnCalendarTime& aRecurrenceId, CalCommon::TRecurrenceRange aRecurrenceRange);
       
   112   	
       
   113 	TCalLocalUid ParentId() const;
       
   114 	void SetParentId(TCalLocalUid aParentId);
       
   115 	void SetRecurrenceId(const TAgnCalendarTime& aRecId);
       
   116 	void SetRecurrenceRange(CalCommon::TRecurrenceRange aRecurrenceRange);
       
   117 
       
   118 	// From CGsEntryData
       
   119 	CGsData::TGsDataType GsDataType() const;
       
   120 	void CopyDataL(const CGsData& aSource);
       
   121 	TAgnCalendarTime RecurrenceId() const;
       
   122 	CalCommon::TRecurrenceRange RecurrenceRange() const;
       
   123 	
       
   124 private:
       
   125 	CGsChildData();
       
   126 	CGsChildData(TInt aSeq, CCalEntry::TMethod aMethod, const TAgnCalendarTime& aRecurrenceId, CalCommon::TRecurrenceRange aRecurrenceRange);
       
   127 
       
   128 	// From CGsEntryData
       
   129 	void ExternalizeTypeSpecificDataL(RWriteStream& aStream, TBool aToBuffer) const;
       
   130 	void InternalizeTypeSpecificDataL(RReadStream& aStream, TBool aFromBuffer);
       
   131 
       
   132 private:
       
   133 	TAgnCalendarTime			iRecurrenceId;
       
   134 	CalCommon::TRecurrenceRange iRecurrenceRange;	
       
   135 	TCalLocalUid 	 			iParentId;    		
       
   136 	};
       
   137 	
       
   138 /**
       
   139 Class representing a parent entry's group scheduling data.
       
   140 @internalComponent
       
   141 @released
       
   142 */ 
       
   143 NONSHARABLE_CLASS (CGsParentData) : public CGsData  
       
   144 	{
       
   145 public:
       
   146  	static CGsParentData* NewL();
       
   147  	static CGsParentData* NewL(HBufC8* aUid, TInt aSeqNum, CCalEntry::TMethod aMethod);   
       
   148     ~CGsParentData();
       
   149     
       
   150 	const RArray<TGsChildRefData>& ChildIds() const;
       
   151  	void RemoveChildId(TCalLocalUid aId);
       
   152 	void AddChildIdL(const TGsChildRefData& aChildData);
       
   153 
       
   154 	// From CGsEntryData
       
   155 	CGsData::TGsDataType GsDataType() const;
       
   156 	void CopyDataL(const CGsData& aSource);
       
   157 	TAgnCalendarTime RecurrenceId() const;
       
   158 	CalCommon::TRecurrenceRange RecurrenceRange() const;
       
   159 
       
   160 private:
       
   161 	CGsParentData(TInt aSeqNum, CCalEntry::TMethod aMethod);
       
   162 	CGsParentData();
       
   163 	void ConstructL();
       
   164     TInt FindChildId(TCalLocalUid aChildId) const;
       
   165 
       
   166 	// From CGsEntryData
       
   167 	void ExternalizeTypeSpecificDataL(RWriteStream& aStream, TBool aToBuffer) const;
       
   168 	void InternalizeTypeSpecificDataL(RReadStream& aStream, TBool aFromBuffer);
       
   169   
       
   170 private:
       
   171 	RArray<TGsChildRefData>* iChildIds;
       
   172 	}; 	
       
   173 
       
   174 #endif // __AGMGSENTRY_H__
       
   175