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