diff -r 0d1adf67ec1b -r 12f60d9a73b3 csxhelp/HelpEngine/src/CSXHGenericTOC1.cpp --- a/csxhelp/HelpEngine/src/CSXHGenericTOC1.cpp Thu Aug 19 09:42:56 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CCSXHGenericTOC1 class definition -* -*/ - -#include "CSXHGenericTOC1.h" -#include "csxhconstants.h" - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -CCSXHGenericTOC1::CCSXHGenericTOC1(const TDesC& aName, const TInt32 aPriority): - CCSXHHelpContentBase(aName, aPriority), iChildList(NULL) - {//No Implementation required - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -CCSXHGenericTOC1::~CCSXHGenericTOC1() - { - ResetChildList(); - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -void CCSXHGenericTOC1::ResetChildList() - { - if(iChildList == NULL) - return; - TInt count = iChildList->Count(); - CCSXHHelpContentBase* toc2; - for(TInt i=0;iReset(); - delete iChildList; - iChildList = NULL; - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -void CCSXHGenericTOC1::ConstructChildListL() - { - iChildList = new(ELeave) RPointerArray(); - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -EXPORT_C CCSXHHelpContentBase* CCSXHGenericTOC1::GetChildL(const TDesC& aName) - { - if(iChildList == NULL) - return NULL; - - TInt count = iChildList->Count(); - CCSXHHelpContentBase* child = NULL; - for(TInt i=0;iGetName())==0) - return child; - } - return NULL; - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -EXPORT_C void CCSXHGenericTOC1::FillChildDataL(CDesCArray* aArray) - { - //Using Template Pattern. Both the functions below are virtual - InitChildList(); - CopyChildListL(aArray); - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -TBool CCSXHGenericTOC1::InsertChild(CCSXHHelpContentBase* aChild, -TBool aDeleteObject) - { - ConstructChildList(); - TLinearOrder anOrder(Orderer); - if (KErrNone != iChildList->InsertInOrder(aChild,anOrder)) - { - if(aDeleteObject) - delete aChild; - - return EFalse; - } - return ETrue; - } - -TBool CCSXHGenericTOC1::InsertChildWithPriority(CCSXHHelpContentBase* aChild, TBool aDeleteObject) - { - ConstructChildList(); - TLinearOrder anOrder(OrdererWithPriority); - if (KErrNone != iChildList->InsertInOrder(aChild,anOrder)) - { - if(aDeleteObject) - delete aChild; - - return EFalse; - } - return ETrue; - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -void CCSXHGenericTOC1::CopyChildListL(CDesCArray* aArray) - { - TInt count = iChildList->Count(); - CCSXHHelpContentBase* child; - for(TInt i = 0; i < count; ++i) - { - child = (*iChildList)[i]; - if (child && child->GetName().Length() != 0) - { - TBuf toc2Entry(KTabSpace); - toc2Entry.Append(child->GetName()); - aArray->AppendL(toc2Entry); - } - } - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -void CCSXHGenericTOC1::InitChildList() - { - ConstructChildList(); - } - -// --------------------------------------------------------- -// Items commented in header. -// --------------------------------------------------------- -TBool CCSXHGenericTOC1::ConstructChildList() - { - if(iChildList != NULL) - return ETrue; - - TRAPD(err,ConstructChildListL()); - if(err == KErrNone) - return ETrue; - else - { - iChildList = NULL; - return EFalse; - } - }