xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheEntryProperty.cpp
branchGCC_SURGE
changeset 28 d9861ae9169c
parent 23 77cb48a03620
parent 26 04ca1926b01c
equal deleted inserted replaced
23:77cb48a03620 28:d9861ae9169c
     1 /*
       
     2 * Copyright (c) 2005 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: CXcapCacheEntryPropertyProperty from XcapCacheIndexProperty.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "XcapCacheServer.h"
       
    23 #include "XcapCacheEntryProperty.h"
       
    24 
       
    25 // ----------------------------------------------------------
       
    26 // CXcapCacheEntryProperty::CXcapCacheEntryProperty
       
    27 // 
       
    28 // ----------------------------------------------------------
       
    29 //
       
    30 CXcapCacheEntryProperty::CXcapCacheEntryProperty( TInt aPropertyName ) :
       
    31                                                   iPropertyName( aPropertyName )
       
    32     {
       
    33     }
       
    34 
       
    35 // ----------------------------------------------------------
       
    36 // CXcapCacheEntryProperty::NewL
       
    37 // 
       
    38 // ----------------------------------------------------------
       
    39 //
       
    40 CXcapCacheEntryProperty* CXcapCacheEntryProperty::NewL( TInt aPropertyName,
       
    41                                                         const TDesC8& aPropertyValue )
       
    42     {
       
    43     CXcapCacheEntryProperty* self = new( ELeave ) CXcapCacheEntryProperty( aPropertyName );
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL( aPropertyValue );
       
    46     CleanupStack::Pop();
       
    47     return self;
       
    48     }
       
    49 
       
    50 // ----------------------------------------------------------
       
    51 // CXcapCacheEntryProperty::ConstructL
       
    52 // 
       
    53 // ----------------------------------------------------------
       
    54 //
       
    55 void CXcapCacheEntryProperty::ConstructL( const TDesC8& aPropertyValue )
       
    56     {
       
    57     iPropertyValue8 = aPropertyValue.AllocL();
       
    58     iPropertyValue16 = HBufC::NewL( aPropertyValue.Length() );
       
    59     iPropertyValue16->Des().Copy( aPropertyValue );
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------
       
    63 // CXcapCacheEntryProperty::~CXcapCacheEntryProperty
       
    64 // 
       
    65 // ----------------------------------------------------------
       
    66 //
       
    67 CXcapCacheEntryProperty::~CXcapCacheEntryProperty()
       
    68     {
       
    69     delete iPropertyValue8;
       
    70     delete iPropertyValue16;
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------
       
    74 // CXcapCacheEntryProperty::ConstructL
       
    75 // 
       
    76 // ----------------------------------------------------------
       
    77 //
       
    78 TInt CXcapCacheEntryProperty::Name() const
       
    79     {
       
    80     return iPropertyName;
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------
       
    84 // CXcapCacheEntryProperty::ConstructL
       
    85 // 
       
    86 // ----------------------------------------------------------
       
    87 //
       
    88 TInt CXcapCacheEntryProperty::IntValue() const
       
    89     {
       
    90     return CXcapCacheServer::ConvertDesc( iPropertyValue8->Des() );
       
    91     }
       
    92 
       
    93 // ----------------------------------------------------------
       
    94 // CXcapCacheEntryProperty::ConstructL
       
    95 // 
       
    96 // ----------------------------------------------------------
       
    97 //
       
    98 TTime CXcapCacheEntryProperty::TimeValue() const
       
    99     {
       
   100     TTime ret;
       
   101     ret.Parse( iPropertyValue16->Des() );
       
   102     return ret;
       
   103     }
       
   104 
       
   105 // ----------------------------------------------------------
       
   106 // CXcapCacheEntryProperty::ConstructL
       
   107 // 
       
   108 // ----------------------------------------------------------
       
   109 //
       
   110 TPtrC CXcapCacheEntryProperty::DesValue16() const
       
   111     {
       
   112     return iPropertyValue16 != NULL ? iPropertyValue16->Des() : TPtrC();
       
   113     }
       
   114 
       
   115 // ----------------------------------------------------------
       
   116 // CXcapCacheEntryProperty::ConstructL
       
   117 // 
       
   118 // ----------------------------------------------------------
       
   119 //
       
   120 TPtrC8 CXcapCacheEntryProperty::DesValue8() const
       
   121     {
       
   122     return iPropertyValue8 != NULL ? iPropertyValue8->Des() : TPtrC8();
       
   123     }
       
   124 
       
   125