meetingrequest/mrversit2/src/cesmricaltimezoneinterval.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 CESMRICalTimeZoneInterval.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Class include.
       
    20 #include "emailtrace.h"
       
    21 #include "cesmricaltimezoneinterval.h"	// CESMRICalTimeZoneInterval
       
    22 
       
    23 //debug
       
    24 
       
    25 // User includes.
       
    26 #include "esmricalkeywords.h"			// Literals
       
    27 
       
    28 /**
       
    29 Static factory construction
       
    30 @param aType The type of time zone interval.
       
    31 @return A new timezone interval component
       
    32 @leave Leaves with KErrCorrupt if the requested component is invalid.
       
    33 @internalTechnology
       
    34 */
       
    35 CESMRICalTimeZoneInterval* CESMRICalTimeZoneInterval::NewLC(TICalComponentType aType, TICalMethod aMethod)
       
    36 	{
       
    37     FUNC_LOG;
       
    38 	
       
    39 	if ((aType != EICalDaylight) && (aType != EICalStandard))
       
    40 		{
       
    41 		User::Leave(KErrCorrupt);
       
    42 		}
       
    43 
       
    44 	CESMRICalTimeZoneInterval* self = new (ELeave) CESMRICalTimeZoneInterval(aType);
       
    45 	CleanupStack::PushL(self);
       
    46 	self->ConstructL(aMethod);
       
    47 	
       
    48 	return self;
       
    49 	}
       
    50 
       
    51 /**
       
    52 Destructor
       
    53 @internalTechnology
       
    54 */
       
    55 CESMRICalTimeZoneInterval::~CESMRICalTimeZoneInterval()
       
    56 	{
       
    57     FUNC_LOG;
       
    58 	}
       
    59 
       
    60 /**
       
    61 Constructor
       
    62 @param aType The type of time zone interval.
       
    63 @internalTechnology
       
    64 */
       
    65 CESMRICalTimeZoneInterval::CESMRICalTimeZoneInterval(TICalComponentType aType)
       
    66 	{
       
    67     FUNC_LOG;
       
    68 	
       
    69 	iComponentType = aType;
       
    70 	
       
    71 	}
       
    72 
       
    73 /**
       
    74 Internal construction
       
    75 @internalTechnology
       
    76 */
       
    77 void CESMRICalTimeZoneInterval::ConstructL(TICalMethod aMethod)
       
    78 	{
       
    79     FUNC_LOG;
       
    80 	
       
    81 	iMethod = aMethod;
       
    82 	iComponentMethodBitMask = EMaskTimezoneIntervalAny;
       
    83 	
       
    84 	}
       
    85 
       
    86 /**
       
    87 Checks that the iCalendar specification allows this calendar component to
       
    88 contain the property aName.
       
    89 @param aName the name of the property to validate.
       
    90 @return ETrue if the property is valid for this component, otherwise EFalse
       
    91 @internalTechnology
       
    92 */
       
    93 TBool CESMRICalTimeZoneInterval::ValidatePropertyImpl(const TDesC& aName) const
       
    94 	{
       
    95     FUNC_LOG;
       
    96 	
       
    97 	if ((aName.CompareF(KICalDtstart) == 0) || (aName.CompareF(KICalTzoffsetto) == 0) ||
       
    98 		(aName.CompareF(KICalTzoffsetfrom) == 0) || (aName.CompareF(KICalComment) == 0) ||
       
    99 		(aName.CompareF(KICalRdate) == 0) || (aName.CompareF(KICalRRule) == 0) ||
       
   100 		(aName.CompareF(KICalTzname) == 0))
       
   101 		{
       
   102 		//	1		dtstart / tzoffsetto / tzoffsetfrom
       
   103 		//	0..1	comment / rdate / rrule / tzname
       
   104 		return (FindProperty(aName) == NULL);
       
   105 		}
       
   106 
       
   107 	if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0))
       
   108 		{
       
   109 		//	0..*	X-[anything]
       
   110 		return ETrue;
       
   111 		}
       
   112 
       
   113 	// If we got this far we didn't match any of the possible property names
       
   114 	return EFalse;
       
   115 	}
       
   116 
       
   117 /**
       
   118 Checks that the iCalendar specification allows this calendar component to
       
   119 contain a nested component of type aType.
       
   120 @param aType the type of component to validate.
       
   121 @return ETrue if the component is a valid child for this component, otherwise
       
   122 EFalse.
       
   123 @internalTechnology
       
   124 */
       
   125 TBool CESMRICalTimeZoneInterval::ValidateComponent(TICalComponentType /*aType*/) const
       
   126 	{
       
   127     FUNC_LOG;
       
   128 	// DAYLIGHT or STANDARD components cannot contain other components.
       
   129 	return EFalse;
       
   130 	}
       
   131 	
       
   132 // End of file
       
   133 
       
   134