contextframework/cfw/src/cfcontextsourcesettingsmanager/cfcontextsourcesettingarrayimpl.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:  CFContextSourceSettingArrayImpl class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include "cfcontextsourcesettingarrayimpl.h"
       
    22 #include "cfcontextsourcesetting.h"
       
    23 #include "cftrace.h"
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 #ifdef _DEBUG
       
    28 // Panic category
       
    29 _LIT( KPanicCat, "SETARRAY" );
       
    30 
       
    31 // Panic reasons
       
    32 enum TPanicReason
       
    33     {
       
    34     EInvalidArrayIndex
       
    35     };
       
    36     
       
    37 // Local panic function
       
    38 LOCAL_C void Panic( TInt aCode )
       
    39     {
       
    40     User::Panic( KPanicCat, aCode );
       
    41     }
       
    42 #endif
       
    43 
       
    44 // MEMBER FUNCTIONS
       
    45 
       
    46 CCFContextSourceSettingArrayImpl* CCFContextSourceSettingArrayImpl::NewL()
       
    47     {
       
    48     FUNC_LOG;
       
    49     
       
    50     CCFContextSourceSettingArrayImpl* self =
       
    51         CCFContextSourceSettingArrayImpl::NewLC();
       
    52     CleanupStack::Pop( self );
       
    53     
       
    54     return self;
       
    55     }
       
    56 
       
    57 CCFContextSourceSettingArrayImpl* CCFContextSourceSettingArrayImpl::NewLC()
       
    58     {
       
    59     FUNC_LOG;
       
    60     
       
    61     CCFContextSourceSettingArrayImpl* self =
       
    62         new( ELeave ) CCFContextSourceSettingArrayImpl;
       
    63     
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL();
       
    66     
       
    67     return self;
       
    68     }
       
    69     
       
    70 CCFContextSourceSettingArrayImpl::~CCFContextSourceSettingArrayImpl()
       
    71     {
       
    72     FUNC_LOG;
       
    73     
       
    74     iItems.ResetAndDestroy();
       
    75     }
       
    76     
       
    77 CCFContextSourceSettingArrayImpl::CCFContextSourceSettingArrayImpl()
       
    78     {
       
    79     FUNC_LOG;
       
    80     }
       
    81 
       
    82 void CCFContextSourceSettingArrayImpl::ConstructL()
       
    83     {
       
    84     FUNC_LOG;
       
    85     }
       
    86     
       
    87 // METHODS
       
    88 
       
    89 //----------------------------------------------------------------------------
       
    90 // CCFContextSourceSettingArrayImpl::Count
       
    91 //----------------------------------------------------------------------------
       
    92 //
       
    93 TInt CCFContextSourceSettingArrayImpl::Count() const
       
    94     {
       
    95     FUNC_LOG;
       
    96     
       
    97     return iItems.Count();
       
    98     }
       
    99     
       
   100 //----------------------------------------------------------------------------
       
   101 // CCFContextSourceSettingArrayImpl::Item
       
   102 //----------------------------------------------------------------------------
       
   103 //
       
   104 const CCFContextSourceSetting& CCFContextSourceSettingArrayImpl::Item(
       
   105     TInt aIndex ) const
       
   106     {
       
   107     FUNC_LOG;
       
   108     
       
   109     __ASSERT_DEBUG( aIndex >= 0 && aIndex < iItems.Count(),
       
   110         Panic( EInvalidArrayIndex ) );
       
   111 
       
   112     return *iItems[aIndex];
       
   113     }
       
   114 
       
   115 //----------------------------------------------------------------------------
       
   116 // CCFContextSourceSettingArrayImpl::SettingItem
       
   117 //----------------------------------------------------------------------------
       
   118 //
       
   119 void CCFContextSourceSettingArrayImpl::AppendItemL(
       
   120     CCFContextSourceSetting* aItem )
       
   121     {
       
   122     FUNC_LOG;
       
   123     
       
   124     iItems.AppendL( aItem );
       
   125     }