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