epoc32/include/app/vcard.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 __VCARD_H__
    17 #define __VCARD_H__
    18 
    19 #ifndef __VERSIT_H__
    20 #include <versit.h>
    21 #endif
    22 
    23 #include <vobserv.h>
    24 
    25 
    26 /** This constant is for internal use only.
    27 @internalTechnology
    28 */
    29 _LIT(KVersitTokenVCardVersionNo, "2.1");
    30 
    31 
    32 class CVCard3ParserPlugIn;
    33 
    34 //
    35 // CParserVCard
    36 //
    37 class CParserVCard : public CVersitParser
    38 /** A vCard parser. 
    39 
    40 Adds support for property groups (see CParserGroupedProperty) and agents 
    41 (see CParserPropertyValueAgent) to the functionality of CVersitParser. 
    42 
    43 Provides a constructor and overrides CVersitParser::InternalizeL(),   
    44 ExternalizeL(), RecognizeToken(), ConvertAllPropertyDateTimesToMachineLocalL(), 
    45 ParsePropertyL() and MakePropertyValueL().
    46 
    47 The vCard data is read from or written to a stream or file, using the InternalizeL() 
    48 and ExternalizeL() functions. Most users of this class will only need to use 
    49 these functions.
    50 
    51 If you are sequentially creating and destroying multiple parsers, a major performance 
    52 improvement may be achieved by using thread local storage to store an instance of 
    53 CVersitUnicodeUtils which persists and can be used by all of the parsers.
    54 
    55 See CVersitTlsData for more information. 
    56 @publishedAll
    57 @released
    58 */
    59 	{
    60 public:
    61 	IMPORT_C static CParserVCard* NewL();
    62 	static CParserVCard* NewL(TBool aParsingAgent);
    63 	IMPORT_C CArrayPtr<CParserProperty>* GroupOfPropertiesL(const TDesC8& aName) const;
    64 public: //from CVersitParser
    65 	IMPORT_C void InternalizeL(RReadStream& aStream);
    66 	IMPORT_C void ExternalizeL(RWriteStream& aStream);
    67 	IMPORT_C void ConvertAllPropertyDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
    68 protected:
    69 	IMPORT_C virtual CParserPropertyValue* MakePropertyValueAgentL(TPtr16 aValue);
    70 	IMPORT_C CDesC8Array* GetGroupNamesL(TPtr8& aGroupsAndName);
    71 protected: // from CVersitParser
    72 	IMPORT_C void ParsePropertyL();
    73 	IMPORT_C CParserPropertyValue* MakePropertyValueL(const TUid& aPropertyUid,HBufC16*& aValue);
    74     IMPORT_C CParserPropertyValue* MakePropertyValueSoundL(HBufC16*& aValue);
    75 public: //from CVersitParser
    76 	IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
    77 	IMPORT_C void ConvertDateTimesToMachineLocalAndDeleteTZL();
    78 protected:
    79 	CParserVCard();
    80 	CParserVCard(TBool aParsingAgent);
    81 private: // from CVersitParser
    82 	IMPORT_C virtual void Reserved1();
    83 	IMPORT_C virtual void Reserved2();
    84 	TBool iParsingAgent;
    85 	};
    86 
    87 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    88 NONSHARABLE_CLASS(CParserVCard3) : public CParserVCard
    89 /** A vCard 3.0 parser. 
    90 
    91 Overrides CParserVCard::InternalizeL(). Internalizing of vCard 3.0
    92 objects is not supported
    93 
    94 @internalTechnology
    95 @released
    96 */
    97 	{
    98 public:
    99 	IMPORT_C static CParserVCard3* NewL();
   100 	~CParserVCard3();
   101 	
   102 public: //from CParserVCard
   103 	IMPORT_C void InternalizeL(RReadStream& aStream);
   104 	
   105 private:
   106 	CParserVCard3();
   107 	void ConstructL();
   108 	void CreateParserPlugInL();
   109 
   110 private:
   111 	CVCard3ParserPlugIn* iPlugInImpl;
   112 	};
   113 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS	
   114 //
   115 // CParserGroupedProperty
   116 //
   117 class CParserGroupedProperty : public CParserProperty
   118 /** A grouped property.
   119 
   120 This is a vCard property which may be a member of one or more property groups. 
   121 It owns an array of descriptors, each of which identifies a group 
   122 to which the property belongs.
   123 
   124 An example of how grouped properties may be useful is for a person with two 
   125 homes. Each home has an address and telephone number, both of which are to 
   126 be stored on the vCard. The address and telephone number are grouped for each 
   127 home. A prefix for the address and telephone number properties is provided: 
   128 one for each home. Each prefix is stored as a property group.
   129 
   130 When the property is externalised, the identities of all the groups to which 
   131 the property belongs (i.e. the prefixes) are written to the stream before 
   132 CParserProperty::ExternalizeL() is called.
   133 
   134 The class also provides a function which can be used to test whether 
   135 the property is a member of a given group.
   136 
   137 Note that the vCard parser stores all properties using this class; if the 
   138 vCard property is not grouped then the array of property groups is empty. 
   139 Conversely, the vCalender parser does not have property groups, and so stores 
   140 all properties using the CParserProperty base class. 
   141 @publishedAll
   142 @released
   143 */
   144 	{
   145 public:
   146 	IMPORT_C static CParserGroupedProperty* NewL(CParserPropertyValue& aPropertyValue, const TDesC8& aName, CDesC8Array* aArrayOfGroups, CArrayPtr<CParserParam>* aArrayOfParams);
   147 	IMPORT_C CParserGroupedProperty(CDesC8Array* aArrayOfGroups, CArrayPtr<CParserParam>* aArrayOfParams);
   148 	IMPORT_C ~CParserGroupedProperty();
   149 	IMPORT_C TBool Group(const TDesC8& aGroup) const;
   150 	inline void SetGroups(CDesC8Array* aArrayOfGroups);
   151 	inline const CDesC8Array* Groups();
   152 public: //from CParserProperty
   153 	IMPORT_C TBool SupportsInterface(const TUid& aInterfaceUid) const;
   154 	IMPORT_C void ExternalizeL(RWriteStream& aStream, CVersitParser* aVersitParser = NULL);
   155 protected:
   156 	CParserGroupedProperty(CParserPropertyValue& aPropertyValue, CDesC8Array* aArrayOfGroups, CArrayPtr<CParserParam>* aArrayOfParams);
   157 private: //from CParserProperty
   158 	IMPORT_C virtual void Reserved();
   159 protected:
   160 	CDesC8Array* iArrayOfGroups;
   161 	};
   162 
   163 //
   164 // CParserPropertyValueAgent
   165 //
   166 class CParserPropertyValueAgent : public CParserPropertyValue
   167 /** An agent property value parser. 
   168 
   169 An agent property value contains information about a person who is not the 
   170 main subject of the vCard. It is implemented as a vCard nested within another 
   171 vCard. The agent's vCard is held in the property value of the parent vCard.
   172 
   173 We do not support nested agents when parsing an agent's vcard.
   174 
   175 The UID for an agent property value is KVCardPropertyAgentUid. 
   176 @publishedAll
   177 @released
   178 */
   179 	{
   180 public:
   181 	IMPORT_C CParserPropertyValueAgent(CParserVCard* aValue);
   182 	IMPORT_C ~CParserPropertyValueAgent();
   183 	inline CParserVCard* Value() const;
   184 
   185 public: // from CParserPropertyValue
   186 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/);
   187 protected:
   188 	CParserVCard* iValue;
   189 private:
   190 	};
   191 
   192 #include <vcard.inl>
   193 
   194 #endif