idlehomescreen/sapiwrapper/hspswrapper/src/objectmap.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:  Presents object map as name, path and mediatype data
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "objectmap.h"
       
    21 
       
    22 namespace hspswrapper{
       
    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     delete iTag;
       
    73     }
       
    74 // ---------------------------------------------------------------------------
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C CObjectMap& CObjectMap::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& CObjectMap::NameL()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 CObjectMap& CObjectMap::SetPathL( const TDesC8& aPath )
       
   104     {
       
   105     delete iPath;
       
   106     iPath = NULL;
       
   107     iPath = aPath.AllocL();
       
   108     return *this;
       
   109     }
       
   110     
       
   111 // ---------------------------------------------------------------------------
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C const TDesC8& CObjectMap::Path()const
       
   115     {
       
   116     if(iPath)
       
   117       {
       
   118       return *iPath;
       
   119       }
       
   120     else
       
   121       {
       
   122       return KNullDesC8;
       
   123       }
       
   124     }
       
   125     
       
   126 // ---------------------------------------------------------------------------
       
   127 // ---------------------------------------------------------------------------
       
   128 //
       
   129 EXPORT_C CObjectMap& CObjectMap::SetMediaTypeL( const TDesC8& aMediaType )
       
   130     {
       
   131     delete iMediaType;
       
   132     iMediaType = NULL;
       
   133     iMediaType = aMediaType.AllocL();
       
   134     return *this;
       
   135     }
       
   136     
       
   137 // ---------------------------------------------------------------------------
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 EXPORT_C const TDesC8& CObjectMap::MediaType()const
       
   141     {
       
   142     if(iMediaType)
       
   143       {
       
   144       return *iMediaType;
       
   145       }
       
   146     else
       
   147       {
       
   148       return KNullDesC8;
       
   149       }
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 EXPORT_C CObjectMap& CObjectMap::SetTagL( const TDesC8& aTag )
       
   156     {
       
   157     delete iTag;
       
   158     iTag = NULL;
       
   159     iTag = aTag.AllocL();
       
   160     return *this;
       
   161     }
       
   162     
       
   163 // ---------------------------------------------------------------------------
       
   164 // ---------------------------------------------------------------------------
       
   165 //
       
   166 EXPORT_C const TDesC8& CObjectMap::Tag()const
       
   167     {
       
   168     if(iTag)
       
   169       {
       
   170       return *iTag;
       
   171       }
       
   172     else
       
   173       {
       
   174       return KNullDesC8;
       
   175       }
       
   176     }
       
   177     
       
   178 }
       
   179 
       
   180