// VCARD.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//
 
#if !defined(__VCARD_H__)
#define __VCARD_H__

#if !defined(__VERSIT_H__)
#include "versit.h"
#endif

#define KVersitTokenVCardVersionNo _L("2.1")

//
// CParserVCard
//

class CParserVCard : public CVersitParser
	{
public:
	IMPORT_C CParserVCard();
	IMPORT_C CArrayPtr<CParserProperty>* GroupOfPropertiesL(const TDesC& aName) const;
public: //from CVersitParser
	IMPORT_C void InternalizeL(RReadStream& aStream);
	IMPORT_C void ExternalizeL(RWriteStream& aStream);
	IMPORT_C void ConvertAllPropertyDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
protected:
	IMPORT_C HBufC* CParserVCard::GetPropertyNameAndGroupsL(CDesCArray& aArrayOfGroups);
	IMPORT_C CParserPropertyValue* MakePropertyValueAgentL();
protected: // from CVersitParser
	IMPORT_C void ParsePropertyL(TBool& aPropertyParsed);
	IMPORT_C CParserPropertyValue* MakePropertyValueL(const TUid& aPropertyUid);
	IMPORT_C TUid RecognizeCurrentTokenL() const;
	};

//
// CParserGroupedProperty
//

class CParserGroupedProperty : public CParserProperty
	{
public:
	IMPORT_C CParserGroupedProperty(CParserPropertyValue* aPropertyValue,const TDesC& aName,CDesCArray* aArrayOfGroups,CArrayPtr<CParserParam>* aArrayOfParams);

	IMPORT_C static CParserGroupedProperty* CParserGroupedProperty::NewL(CParserPropertyValue* aPropertyValue, const TDesC& aName, CDesCArray* aArrayOfGroups, CArrayPtr<CParserParam>* aArrayOfParams);
	IMPORT_C static CParserGroupedProperty* CParserGroupedProperty::NewLC(CParserPropertyValue* aPropertyValue, const TDesC& aName, CDesCArray* aArrayOfGroups, CArrayPtr<CParserParam>* aArrayOfParams);
	IMPORT_C ~CParserGroupedProperty();
	IMPORT_C TBool Group(const TDesC& aGroup) const;
public: //from CParserProperty
	IMPORT_C TBool SupportsInterface(const TUid& aInterfaceUid) const;
	IMPORT_C void ExternalizeL(RWriteStream& aStream);
private:
	CParserGroupedProperty();
protected:
	CDesCArray* iArrayOfGroups;
	};

//
// CParserPropertyValueAgent
//

class CParserPropertyValueAgent : public CParserPropertyValue
	{
public:
	IMPORT_C CParserPropertyValueAgent(CParserVCard* aValue);
	IMPORT_C ~CParserPropertyValueAgent();
	inline CParserVCard* Value() const;	
public: // from CParserPropertyValue
	IMPORT_C void ExternalizeL(RWriteStream& aStream,const TUid& /*aEncodingUid*/);
protected:
	CParserVCard* iValue;
	};

inline CParserVCard* CParserPropertyValueAgent::Value() const
	{return iValue;}
inline TVersitDateTime* CParserPropertyValueDate::Value() const
	{return iValue;}

#endif
