idlehomescreen/sapiwrapper/hspswrapper/src/propertymap.cpp
branchRCL_3
changeset 34 5456b4e8b3a8
parent 0 f72a12da539e
equal deleted inserted replaced
33:5f0182e07bfb 34:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Encapsulates name and value
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "propertymap.h"
       
    21 
       
    22 namespace hspswrapper{
       
    23 
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CPropertyMap::CPropertyMap()
       
    29     {
       
    30     }
       
    31 
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 void CPropertyMap::ConstructL()
       
    37     {
       
    38 
       
    39     }
       
    40 
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C CPropertyMap* CPropertyMap::NewL()
       
    46     {
       
    47     CPropertyMap* self = CPropertyMap::NewLC();
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CPropertyMap* CPropertyMap::NewLC()
       
    57     {
       
    58     CPropertyMap* self = new( ELeave ) CPropertyMap;
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     return self;
       
    62     }
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CPropertyMap::~CPropertyMap()
       
    69     {
       
    70     delete iName;
       
    71     delete iValue;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C CPropertyMap& CPropertyMap::SetNameL( const TDesC8& aName )
       
    78     {
       
    79     delete iName;
       
    80     iName = NULL;
       
    81     iName = aName.AllocL();
       
    82     return *this;
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 EXPORT_C const TDesC8& CPropertyMap::Name()const
       
    89     {
       
    90     if(iName)
       
    91        {
       
    92        return *iName;
       
    93        }
       
    94     else
       
    95        {
       
    96        return KNullDesC8;
       
    97        }
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C CPropertyMap& CPropertyMap::SetValueL( const TDesC8& aValue )
       
   104     {
       
   105     delete iValue;
       
   106     iValue = NULL;
       
   107     iValue = aValue.AllocL();
       
   108     return *this;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C const TDesC8& CPropertyMap::Value()const
       
   115     {
       
   116     if(iValue)
       
   117        {
       
   118        return *iValue;
       
   119        }
       
   120     else
       
   121        {
       
   122        return KNullDesC8;
       
   123        }
       
   124     }
       
   125 
       
   126 }