brandingserver/BSClient/tbsmdescarrayadapter.cpp
changeset 31 9dbc70490d9a
equal deleted inserted replaced
30:1fa9b890f29c 31:9dbc70490d9a
       
     1 /*
       
     2 * Copyright (c) 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 the License "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:   One value adapter for MDesCArray.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDES
       
    20 #include "tbsmdescarrayadapter.h"
       
    21 #include <e32std.h>
       
    22 #include <badesca.h>
       
    23 
       
    24 
       
    25 //LOCAL constants
       
    26 namespace
       
    27     {
       
    28     //Panic
       
    29     _LIT( KBSMDesArrayAdapterPanic, "BSDesArrAdp" );
       
    30 
       
    31     //Panic reasons
       
    32     enum TBSMDesArrayAdapterReasons
       
    33         {
       
    34         EMdcaPointOutOfBounds
       
    35         };
       
    36 
       
    37     void BSMDesAdapPanic( TBSMDesArrayAdapterReasons aPanicReason )
       
    38         {
       
    39         User::Panic( KBSMDesArrayAdapterPanic, aPanicReason );
       
    40         }
       
    41     }
       
    42 
       
    43 
       
    44 
       
    45 
       
    46 // ================= MEMBER FUNCTIONS =======================
       
    47 // C++ default constructor can NOT contain any code, that
       
    48 // might leave.
       
    49 //
       
    50 EXPORT_C TBSMDesCArrayAdapter::TBSMDesCArrayAdapter( const TDesC& aDesc )
       
    51     : iDesc( aDesc )
       
    52     {
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // TBSMDesCArrayAdapter::MdcaCount()
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C TInt TBSMDesCArrayAdapter::MdcaCount() const
       
    60     {
       
    61     //there is just one adapted descriptor
       
    62     return 1;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // TBSMDesCArrayAdapter::MdcaPoint()
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 EXPORT_C TPtrC TBSMDesCArrayAdapter::MdcaPoint( TInt aIndex ) const
       
    70     {
       
    71     //there is just one adapted descriptor
       
    72     __ASSERT_ALWAYS( aIndex == 0, BSMDesAdapPanic( EMdcaPointOutOfBounds ) );
       
    73     return iDesc;
       
    74     }
       
    75 
       
    76 
       
    77 
       
    78 //  End of File
       
    79