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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__CNTFLDST_H__)
17 #define __CNTFLDST_H__
19 #if !defined(__E32BASE_H__)
23 #if !defined(__BAMDESCA_H__)
27 #if !defined(__S32STD_H__)
31 #if !defined(__CNTDEF_H__)
34 #define KTextStreamSeparator 0x00
40 class CContactFieldStorage : public CBase
41 /** Abstract base class for the different types of contact field data storage.
43 CContactTextField, CContactStoreField, CContactAgentField, CContactDateField
44 and CContactNumberField are all derived from this class.
46 A pointer to the base class can be obtained by calling CContactItemField::Storage().
47 Pointers to the derived classes can be retrieved by calling CContactItemField::TextStorage(),
48 CContactItemField::StoreStorage() etc.
54 /** Internalises the field data.
56 @param aStream Stream from which the the contents of the field should be internalised. */
57 virtual void InternalizeL( RReadStream& aStream)=0;
58 /** Externalises the field data.
60 @param aStream Write stream to which the contents of the field should be externalised. */
61 virtual void ExternalizeL(RWriteStream& aStream) const=0;
62 /** Stores the field data.
64 @param aStore Reference to the stream store to which the field data is written.
65 @return The ID of the stream store. */
66 virtual TStreamId StoreL(CStreamStore& aStore) const=0;
67 /** Restores the field data.
69 @param aStore Reference to the store from which the object is to be restored.
70 @param aStream Reference to the stream which should be passed to InternalizeL(). */
71 virtual void RestoreL(CStreamStore& aStore,RReadStream& aStream)=0;
72 /** Tests whether the field storage contains data.
74 @return True if the field storage contains data, false if not. */
75 virtual TBool IsFull() const=0;
77 IMPORT_C virtual void CContactFieldStorage_Reserved1();
78 TAny* CContactFieldStorage_Reserved;
81 class CContactTextField : public CContactFieldStorage
82 /** Provides access to the text stored in a contact item field.
84 An object of this class can be retrieved using CContactItemField::TextStorage().
90 IMPORT_C ~CContactTextField();
92 void InternalizeL(HBufC *aTextStream,TInt aTextFieldIndex);
93 void InternalizeL(RReadStream& aStream);
94 void ExternalizeL(RWriteStream& aStream) const;
95 void ExternalizeL(RWriteStream& aStream,TBool aIsInlineBlob,TInt aTextFieldIndex) const;
96 TStreamId StoreL(CStreamStore& aStore) const;
97 void RestoreL(CStreamStore& aStore,RReadStream& aStream);
98 IMPORT_C void SetTextL(const TDesC& aText);
99 IMPORT_C void SetText(HBufC *aHbuf);
100 IMPORT_C void SetTextArray(MDesCArray* anArray);
101 IMPORT_C TPtrC Text() const;
102 TBool IsFull() const;
103 IMPORT_C TPtrC StandardTextLC() const;
104 IMPORT_C void SetStandardTextL(const TDesC& aText);
105 IMPORT_C void SetStandardTextArray(MDesCArray* anArray);
107 HBufC *EncodeL(const TDesC& aText,TUid aConversion) const;
108 IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
113 class CContactStoreField : public CContactFieldStorage
114 /** Provides access to the binary field data stored in an 8-bit descriptor.
116 An object of this class can be retrieved using CContactItemField::StoreStorage().
122 ~CContactStoreField();
123 TStreamId StoreL(CStreamStore& aStore) const;
124 void RestoreL(CStreamStore& aStore,RReadStream& aStream);
125 IMPORT_C void SetThingL(const TDesC8& aDes);
126 IMPORT_C void SetThingL(const HBufC8& aDes);
127 IMPORT_C void SetThingL(const CBufBase* aBuf);
128 IMPORT_C HBufC8* Thing() const;
129 void InternalizeL(RReadStream& aStream);
130 void ExternalizeL(RWriteStream& aStream) const;
131 TBool IsFull() const;
133 IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
138 class CContactAgentField : public CContactFieldStorage
139 /** Provides access to an agent ID.
141 An agent is a field in a contact item which contains another person's
142 contact details. It corresponds to the agent property in the vCard
143 specification (version 2.1). The agent is identified by an agent ID
146 An object of this class can be retrieved using CContactItemField::AgentStorage().
152 TStreamId StoreL(CStreamStore& aStore) const;
153 void RestoreL(CStreamStore& aStore,RReadStream& aStream);
154 IMPORT_C void SetAgentId(TContactItemId aId);
155 IMPORT_C TContactItemId Value() const;
156 void InternalizeL( RReadStream& aStream);
157 void ExternalizeL(RWriteStream& aStream) const;
158 TBool IsFull() const;
160 IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
162 TContactItemId iAgentId;
165 class CContactDateField : public CContactFieldStorage
166 /** Provides access to the date/time value stored in a contact item field.
168 An object of this class can be retrieved using CContactItemField::DateTimeStorage().
175 TStreamId StoreL(CStreamStore& aStore) const;
176 void RestoreL(CStreamStore& aStore,RReadStream& aStream);
177 IMPORT_C void SetTime(TTime aTime);
178 IMPORT_C void SetTime(TDateTime aDateTime);
179 IMPORT_C TTime Time() const;
180 void InternalizeL( RReadStream& aStream);
181 void ExternalizeL(RWriteStream& aStream) const;
182 TBool IsFull() const;
184 IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();