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