diff -r ebe688cedc25 -r 7fdbb852d323 messagingappbase/smartmessaging/vrec/src/vrec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingappbase/smartmessaging/vrec/src/vrec.cpp Wed Sep 01 12:31:54 2010 +0100 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Recognizer for vCalendar and vCard. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "vrec.h" +#include "VRecLog.h" + +#include +#include +#include + +// CONSTANTS +const TUid KUidVREC = {0x101F4CF5}; + +// maximum amount of buffer space we will ever use +// Value estimated on observation of iCal userid lengths +const TInt KMaxBufferLength = 255; + +const TText8* const mimeTypes[] = + { + _S8("text/X-vCard"), + _S8("text/calendar"), // iCalendar MIME type (RFC 2445) + _S8("text/x-vCalendar") // vCalendar v1.0 MIME type + }; + +_LIT8(KDataTypeVCard, "text/X-vCard"); +_LIT8(KDataTypeVCalendar2, "text/x-vCalendar"); // vCalendar v1.0 MIME type +_LIT8(KDataTypeVCalendar3, "text/calendar"); // vCalendar v2.0 MIME type + +_LIT8(KBegin, "BEGIN"); +_LIT8(KVCalendar, "VCALENDAR"); +_LIT8(KBeginVCard, "BEGIN:VCARD"); +_LIT8(KVersionICal, "VERSION:2.0"); + +/** +* VCalendar definition from vCalendar spec v1.0 +* ws = 1*(SPACE / HTAB) +* wsls = 1*(SPACE / HTAB / CRLF) +* vcal_file = [wsls] vcal [wsls] +* vcal = "BEGIN"[ws]":"[ws] "VCALENDAR" [ws] 1*CRLF +* calprop calenties [ws] *CRLF +* "END" [ws] ":" [ws] "VCALENDAR" [ws] 1*CRLF +*/ +// ============================ MEMBER FUNCTIONS =============================== +CVRec::CVRec() + :CApaDataRecognizerType(KUidVREC, CApaDataRecognizerType::ELow) + { + iCountDataTypes = sizeof(mimeTypes)/sizeof(TText*); + LOG1("CVRec::iCountDataTypes: %d", iCountDataTypes); + } + +TUint CVRec::PreferredBufSize() + { + return KMaxBufferLength; + } + +TDataType CVRec::SupportedDataTypeL(TInt aIndex) const + { + __ASSERT_DEBUG(aIndex>=0 && aIndex