homescreenpluginsrv/homescreen_settings_api/src/objectmap.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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:  Presents object map as name, path and mediatype data
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "objectmap.h"
       
    21 
       
    22 namespace HSPluginSettingsIf{
       
    23 
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CObjectMap::CObjectMap()
       
    29     {
       
    30     }
       
    31 
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 void CObjectMap::ConstructL()
       
    37     {
       
    38     }
       
    39 
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 EXPORT_C CObjectMap* CObjectMap::NewL()
       
    45     {
       
    46     CObjectMap* self = CObjectMap::NewLC();
       
    47     CleanupStack::Pop( self );
       
    48     return self;
       
    49     }
       
    50 
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 EXPORT_C CObjectMap* CObjectMap::NewLC()
       
    56     {
       
    57     CObjectMap* self = new( ELeave ) CObjectMap;
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     return self;
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C CObjectMap::~CObjectMap()
       
    68     {
       
    69     delete iName;
       
    70     delete iPath;
       
    71     delete iMediaType;
       
    72     }
       
    73 // ---------------------------------------------------------------------------
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 EXPORT_C CObjectMap& CObjectMap::SetNameL( const TDesC8& aName )
       
    77     {
       
    78     delete iName;
       
    79     iName = NULL;
       
    80     iName = aName.AllocL();
       
    81     return *this;
       
    82     }
       
    83     
       
    84 // ---------------------------------------------------------------------------
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C const TDesC8& CObjectMap::NameL()const
       
    88     {
       
    89     if(iName)
       
    90        {
       
    91        return *iName;
       
    92        }
       
    93    else
       
    94        {
       
    95        return KNullDesC8;
       
    96        }
       
    97     }
       
    98     
       
    99 // ---------------------------------------------------------------------------
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 EXPORT_C CObjectMap& CObjectMap::SetPathL( const TDesC8& aPath )
       
   103     {
       
   104     delete iPath;
       
   105     iPath = NULL;
       
   106     iPath = aPath.AllocL();
       
   107     return *this;
       
   108     }
       
   109     
       
   110 // ---------------------------------------------------------------------------
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 EXPORT_C const TDesC8& CObjectMap::Path()const
       
   114     {
       
   115     if(iPath)
       
   116       {
       
   117       return *iPath;
       
   118       }
       
   119     else
       
   120       {
       
   121       return KNullDesC8;
       
   122       }
       
   123     }
       
   124     
       
   125 // ---------------------------------------------------------------------------
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C CObjectMap& CObjectMap::SetMediaTypeL( const TDesC8& aMediaType )
       
   129     {
       
   130     delete iMediaType;
       
   131     iMediaType = NULL;
       
   132     iMediaType = aMediaType.AllocL();
       
   133     return *this;
       
   134     }
       
   135     
       
   136 // ---------------------------------------------------------------------------
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 EXPORT_C const TDesC8& CObjectMap::MediaType()const
       
   140     {
       
   141     if(iMediaType)
       
   142       {
       
   143       return *iMediaType;
       
   144       }
       
   145     else
       
   146       {
       
   147       return KNullDesC8;
       
   148       }
       
   149     }
       
   150 
       
   151     
       
   152 }
       
   153 
       
   154