diff -r 675a964f4eb5 -r 35751d3474b7 contentmgmt/contentaccessfwfordrm/source/cafutils/dirstreamable.cpp --- a/contentmgmt/contentaccessfwfordrm/source/cafutils/dirstreamable.cpp Tue Jul 21 01:04:32 2009 +0100 +++ b/contentmgmt/contentaccessfwfordrm/source/cafutils/dirstreamable.cpp Thu Sep 10 14:01:51 2009 +0300 @@ -1,128 +1,128 @@ -/* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "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 "dirstreamable.h" - -const TUint KCDirArrayGranularity=0x200; - -using namespace ContentAccess; - - -EXPORT_C CDirStreamable* CDirStreamable::NewL(CDir &aDir) - { - CDirStreamable* self = new (ELeave) CDirStreamable; - CleanupStack::PushL(self); - self->ConstructL(aDir); - CleanupStack::Pop(self); - return self; - } - -EXPORT_C CDirStreamable* CDirStreamable::NewL() - { - CDirStreamable* self = new (ELeave) CDirStreamable; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -EXPORT_C CDirStreamable* CDirStreamable::NewL(RReadStream aStream) - { - CDirStreamable* self = new (ELeave) CDirStreamable; - CleanupStack::PushL(self); - self->ConstructL(); - self->InternalizeL(aStream); - CleanupStack::Pop(self); - return self; - } - -CDirStreamable::CDirStreamable() - { - } - - -void CDirStreamable::ConstructL() - { - iArray=new(ELeave) CArrayPakFlat(KCDirArrayGranularity); - } - -void CDirStreamable::ConstructL(CDir& aDir) - { - iArray=new(ELeave) CArrayPakFlat(KCDirArrayGranularity); - - // copy entries to ourselves - TInt i = 0; - for(i = 0; i < aDir.Count(); i++) - { - TEntry entry = aDir[i]; - AddL(entry); - } - } - -CDirStreamable::~CDirStreamable() - { - } - -EXPORT_C void CDirStreamable::AddL(const TEntry &aEntry) - { - CDir::AddL(aEntry); - } - -EXPORT_C TInt CDirStreamable::Count() const - { - return CDir::Count(); - } - -EXPORT_C const TEntry& CDirStreamable::operator[](TInt aIndex) const - { - return CDir::operator [](aIndex); - } - -EXPORT_C TInt CDirStreamable::Sort(TUint aEntrySortKey) - { - return CDir::Sort(aEntrySortKey); - } - -EXPORT_C void CDirStreamable::ExternalizeL(RWriteStream& aStream) const - { - TInt i = 0; - TInt count = Count(); - aStream.WriteInt32L(count); - for(i = 0; i < count; i++) - { - TEntry aEntry = (*this)[i]; - TPckgC pckg(aEntry); - aStream.WriteL(pckg); - } - } - -void CDirStreamable::InternalizeL(RReadStream& aStream) - { - TInt i = 0; - TInt count = aStream.ReadInt32L(); - for(i = 0; i < count; i++) - { - TEntry aEntry; - TPckg pckg(aEntry); - aStream.ReadL(pckg); - - // add to CDir base class array - AddL(aEntry); - } - } +/* +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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 + +const TUint KCDirArrayGranularity=0x200; + +using namespace ContentAccess; + + +EXPORT_C CDirStreamable* CDirStreamable::NewL(CDir &aDir) + { + CDirStreamable* self = new (ELeave) CDirStreamable; + CleanupStack::PushL(self); + self->ConstructL(aDir); + CleanupStack::Pop(self); + return self; + } + +EXPORT_C CDirStreamable* CDirStreamable::NewL() + { + CDirStreamable* self = new (ELeave) CDirStreamable; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +EXPORT_C CDirStreamable* CDirStreamable::NewL(RReadStream aStream) + { + CDirStreamable* self = new (ELeave) CDirStreamable; + CleanupStack::PushL(self); + self->ConstructL(); + self->InternalizeL(aStream); + CleanupStack::Pop(self); + return self; + } + +CDirStreamable::CDirStreamable() + { + } + + +void CDirStreamable::ConstructL() + { + iArray=new(ELeave) CArrayPakFlat(KCDirArrayGranularity); + } + +void CDirStreamable::ConstructL(CDir& aDir) + { + iArray=new(ELeave) CArrayPakFlat(KCDirArrayGranularity); + + // copy entries to ourselves + TInt i = 0; + for(i = 0; i < aDir.Count(); i++) + { + TEntry entry = aDir[i]; + AddL(entry); + } + } + +CDirStreamable::~CDirStreamable() + { + } + +EXPORT_C void CDirStreamable::AddL(const TEntry &aEntry) + { + CDir::AddL(aEntry); + } + +EXPORT_C TInt CDirStreamable::Count() const + { + return CDir::Count(); + } + +EXPORT_C const TEntry& CDirStreamable::operator[](TInt aIndex) const + { + return CDir::operator [](aIndex); + } + +EXPORT_C TInt CDirStreamable::Sort(TUint aEntrySortKey) + { + return CDir::Sort(aEntrySortKey); + } + +EXPORT_C void CDirStreamable::ExternalizeL(RWriteStream& aStream) const + { + TInt i = 0; + TInt count = Count(); + aStream.WriteInt32L(count); + for(i = 0; i < count; i++) + { + TEntry aEntry = (*this)[i]; + TPckgC pckg(aEntry); + aStream.WriteL(pckg); + } + } + +void CDirStreamable::InternalizeL(RReadStream& aStream) + { + TInt i = 0; + TInt count = aStream.ReadInt32L(); + for(i = 0; i < count; i++) + { + TEntry aEntry; + TPckg pckg(aEntry); + aStream.ReadL(pckg); + + // add to CDir base class array + AddL(aEntry); + } + }