javauis/amms_akn/mmacontrol/src/cammsplayerbuildergroup.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005 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:  AMMS player builder group for adding players.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cammsplayerbuildergroup.h"
       
    22 
       
    23 // CONSTANTS
       
    24 const TInt KDefaultGranularity = 1;
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CAMMSPlayerBuilderGroup::NewL
       
    31 // Two-phased constructor.
       
    32 // -----------------------------------------------------------------------------
       
    33 CAMMSPlayerBuilderGroup* CAMMSPlayerBuilderGroup::NewL()
       
    34 {
       
    35     CAMMSPlayerBuilderGroup* self = NewLC();
       
    36     CleanupStack::Pop(self);
       
    37 
       
    38     return self;
       
    39 }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CAMMSPlayerBuilderGroup::NewLC
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 CAMMSPlayerBuilderGroup* CAMMSPlayerBuilderGroup::NewLC()
       
    46 {
       
    47     CAMMSPlayerBuilderGroup* self = new(ELeave) CAMMSPlayerBuilderGroup();
       
    48 
       
    49     CleanupStack::PushL(self);
       
    50     self->ConstructL();
       
    51 
       
    52     return self;
       
    53 }
       
    54 
       
    55 // Destructor
       
    56 CAMMSPlayerBuilderGroup::~CAMMSPlayerBuilderGroup()
       
    57 {
       
    58     if (iPlayerBuilders)
       
    59     {
       
    60         iPlayerBuilders->ResetAndDestroy();
       
    61     }
       
    62     delete iPlayerBuilders;
       
    63 }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CAMMSPlayerBuilderGroup::PreparePlayerL
       
    67 // Performs PreparePlayerL for every player builder in the array.
       
    68 // -----------------------------------------------------------------------------
       
    69 void CAMMSPlayerBuilderGroup::PreparePlayerL(CMMAPlayer* aPlayer)
       
    70 {
       
    71     TInt builderCount = iPlayerBuilders->Count();
       
    72     for (TInt i = 0; i < builderCount; i++)
       
    73     {
       
    74         iPlayerBuilders->At(i)->PreparePlayerL(aPlayer);
       
    75     }
       
    76 }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CAMMSPlayerBuilderGroup::AddBuilderAndPopL
       
    80 // Adds a player builder to the array.
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CAMMSPlayerBuilderGroup::AddBuilderAndPopL(
       
    84     CAMMSPlayerBuilder* aPlayerBuilder)
       
    85 {
       
    86     iPlayerBuilders->AppendL(aPlayerBuilder);
       
    87     CleanupStack::Pop(aPlayerBuilder);
       
    88 }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CAMMSPlayerBuilderGroup::ConstructL
       
    92 // Symbian 2nd phase constructor can leave.
       
    93 // -----------------------------------------------------------------------------
       
    94 void CAMMSPlayerBuilderGroup::ConstructL()
       
    95 {
       
    96     iPlayerBuilders = new(ELeave) CArrayPtrSeg< CAMMSPlayerBuilder >
       
    97     (KDefaultGranularity);
       
    98 }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CAMMSPlayerBuilderGroup::CAMMSPlayerBuilderGroup
       
   102 // C++ default constructor can NOT contain any code, that
       
   103 // might leave.
       
   104 // -----------------------------------------------------------------------------
       
   105 CAMMSPlayerBuilderGroup::CAMMSPlayerBuilderGroup()
       
   106 {
       
   107 }
       
   108 
       
   109 //  End of File