ncdengine/provider/server/src/ncdclientssubscriptions.cpp
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     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 "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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdclientssubscriptions.h"
       
    20 #include "ncdsubscriptiongroup.h"
       
    21 #include "catalogsutils.h"
       
    22 #include "ncdsubscriptionssourceidentifier.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 CNcdClientsSubscriptions::CNcdClientsSubscriptions( TUid aId ) :
       
    27     iId( aId )
       
    28     {
       
    29     }
       
    30 
       
    31 
       
    32 void CNcdClientsSubscriptions::ConstructL()
       
    33     {
       
    34     }
       
    35 
       
    36 
       
    37 CNcdClientsSubscriptions* CNcdClientsSubscriptions::NewL( TUid aId )
       
    38     {
       
    39     CNcdClientsSubscriptions* self =
       
    40         CNcdClientsSubscriptions::NewLC( aId );
       
    41     CleanupStack::Pop( self );
       
    42     return self;
       
    43     }
       
    44 
       
    45 
       
    46 CNcdClientsSubscriptions* CNcdClientsSubscriptions::NewLC( TUid aId )
       
    47     {
       
    48     CNcdClientsSubscriptions* self =
       
    49         new( ELeave ) CNcdClientsSubscriptions( aId );
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     return self;
       
    53     }
       
    54 
       
    55 
       
    56 CNcdClientsSubscriptions::~CNcdClientsSubscriptions()
       
    57     {
       
    58     // Should close all objects in iClientsSubscriptions
       
    59     ResetAndCloseArray( iClientsSubscriptions );
       
    60     }
       
    61 
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // ?implementation_description
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 void CNcdClientsSubscriptions::AddGroupL( CNcdSubscriptionGroup* aGroup )
       
    68     {
       
    69     iClientsSubscriptions.AppendL( aGroup );
       
    70     }
       
    71 
       
    72 void CNcdClientsSubscriptions::RemoveGroup(
       
    73     CNcdSubscriptionGroup* aGroup )
       
    74     {
       
    75     TInt groupIndex( iClientsSubscriptions.Count() - 1 );
       
    76     while ( groupIndex > -1  )
       
    77         {
       
    78         // Comparison of pointers
       
    79         if ( iClientsSubscriptions[groupIndex] == aGroup )
       
    80             {
       
    81             iClientsSubscriptions[groupIndex]->Close();
       
    82             iClientsSubscriptions.Remove( groupIndex );
       
    83             return;
       
    84             }
       
    85                 
       
    86         --groupIndex;
       
    87         } 
       
    88     }
       
    89 
       
    90 RPointerArray<CNcdSubscriptionGroup>& CNcdClientsSubscriptions::Groups()
       
    91     {
       
    92     return iClientsSubscriptions;
       
    93     }
       
    94 
       
    95 TUid CNcdClientsSubscriptions::ClientId() const
       
    96     {
       
    97     return iId;
       
    98     }