diff -r 000000000000 -r 05e9090e2422 layouts/cdl/CdlEngine/src/CdlContainers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layouts/cdl/CdlEngine/src/CdlContainers.cpp Thu Dec 17 09:14:12 2009 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2009 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: +* +*/ +#include "CCdlEngine.h" + +const TInt KCdlGranularity = 4; + + +// +// CCdlUids +// + +EXPORT_C CCdlUids* CCdlUids::NewLC() + { + CCdlUids* self = new(ELeave) CCdlUids; + CleanupStack::PushL(self); + return self; + } + +EXPORT_C CCdlUids::CCdlUids() +: CArrayFixFlat(KCdlGranularity) + { + } + +EXPORT_C void CCdlUids::AddL(TUid aUid) + { + if (FindIndex(aUid) == KErrNotFound) + AppendL(aUid); + } + +EXPORT_C void CCdlUids::AddL(const CCdlUids& aArray) + { + TInt count = aArray.Count(); + for (TInt ii=0; iiAppendL(uid); + } + return array; + } + +EXPORT_C void CCdlUids::ImportL(const TDesC8& aDes) + { + TInt size = aDes.Size(); + ResizeL(size/sizeof(TUid)); + if (size) + { + Mem::Copy(&At(0), aDes.Ptr(), size); + } + } + +EXPORT_C TPtrC8 CCdlUids::Export() const + { + TInt count = Count(); + const TUid* uids = count ? &At(0) : NULL; + TPtrC8 ptr(reinterpret_cast(uids), count*sizeof(TUid)); + return ptr; + } + + +// +// CCdlNames +// + +EXPORT_C CCdlNames* CCdlNames::NewLC() + { + CCdlNames* self = new(ELeave) CCdlNames; + CleanupStack::PushL(self); + return self; + } + +EXPORT_C CCdlNames::CCdlNames() +: CArrayPtrFlat(KCdlGranularity) + { + } + +EXPORT_C CCdlNames::~CCdlNames() + { + ResetAndDestroy(); + } + +EXPORT_C TInt CCdlNames::FindIndex(const TDesC& aName) const + { + TInt count = Count(); + for (TInt ii=0; ii(count)); + for (TInt ii=0; ii(size)); + TPtrC8 name8((TText8*)name.Ptr(), size); + CdlUtils::AppendLDC(buf, name8); + } + + return buf; + } + +void CCdlNames::CleanupImport(TAny* aThis) + { + static_cast(aThis)->DoCleanupImport(); + } + +void CCdlNames::DoCleanupImport() + { + // count the number of used HBufCs and resize to that size. + TInt count = Count(); + TInt used; + for (used=0; used