ncdengine/provider/server/src/ncdbundlefolder.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 CNcdBundleFolder class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdbundlefolder.h"
       
    20 #include "ncdnodeidentifier.h"
       
    21 #include "ncdchildentity.h"
       
    22 #include "catalogsutils.h"
       
    23 
       
    24 
       
    25 CNcdBundleFolder* CNcdBundleFolder::NewL(
       
    26     CNcdNodeManager& aNodeManager,
       
    27     const CNcdNodeIdentifier& aIdentifier ) 
       
    28     {    
       
    29     CNcdBundleFolder* self = 
       
    30         NewLC( aNodeManager, aIdentifier );
       
    31     CleanupStack::Pop( self );
       
    32     return self;
       
    33     }
       
    34     
       
    35 CNcdBundleFolder* CNcdBundleFolder::NewLC(
       
    36     CNcdNodeManager& aNodeManager,
       
    37     const CNcdNodeIdentifier& aIdentifier ) 
       
    38     {
       
    39     CNcdBundleFolder* self =
       
    40         new ( ELeave ) CNcdBundleFolder( aNodeManager );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aIdentifier );
       
    43     return self;
       
    44     }
       
    45 
       
    46 
       
    47 CNcdBundleFolder::CNcdBundleFolder( CNcdNodeManager& aNodeManager, 
       
    48                                     NcdNodeClassIds::TNcdNodeClassId aNodeClassId )
       
    49 : CNcdParentOfTransparentNode( aNodeManager, aNodeClassId ) 
       
    50     {
       
    51     }
       
    52 
       
    53 CNcdBundleFolder::~CNcdBundleFolder() 
       
    54     {
       
    55     delete iViewType;
       
    56     }
       
    57 
       
    58 void CNcdBundleFolder::ConstructL( const CNcdNodeIdentifier& aIdentifier ) 
       
    59     {
       
    60     DLTRACEIN((""));
       
    61     CNcdParentOfTransparentNode::ConstructL( aIdentifier );
       
    62     AssignDesL( iViewType, KNullDesC() );
       
    63     DLTRACEOUT((""));
       
    64     }
       
    65 
       
    66 
       
    67 TInt CNcdBundleFolder::ServerChildCount() const
       
    68     {
       
    69     DLTRACEIN(( "this: %X, ChildCount: %d", this, ChildArray().Count() ));
       
    70     // bundle folders's child count is always the number of children in the child array
       
    71     // because, contrary to regular folders, bundle folder doesn't have an expected child count
       
    72     return ChildArray().Count();
       
    73     }
       
    74 
       
    75 const CNcdNodeIdentifier& CNcdBundleFolder::ChildByServerIndexL( TInt aIndex ) const
       
    76     {
       
    77     DLTRACEIN((""));    
       
    78     // bundle folders's child count is always the number of children in the child array
       
    79     // because, contrary to regular folders, bundle folder doesn't have an expected child count
       
    80     if ( aIndex < 0 || aIndex >= ChildArray().Count() )
       
    81         {
       
    82         // For debugging purposes
       
    83         DLERROR(("Wrong child index: %d, count: %d", aIndex, ChildArray().Count() ));
       
    84         DASSERT( EFalse );
       
    85         User::Leave( KErrArgument );
       
    86         }
       
    87     return ChildArray()[aIndex]->Identifier();
       
    88     }
       
    89 
       
    90 
       
    91 const TDesC& CNcdBundleFolder::ViewType() const 
       
    92     {
       
    93     DLTRACEIN((""));
       
    94     return *iViewType;
       
    95     }
       
    96 
       
    97 void CNcdBundleFolder::SetViewTypeL( const TDesC& aViewType ) 
       
    98     {
       
    99     DLTRACEIN((""));
       
   100     AssignDesL( iViewType, aViewType );
       
   101     DLTRACEOUT((""));
       
   102     }
       
   103 
       
   104 
       
   105 void CNcdBundleFolder::ExternalizeL( RWriteStream& aStream ) 
       
   106     {
       
   107     CNcdParentOfTransparentNode::ExternalizeL( aStream );
       
   108     ExternalizeDesL( *iViewType, aStream );
       
   109     }
       
   110 
       
   111 void CNcdBundleFolder::InternalizeL( RReadStream& aStream )
       
   112     {
       
   113     CNcdParentOfTransparentNode::InternalizeL( aStream );
       
   114     InternalizeDesL( iViewType, aStream );
       
   115     }
       
   116     
       
   117 void CNcdBundleFolder::ExternalizeDataForRequestL( RWriteStream& aStream ) const
       
   118     {
       
   119     CNcdParentOfTransparentNode::ExternalizeDataForRequestL( aStream );
       
   120     ExternalizeDesL( *iViewType, aStream );
       
   121     }