phonebookengines_old/contactsmodel/inc/CNTFLDST.H
branchGCC_SURGE
changeset 41 d11de32a5e6f
parent 40 b46a585f6909
equal deleted inserted replaced
38:11319788d38f 41:d11de32a5e6f
       
     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 #if !defined(__CNTFLDST_H__)
       
    17 #define __CNTFLDST_H__
       
    18 
       
    19 #if !defined(__E32BASE_H__)
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 
       
    23 #if !defined(__BAMDESCA_H__)
       
    24 #include <bamdesca.h>
       
    25 #endif
       
    26 
       
    27 #if !defined(__S32STD_H__)
       
    28 #include <s32std.h>
       
    29 #endif
       
    30 
       
    31 #if !defined(__CNTDEF_H__)
       
    32 #include <cntdef.h>
       
    33 #endif
       
    34 #define KTextStreamSeparator 0x00
       
    35 
       
    36 
       
    37 
       
    38 class CStreamStore;
       
    39 
       
    40 class CContactFieldStorage : public CBase
       
    41 /** Abstract base class for the different types of contact field data storage. 
       
    42 
       
    43 CContactTextField, CContactStoreField, CContactAgentField, CContactDateField 
       
    44 and CContactNumberField are all derived from this class.
       
    45 
       
    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. 
       
    49 @publishedAll
       
    50 @released
       
    51 */
       
    52 	{
       
    53 public:
       
    54 	/** Internalises the field data.
       
    55 	
       
    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.
       
    59 	
       
    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.
       
    63 	
       
    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.
       
    68 	
       
    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.
       
    73 	
       
    74 	@return True if the field storage contains data, false if not. */
       
    75 	virtual TBool IsFull() const=0;
       
    76 private:
       
    77 	IMPORT_C virtual void CContactFieldStorage_Reserved1();
       
    78 	TAny* CContactFieldStorage_Reserved;
       
    79 	};
       
    80 
       
    81 class CContactTextField : public CContactFieldStorage
       
    82 /** Provides access to the text stored in a contact item field. 
       
    83 
       
    84 An object of this class can be retrieved using CContactItemField::TextStorage(). 
       
    85 @publishedAll
       
    86 @released
       
    87 */
       
    88 	{
       
    89 public:
       
    90 	IMPORT_C ~CContactTextField();
       
    91 public: 
       
    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);
       
   106 private:
       
   107 	HBufC *EncodeL(const TDesC& aText,TUid aConversion) const;
       
   108 	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
       
   109 private:
       
   110 	HBufC* iText;
       
   111 	};
       
   112 
       
   113 class CContactStoreField : public CContactFieldStorage
       
   114 /** Provides access to the binary field data stored in an 8-bit descriptor. 
       
   115 
       
   116 An object of this class can be retrieved using CContactItemField::StoreStorage(). 
       
   117 @publishedAll
       
   118 @released
       
   119 */
       
   120 	{
       
   121 public:
       
   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;
       
   132 private:
       
   133 	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
       
   134 private:
       
   135 	HBufC8* iThing;
       
   136 	};
       
   137 
       
   138 class CContactAgentField : public CContactFieldStorage
       
   139 /** Provides access to an agent ID. 
       
   140 
       
   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 
       
   144 (a TContactItemId).
       
   145 
       
   146 An object of this class can be retrieved using CContactItemField::AgentStorage(). 
       
   147 @publishedAll
       
   148 @released
       
   149 */
       
   150 	{
       
   151 public:
       
   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;
       
   159 private:
       
   160 	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
       
   161 private:
       
   162 	TContactItemId iAgentId;
       
   163 	};
       
   164 
       
   165 class CContactDateField : public CContactFieldStorage
       
   166 /** Provides access to the date/time value stored in a contact item field. 
       
   167 
       
   168 An object of this class can be retrieved using CContactItemField::DateTimeStorage(). 
       
   169 @publishedAll
       
   170 @released
       
   171 */
       
   172 	{
       
   173 public:
       
   174 	CContactDateField();
       
   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;
       
   183 private:
       
   184 	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
       
   185 private:
       
   186 	TTime iTime;
       
   187 	};
       
   188 
       
   189 
       
   190 
       
   191 #endif