meetingrequest/mrversit2/src/cesmrical.cpp
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: This file implements class CESMRICal.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Class include.
       
    20 #include "emailtrace.h"
       
    21 #include "cesmrical.h"	// CESMRICal
       
    22 
       
    23 //debug
       
    24 
       
    25 // System includes.
       
    26 #include <s32strm.h>	// RWriteStream
       
    27 
       
    28 // User includes.
       
    29 #include "cesmricalbase.h"				// TICalComponentType
       
    30 #include "esmricalkeywords.h"			// Literals
       
    31 #include "cesmricalcontentlinewriter.h"	// CESMRICalContentLineWriter
       
    32 
       
    33 /**
       
    34 Static factory construction
       
    35 @return A new CESMRICal
       
    36 @publishedPartner
       
    37 */
       
    38 EXPORT_C CESMRICal* CESMRICal::NewL()
       
    39 	{
       
    40     FUNC_LOG;
       
    41 	
       
    42 	CESMRICal* self = CESMRICal::NewLC();
       
    43 	CleanupStack::Pop(self);
       
    44 	
       
    45 	return self;
       
    46 	}
       
    47 
       
    48 /**
       
    49 Static factory construction
       
    50 @return A new CESMRICal
       
    51 @publishedPartner
       
    52 */
       
    53 EXPORT_C CESMRICal* CESMRICal::NewLC()
       
    54 	{
       
    55     FUNC_LOG;
       
    56 	
       
    57 	CESMRICal* self = new (ELeave) CESMRICal;
       
    58 	CleanupStack::PushL(self);
       
    59 	self->ConstructL();
       
    60 	
       
    61 	return self;
       
    62 	}
       
    63 	
       
    64 EXPORT_C void CESMRICal::SetMethodL(TICalMethod aMethod)
       
    65 	{
       
    66     FUNC_LOG;
       
    67 	
       
    68 	iMethod = aMethod;
       
    69 	
       
    70 	}
       
    71 
       
    72 /**
       
    73 Destructor
       
    74 @internalTechnology
       
    75 */
       
    76 CESMRICal::~CESMRICal()
       
    77 	{
       
    78     FUNC_LOG;
       
    79 	}
       
    80 	
       
    81 	
       
    82 
       
    83 /**
       
    84 Creates a CESMRICalContentLineWriter from aWriteStream and calls
       
    85 CICalbase::Externalize with it.
       
    86 @param aWriteStream The stream to externalize to.
       
    87 @publishedPartner
       
    88 */
       
    89 EXPORT_C void CESMRICal::ExternalizeL(RWriteStream& aWriteStream)
       
    90 	{
       
    91     FUNC_LOG;
       
    92 	
       
    93 	CESMRICalContentLineWriter* writer = CESMRICalContentLineWriter::NewLC(aWriteStream);
       
    94 	CESMRICalBase::ExternalizeL(*writer);
       
    95 	CleanupStack::PopAndDestroy(writer);
       
    96 	
       
    97 	}
       
    98 
       
    99 /**
       
   100 Constructor
       
   101 @internalTechnology
       
   102 */
       
   103 CESMRICal::CESMRICal()
       
   104 	{
       
   105     FUNC_LOG;
       
   106 	
       
   107 	iComponentType = EICalCalendar;
       
   108 	
       
   109 	}
       
   110 
       
   111 /**
       
   112 Internal construction
       
   113 @internalTechnology
       
   114 */
       
   115 void CESMRICal::ConstructL()
       
   116 	{
       
   117     FUNC_LOG;
       
   118 	}
       
   119 	
       
   120 /**
       
   121 Checks that the iCalendar specification allows this calendar component to
       
   122 contain the property aName
       
   123 @param aName the name of the property to validate
       
   124 @return ETrue if the property is valid for this component, otherwise EFalse
       
   125 @internalTechnology
       
   126 */
       
   127 TBool CESMRICal::ValidatePropertyImpl(const TDesC& aName) const
       
   128 	{
       
   129     FUNC_LOG;
       
   130 	
       
   131 	 if ((aName.CompareF(KICalProdId) == 0) || (aName.CompareF(KICalVersion) == 0) ||
       
   132 	 	(aName.CompareF(KICalCalscale) == 0) || (aName.CompareF(KICalMethod) == 0))
       
   133 		{
       
   134 		//	1	PRODID
       
   135 		//	1	VERSION
       
   136 		//	0..1	CALSCALE
       
   137 		//	0..1	METHOD
       
   138 		return (FindProperty(aName) == NULL);
       
   139 		}
       
   140 
       
   141 	if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0))
       
   142 		{
       
   143 		//	0..*	X-[anything]
       
   144 		return ETrue;
       
   145 		}
       
   146 
       
   147 	// If we got this far we didn't match any of the possible property names
       
   148 	return EFalse;	
       
   149 	}
       
   150 	
       
   151 /**
       
   152 Checks that the iCalendar specification allows this calendar component to
       
   153 contain a nested component of type aType.
       
   154 @param aType the type of component to validate.
       
   155 @return ETrue if the component is a valid child for this component, otherwise
       
   156 EFalse.
       
   157 @internalTechnology
       
   158 */
       
   159 TBool CESMRICal::ValidateComponent(TICalComponentType aType) const
       
   160 	{
       
   161     FUNC_LOG;
       
   162 	// VCALENDAR can have all components nested except another VCALENDAR or a VALARM, STANDARD or DAYLIGHT.
       
   163 	// However, we also return false for invalid components.
       
   164 	return ((aType != EICalCalendar) &&
       
   165 			(aType != EICalAlarm) &&
       
   166 			(aType != EICalStandard) &&
       
   167 			(aType != EICalDaylight) &&
       
   168 			(aType != EICalInvalid));
       
   169 	}
       
   170 	
       
   171 // End of File
       
   172