idlehomescreen/sapiwrapper/hspswrapper/src/itemmap.cpp
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     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:  Item id, name and properties
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "itemmap.h"
       
    21 #include "propertymap.h"
       
    22 
       
    23 namespace hspswrapper{
       
    24 
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CItemMap::CItemMap()
       
    30     {
       
    31     }
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 void CItemMap::ConstructL()
       
    38     {
       
    39     }
       
    40 
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C CItemMap* CItemMap::NewL()
       
    46     {
       
    47     CItemMap* self = CItemMap::NewLC();
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CItemMap* CItemMap::NewLC()
       
    57     {
       
    58     CItemMap* self = new( ELeave ) CItemMap;
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     return self;
       
    62     }
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CItemMap::~CItemMap()
       
    69     {
       
    70     delete iItemId;
       
    71     delete iItemName;
       
    72     iProperties.ResetAndDestroy();
       
    73     }
       
    74 
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C CItemMap& CItemMap::SetItemIdL(const TDesC8& aItemId )
       
    81     {
       
    82     delete iItemId;
       
    83     iItemId = NULL;
       
    84     iItemId = aItemId.AllocL();
       
    85     return *this;
       
    86     }
       
    87     
       
    88 // ---------------------------------------------------------------------------
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 EXPORT_C const TDesC8& CItemMap::ItemId()const
       
    92     {
       
    93     if(iItemId)
       
    94         {
       
    95         return *iItemId;
       
    96         }
       
    97     else
       
    98         {
       
    99         return KNullDesC8;
       
   100         }
       
   101     
       
   102     }
       
   103     
       
   104 // ---------------------------------------------------------------------------
       
   105 // ---------------------------------------------------------------------------
       
   106 //
       
   107 EXPORT_C CItemMap& CItemMap::SetItemNameL(const TDesC8& aItemName )
       
   108     {
       
   109     delete iItemName;
       
   110     iItemName = NULL;
       
   111     iItemName = aItemName.AllocL();
       
   112     return *this;
       
   113     }
       
   114     
       
   115 // ---------------------------------------------------------------------------
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 EXPORT_C const TDesC8& CItemMap::ItemName()const
       
   119     {
       
   120     if(iItemName)
       
   121        {
       
   122        return *iItemName;
       
   123        }
       
   124    else
       
   125        {
       
   126        return KNullDesC8;
       
   127        }
       
   128     }
       
   129     
       
   130 // ---------------------------------------------------------------------------
       
   131 // ---------------------------------------------------------------------------
       
   132 //
       
   133 EXPORT_C CItemMap& CItemMap::AddPropertyMapL(CPropertyMap* aPropertyMap )
       
   134     {
       
   135     iProperties.AppendL(aPropertyMap);
       
   136     return *this;
       
   137     }
       
   138     
       
   139 // ---------------------------------------------------------------------------
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 EXPORT_C RPointerArray<CPropertyMap>& CItemMap::Properties()const
       
   143     {
       
   144     return iProperties;
       
   145     }
       
   146 }
       
   147