pimappservices/calendar/shared/src/agmcalendarinfoproperty.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "agmcalendarinfoproperty.h"
       
    17 
       
    18 CAgnCalendarInfoProperty* CAgnCalendarInfoProperty::NewLC(const TDesC8& aKey)
       
    19     {
       
    20     CAgnCalendarInfoProperty* self = new(ELeave) CAgnCalendarInfoProperty;
       
    21     CleanupStack::PushL(self);
       
    22     self->ConstructL(aKey);
       
    23     return self;
       
    24     }
       
    25 
       
    26 CAgnCalendarInfoProperty::~CAgnCalendarInfoProperty()
       
    27     {
       
    28     delete iKey;
       
    29     delete iValue;
       
    30     }
       
    31     
       
    32 CAgnCalendarInfoProperty::CAgnCalendarInfoProperty()
       
    33     {
       
    34     }
       
    35 
       
    36 void CAgnCalendarInfoProperty::ConstructL(const TDesC8& aKey)
       
    37     {
       
    38     iKey = aKey.AllocL();
       
    39     }
       
    40 
       
    41 TInt CAgnCalendarInfoProperty::Compare(const CAgnCalendarInfoProperty& aLeft, const CAgnCalendarInfoProperty& aRight)
       
    42     {
       
    43     return Compare(aLeft.iKey, aRight);
       
    44     }
       
    45 
       
    46 EXPORT_C TInt CAgnCalendarInfoProperty::Compare(const TDesC8* aKey, const CAgnCalendarInfoProperty& aProperty)
       
    47     {
       
    48     return aKey->CompareF(*aProperty.iKey);
       
    49     }
       
    50 
       
    51 const TDesC8& CAgnCalendarInfoProperty::Key() const
       
    52     {
       
    53     return *iKey;
       
    54     }
       
    55 
       
    56 EXPORT_C const TDesC8& CAgnCalendarInfoProperty::Value() const
       
    57     {
       
    58     if (iValue)
       
    59         {
       
    60         return *iValue;
       
    61         }
       
    62     
       
    63     return KNullDesC8;
       
    64     }
       
    65 
       
    66 EXPORT_C void CAgnCalendarInfoProperty::SetValue(HBufC8* aValue)
       
    67     {
       
    68     delete iValue;
       
    69     iValue = aValue;
       
    70     iState = EModified;
       
    71     }
       
    72 
       
    73 EXPORT_C void CAgnCalendarInfoProperty::SetState(TState aState)
       
    74     {
       
    75     iState = aState;
       
    76     }
       
    77 
       
    78 EXPORT_C CAgnCalendarInfoProperty::TState CAgnCalendarInfoProperty::State() const
       
    79     {
       
    80     return iState;
       
    81     }
       
    82  
       
    83 void CAgnCalendarInfoProperty::SetStreamId(TStreamId aStreamId)
       
    84     {
       
    85     iStreamId = aStreamId;
       
    86     }
       
    87 
       
    88 EXPORT_C TStreamId CAgnCalendarInfoProperty::StreamId() const
       
    89     {
       
    90     return iStreamId;
       
    91     }