contextframework/cfw/src/cfcontextsourcesettingsmanager/cfcontextsourcesettingparameterimpl.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  CFContextSourceSettingParameterImpl class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include "cfcontextsourcesettingparameterimpl.h"
       
    22 #include "cftrace.h"
       
    23 
       
    24 CCFContextSourceSettingParameterImpl* CCFContextSourceSettingParameterImpl::NewL()
       
    25     {
       
    26     FUNC_LOG;
       
    27     
       
    28     CCFContextSourceSettingParameterImpl* self =
       
    29         CCFContextSourceSettingParameterImpl::NewLC();
       
    30     CleanupStack::Pop( self );
       
    31     
       
    32     return self;
       
    33     }
       
    34 
       
    35 CCFContextSourceSettingParameterImpl* CCFContextSourceSettingParameterImpl::NewLC()
       
    36     {
       
    37     FUNC_LOG;
       
    38     
       
    39     CCFContextSourceSettingParameterImpl* self =
       
    40         new( ELeave ) CCFContextSourceSettingParameterImpl;
       
    41     
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     
       
    45     return self;
       
    46     }
       
    47     
       
    48 CCFContextSourceSettingParameterImpl::~CCFContextSourceSettingParameterImpl()
       
    49     {
       
    50     FUNC_LOG;
       
    51     
       
    52     delete iName;
       
    53     iAttributes.ResetAndDestroy();
       
    54     }
       
    55     
       
    56 CCFContextSourceSettingParameterImpl::CCFContextSourceSettingParameterImpl()
       
    57     {
       
    58     FUNC_LOG;
       
    59     }
       
    60 
       
    61 void CCFContextSourceSettingParameterImpl::ConstructL()
       
    62     {
       
    63     FUNC_LOG;
       
    64     
       
    65     iName = KNullDesC().AllocL();
       
    66     }
       
    67     
       
    68 // METHODS
       
    69 
       
    70 //----------------------------------------------------------------------------
       
    71 // CCFContextSourceSettingParameterImpl::Name
       
    72 //----------------------------------------------------------------------------
       
    73 //
       
    74 const TDesC& CCFContextSourceSettingParameterImpl::Name() const
       
    75     {
       
    76     FUNC_LOG;
       
    77     
       
    78     return *iName;
       
    79     }
       
    80 
       
    81 //----------------------------------------------------------------------------
       
    82 // CCFContextSourceSettingParameterImpl::Attributes
       
    83 //----------------------------------------------------------------------------
       
    84 //
       
    85 const RKeyValueArray& CCFContextSourceSettingParameterImpl::Attributes() const
       
    86     {
       
    87     FUNC_LOG;
       
    88     
       
    89     return iAttributes;
       
    90     }
       
    91 
       
    92 //----------------------------------------------------------------------------
       
    93 // CCFContextSourceSettingParameterImpl::SetNameL
       
    94 //----------------------------------------------------------------------------
       
    95 //
       
    96 void CCFContextSourceSettingParameterImpl::SetNameL( const TDesC& aName )
       
    97     {
       
    98     FUNC_LOG;
       
    99     
       
   100     TPtr namePtr = iName->Des();
       
   101     if( aName.Length() < namePtr.MaxLength() )
       
   102         {
       
   103         // Just copy
       
   104         namePtr.Copy( aName );
       
   105         }
       
   106     else
       
   107         {
       
   108         // Create a new one
       
   109         delete iName;
       
   110         iName = NULL;
       
   111         iName = aName.AllocL();
       
   112         }
       
   113     }
       
   114 
       
   115 //----------------------------------------------------------------------------
       
   116 // CCFContextSourceSettingParameterImpl::AddAttributeL
       
   117 //----------------------------------------------------------------------------
       
   118 //
       
   119 void CCFContextSourceSettingParameterImpl::AddAttributeL(
       
   120     CCFKeyValuePair* aAttribute )
       
   121     {
       
   122     FUNC_LOG;
       
   123     
       
   124     iAttributes.AppendL( aAttribute );
       
   125     }