ncdengine/provider/server/src/ncdsearchnodebundle.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:   Implementation of CNcdSearchNodeBundle class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdsearchnodebundle.h"
       
    20 #include "ncdnodeidentifier.h"
       
    21 #include "ncdchildentity.h"
       
    22 #include "catalogsutils.h"
       
    23 
       
    24 
       
    25 CNcdSearchNodeBundle* CNcdSearchNodeBundle::NewL(
       
    26     CNcdNodeManager& aNodeManager,
       
    27     const CNcdNodeIdentifier& aIdentifier ) 
       
    28     {    
       
    29     CNcdSearchNodeBundle* self = 
       
    30         NewLC( aNodeManager, aIdentifier );
       
    31     CleanupStack::Pop( self );
       
    32     return self;
       
    33     }
       
    34     
       
    35 CNcdSearchNodeBundle* CNcdSearchNodeBundle::NewLC(
       
    36     CNcdNodeManager& aNodeManager,
       
    37     const CNcdNodeIdentifier& aIdentifier ) 
       
    38     {
       
    39     CNcdSearchNodeBundle* self =
       
    40         new ( ELeave ) CNcdSearchNodeBundle( aNodeManager );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aIdentifier );
       
    43     return self;
       
    44     }
       
    45 
       
    46 
       
    47 CNcdSearchNodeBundle::CNcdSearchNodeBundle( CNcdNodeManager& aNodeManager, 
       
    48                                     NcdNodeClassIds::TNcdNodeClassId aNodeClassId )
       
    49 : CNcdSearchNodeFolder( aNodeManager, aNodeClassId ) 
       
    50     {
       
    51     }
       
    52 
       
    53 CNcdSearchNodeBundle::~CNcdSearchNodeBundle() 
       
    54     {
       
    55     }
       
    56     
       
    57 void CNcdSearchNodeBundle::ConstructL( const CNcdNodeIdentifier& aIdentifier ) 
       
    58     {
       
    59     DLTRACEIN((""));
       
    60     CNcdSearchNodeFolder::ConstructL( aIdentifier );
       
    61     DLTRACEOUT((""));
       
    62     }
       
    63 
       
    64 TInt CNcdSearchNodeBundle::ServerChildCount() const
       
    65     {
       
    66     DLTRACEIN(( "this: %X, ChildCount: %d", this, ChildArray().Count() ));
       
    67     // bundle folders's child count is always the number of children in the child array
       
    68     // because, contrary to regular folders, bundle folder doesn't have an expected child count
       
    69     return ChildArray().Count();
       
    70     }
       
    71 
       
    72 const CNcdNodeIdentifier& CNcdSearchNodeBundle::ChildByServerIndexL( TInt aIndex ) const
       
    73     {
       
    74     DLTRACEIN((""));    
       
    75     
       
    76     if ( aIndex < 0 || aIndex >= ChildArray().Count() )
       
    77         {
       
    78         // For debugging purposes
       
    79         DLERROR(("Wrong child index"));
       
    80         DASSERT( EFalse );
       
    81         User::Leave( KErrArgument );
       
    82         }
       
    83         
       
    84     return ChildArray()[aIndex]->Identifier();
       
    85     }