calendarengines/versit2/src/ICalFreeBusy.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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:   Implements the definition of CICalFreeBusy. It deals with FreeBusy attribute of a calendar event.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // Class include.
       
    21 #include "ICalFreeBusy.h"	// CICalFreeBusy
       
    22 
       
    23 //debug
       
    24 #include "calendarengines_debug.h"
       
    25 
       
    26 // User includes
       
    27 #include "ICalKeyWords.h"			// Literals
       
    28 
       
    29 /**
       
    30 Static factory construction
       
    31 @return A new CICalFreeBusy
       
    32 @internalTechnology
       
    33 */
       
    34 CICalFreeBusy* CICalFreeBusy::NewLC(TICalMethod aMethod)
       
    35 	{
       
    36 	TRACE_ENTRY_POINT;
       
    37 	
       
    38 	CICalFreeBusy* self = new (ELeave) CICalFreeBusy;
       
    39 	CleanupStack::PushL(self);
       
    40 	self->ConstructL(aMethod);
       
    41 	
       
    42 	TRACE_EXIT_POINT;
       
    43 	return self;
       
    44 	}
       
    45 
       
    46 /**
       
    47 Destructor
       
    48 @internalTechnology
       
    49 */
       
    50 CICalFreeBusy::~CICalFreeBusy()
       
    51 	{
       
    52 	TRACE_ENTRY_POINT;
       
    53 	TRACE_EXIT_POINT;
       
    54 	}
       
    55 
       
    56 /**
       
    57 Constructor
       
    58 @internalTechnology
       
    59 */
       
    60 CICalFreeBusy::CICalFreeBusy()
       
    61 	{
       
    62 	TRACE_ENTRY_POINT;
       
    63 	
       
    64 	iComponentType = EICalFreeBusy;
       
    65 	
       
    66 	TRACE_EXIT_POINT;
       
    67 	}
       
    68 
       
    69 /**
       
    70 Internal construction
       
    71 @internalTechnology
       
    72 */
       
    73 void CICalFreeBusy::ConstructL(TICalMethod aMethod)
       
    74 	{
       
    75 	TRACE_ENTRY_POINT;
       
    76 	
       
    77 	iMethod = aMethod;
       
    78 	switch(iMethod)
       
    79 		{
       
    80 		case EMethodNone:
       
    81 			iComponentMethodBitMask = EMaskFreeBusyNone;
       
    82 			break;
       
    83 		case EMethodPublish:
       
    84 			iComponentMethodBitMask = EMaskFreeBusyPublish;
       
    85 			break;
       
    86 		case EMethodRequest:
       
    87 			iComponentMethodBitMask = EMaskFreeBusyRequest;
       
    88 			break;
       
    89 		case EMethodReply:
       
    90 			iComponentMethodBitMask = EMaskFreeBusyReply;
       
    91 			break;
       
    92 		default:
       
    93 			// This is invalid should we leave?
       
    94 			iComponentMethodBitMask = 0;
       
    95 			break;
       
    96 		}
       
    97 		
       
    98 	TRACE_EXIT_POINT;
       
    99 	}
       
   100 	
       
   101 /**
       
   102 Checks that the iCalendar specification allows this calendar component to
       
   103 contain the property aName
       
   104 @param aName the name of the property to validate
       
   105 @return ETrue if the property is valid for this component, otherwise EFalse
       
   106 @internalTechnology
       
   107 */
       
   108 TBool CICalFreeBusy::ValidatePropertyImpl(const TDesC& aName) const
       
   109 	{
       
   110 	TRACE_ENTRY_POINT;
       
   111 	
       
   112 	if ((aName.CompareF(KICalContact) == 0) || (aName.CompareF(KICalDtstart) == 0) ||
       
   113 		(aName.CompareF(KICalDtend) == 0) || (aName.CompareF(KICalDuration) == 0) ||
       
   114 		(aName.CompareF(KICalDtstamp) == 0) || (aName.CompareF(KICalOrganizer) == 0) ||
       
   115 		(aName.CompareF(KICalUid) == 0) || (aName.CompareF(KICalUrl) == 0))
       
   116 		{
       
   117 		//	0..1	CONTACT
       
   118 		//	0..1	DTSTART
       
   119 		//	0..1	DTEND
       
   120 		//	0..1	DURATION
       
   121 		//	0..1	DTSTAMP
       
   122 		//	0..1	ORGANIZER
       
   123 		//	0..1	UID
       
   124 		//	0..1	URL
       
   125 		TRACE_EXIT_POINT;
       
   126 		return (FindProperty(aName) == NULL);
       
   127 		}
       
   128 	else if ((aName.CompareF(KICalAttendee) == 0) || (aName.CompareF(KICalComment) == 0) ||
       
   129 		(aName.CompareF(KICalFreebusy) == 0) || (aName.CompareF(KICalRequeststatus) == 0))
       
   130 		{
       
   131 		//	0..*	ATTENDEE
       
   132 		//	0..*	COMMENT
       
   133 		//	0..*	FREEBUSY
       
   134 		//	0..*	REQUEST-STATUS
       
   135 		TRACE_EXIT_POINT;
       
   136 		return ETrue;
       
   137 		}
       
   138 
       
   139 	if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0))
       
   140 		{
       
   141 		//	0..*	X-[anything]
       
   142 		TRACE_EXIT_POINT;
       
   143 		return ETrue;
       
   144 		}
       
   145 
       
   146 	// If we got this far we didn't match any of the possible property names
       
   147 	TRACE_EXIT_POINT;
       
   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 CICalFreeBusy::ValidateComponent(TICalComponentType /*aType*/) const
       
   160 	{
       
   161 	TRACE_ENTRY_POINT;
       
   162 	TRACE_EXIT_POINT;
       
   163 	// VFREEBUSY cannot contain other components.
       
   164 	return EFalse;
       
   165 	}
       
   166 
       
   167 // End of File