epoc32/include/cntfldst.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/cntfldst.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/cntfldst.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,191 @@
     1.4 -cntfldst.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#if !defined(__CNTFLDST_H__)
    1.21 +#define __CNTFLDST_H__
    1.22 +
    1.23 +#if !defined(__E32BASE_H__)
    1.24 +#include <e32base.h>
    1.25 +#endif
    1.26 +
    1.27 +#if !defined(__BAMDESCA_H__)
    1.28 +#include <bamdesca.h>
    1.29 +#endif
    1.30 +
    1.31 +#if !defined(__S32STD_H__)
    1.32 +#include <s32std.h>
    1.33 +#endif
    1.34 +
    1.35 +#if !defined(__CNTDEF_H__)
    1.36 +#include <cntdef.h>
    1.37 +#endif
    1.38 +#define KTextStreamSeparator 0x00
    1.39 +
    1.40 +
    1.41 +
    1.42 +class CStreamStore;
    1.43 +
    1.44 +class CContactFieldStorage : public CBase
    1.45 +/** Abstract base class for the different types of contact field data storage. 
    1.46 +
    1.47 +CContactTextField, CContactStoreField, CContactAgentField, CContactDateField 
    1.48 +and CContactNumberField are all derived from this class.
    1.49 +
    1.50 +A pointer to the base class can be obtained by calling CContactItemField::Storage(). 
    1.51 +Pointers to the derived classes can be retrieved by calling CContactItemField::TextStorage(), 
    1.52 +CContactItemField::StoreStorage() etc. 
    1.53 +@publishedAll
    1.54 +@released
    1.55 +*/
    1.56 +	{
    1.57 +public:
    1.58 +	/** Internalises the field data.
    1.59 +	
    1.60 +	@param aStream Stream from which the the contents of the field should be internalised. */
    1.61 +    virtual void InternalizeL( RReadStream& aStream)=0;
    1.62 +	/** Externalises the field data.
    1.63 +	
    1.64 +	@param aStream Write stream to which the contents of the field should be externalised. */
    1.65 +    virtual void ExternalizeL(RWriteStream& aStream) const=0;
    1.66 +	/** Stores the field data.
    1.67 +	
    1.68 +	@param aStore Reference to the stream store to which the field data is written.
    1.69 +	@return The ID of the stream store. */
    1.70 +	virtual TStreamId StoreL(CStreamStore& aStore) const=0;
    1.71 +	/** Restores the field data.
    1.72 +	
    1.73 +	@param aStore Reference to the store from which the object is to be restored.
    1.74 +	@param aStream Reference to the stream which should be passed to InternalizeL(). */
    1.75 +	virtual void RestoreL(CStreamStore& aStore,RReadStream& aStream)=0;
    1.76 +	/** Tests whether the field storage contains data.
    1.77 +	
    1.78 +	@return True if the field storage contains data, false if not. */
    1.79 +	virtual TBool IsFull() const=0;
    1.80 +private:
    1.81 +	IMPORT_C virtual void CContactFieldStorage_Reserved1();
    1.82 +	TAny* CContactFieldStorage_Reserved;
    1.83 +	};
    1.84 +
    1.85 +class CContactTextField : public CContactFieldStorage
    1.86 +/** Provides access to the text stored in a contact item field. 
    1.87 +
    1.88 +An object of this class can be retrieved using CContactItemField::TextStorage(). 
    1.89 +@publishedAll
    1.90 +@released
    1.91 +*/
    1.92 +	{
    1.93 +public:
    1.94 +	IMPORT_C ~CContactTextField();
    1.95 +public: 
    1.96 +	void InternalizeL(HBufC *aTextStream,TInt aTextFieldIndex);
    1.97 +	void InternalizeL(RReadStream& aStream);
    1.98 +	void ExternalizeL(RWriteStream& aStream) const;
    1.99 +    void ExternalizeL(RWriteStream& aStream,TBool aIsInlineBlob,TInt aTextFieldIndex) const;
   1.100 +	TStreamId StoreL(CStreamStore& aStore) const;
   1.101 +	void RestoreL(CStreamStore& aStore,RReadStream& aStream);
   1.102 +	IMPORT_C void SetTextL(const TDesC& aText);
   1.103 +	IMPORT_C void SetText(HBufC *aHbuf);
   1.104 +	IMPORT_C void SetTextArray(MDesCArray* anArray);
   1.105 +	IMPORT_C TPtrC Text() const;
   1.106 +	TBool IsFull() const;
   1.107 +	IMPORT_C TPtrC StandardTextLC() const;
   1.108 +	IMPORT_C void SetStandardTextL(const TDesC& aText);
   1.109 +	IMPORT_C void SetStandardTextArray(MDesCArray* anArray);
   1.110 +private:
   1.111 +	HBufC *EncodeL(const TDesC& aText,TUid aConversion) const;
   1.112 +	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
   1.113 +private:
   1.114 +	HBufC* iText;
   1.115 +	};
   1.116 +
   1.117 +class CContactStoreField : public CContactFieldStorage
   1.118 +/** Provides access to the binary field data stored in an 8-bit descriptor. 
   1.119 +
   1.120 +An object of this class can be retrieved using CContactItemField::StoreStorage(). 
   1.121 +@publishedAll
   1.122 +@released
   1.123 +*/
   1.124 +	{
   1.125 +public:
   1.126 +	~CContactStoreField();
   1.127 +	TStreamId StoreL(CStreamStore& aStore) const;
   1.128 +	void RestoreL(CStreamStore& aStore,RReadStream& aStream);
   1.129 +	IMPORT_C void SetThingL(const TDesC8& aDes);
   1.130 +	IMPORT_C void SetThingL(const HBufC8& aDes);
   1.131 +	IMPORT_C void SetThingL(const CBufBase* aBuf);
   1.132 +	IMPORT_C HBufC8* Thing() const; 
   1.133 +	void InternalizeL(RReadStream& aStream);
   1.134 +    void ExternalizeL(RWriteStream& aStream) const;
   1.135 +	TBool IsFull() const;
   1.136 +private:
   1.137 +	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
   1.138 +private:
   1.139 +	HBufC8* iThing;
   1.140 +	};
   1.141 +
   1.142 +class CContactAgentField : public CContactFieldStorage
   1.143 +/** Provides access to an agent ID. 
   1.144 +
   1.145 +An agent is a field in a contact item which contains another person's 
   1.146 +contact details. It corresponds to the agent property in the vCard 
   1.147 +specification (version 2.1). The agent is identified by an agent ID 
   1.148 +(a TContactItemId).
   1.149 +
   1.150 +An object of this class can be retrieved using CContactItemField::AgentStorage(). 
   1.151 +@publishedAll
   1.152 +@released
   1.153 +*/
   1.154 +	{
   1.155 +public:
   1.156 +	TStreamId StoreL(CStreamStore& aStore) const;
   1.157 +	void RestoreL(CStreamStore& aStore,RReadStream& aStream);
   1.158 +	IMPORT_C void SetAgentId(TContactItemId aId);
   1.159 +	IMPORT_C TContactItemId Value() const;
   1.160 +	void InternalizeL( RReadStream& aStream);
   1.161 +    void ExternalizeL(RWriteStream& aStream) const;
   1.162 +	TBool IsFull() const;
   1.163 +private:
   1.164 +	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
   1.165 +private:
   1.166 +	TContactItemId iAgentId;
   1.167 +	};
   1.168 +
   1.169 +class CContactDateField : public CContactFieldStorage
   1.170 +/** Provides access to the date/time value stored in a contact item field. 
   1.171 +
   1.172 +An object of this class can be retrieved using CContactItemField::DateTimeStorage(). 
   1.173 +@publishedAll
   1.174 +@released
   1.175 +*/
   1.176 +	{
   1.177 +public:
   1.178 +	CContactDateField();
   1.179 +	TStreamId StoreL(CStreamStore& aStore) const;
   1.180 +	void RestoreL(CStreamStore& aStore,RReadStream& aStream);
   1.181 +	IMPORT_C void SetTime(TTime aTime);
   1.182 +	IMPORT_C void SetTime(TDateTime aDateTime);
   1.183 +	IMPORT_C TTime Time() const;
   1.184 +	void InternalizeL( RReadStream& aStream);
   1.185 +    void ExternalizeL(RWriteStream& aStream) const;
   1.186 +	TBool IsFull() const;
   1.187 +private:
   1.188 +	IMPORT_C /*virtual*/ void CContactFieldStorage_Reserved1();
   1.189 +private:
   1.190 +	TTime iTime;
   1.191 +	};
   1.192 +
   1.193 +
   1.194 +
   1.195 +#endif