sl@0: /* sl@0: * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef __DIRSTREAMABLE_H__ sl@0: #define __DIRSTREAMABLE_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: namespace ContentAccess sl@0: { sl@0: /** Emulates the behavior of a CDir object with the addition of sl@0: streaming. sl@0: sl@0: Functions are not virtual and do not override the CDir sl@0: functions so most of the time this class will be used as if it was sl@0: a CDir. It is only when used explicitly as a CDirStreamable that sl@0: any additional functionality is invoked sl@0: sl@0: */ sl@0: class CDirStreamable : public CDir sl@0: { sl@0: public: sl@0: /** Constuct an empty CDirStreamable sl@0: @return a CDirStreamable with no entries sl@0: */ sl@0: IMPORT_C static CDirStreamable* NewL(); sl@0: sl@0: /** Construct a CDirStreamable object from the result sl@0: of a call to RFs::GetDir() sl@0: sl@0: @param aDir A CDir object which has been constructed by a previous call sl@0: to RFs::GetDir() sl@0: @return A new CDirStreamable object sl@0: */ sl@0: IMPORT_C static CDirStreamable* NewL(CDir& aDir); sl@0: sl@0: /** Construct a CDirStreamable object from a stream sl@0: sl@0: @param aStream The stream to read the CDirStreamable object from sl@0: @return A new CDirStreamable object sl@0: */ sl@0: IMPORT_C static CDirStreamable* NewL(RReadStream aStream); sl@0: sl@0: public: sl@0: virtual ~CDirStreamable(); sl@0: sl@0: /** Add an entry sl@0: @param aEntry The directory entry to add sl@0: */ sl@0: IMPORT_C void AddL(const TEntry &aEntry); sl@0: sl@0: /** The number of file system entries in the CDirStreamable sl@0: sl@0: @return The number of TEntry objects in the CDirStreamable sl@0: */ sl@0: IMPORT_C TInt Count() const; sl@0: sl@0: /** Retrieve the file system entry at a particular index sl@0: sl@0: @see TEntry sl@0: sl@0: @param aIndex The entry to retrieve sl@0: @return A reference to the TEntry stored by the CDirStreamable sl@0: */ sl@0: IMPORT_C const TEntry& operator[](TInt aIndex) const; sl@0: sl@0: /** Sort the entries in the specified order sl@0: @param aEntrySortKey A TEntryKey value used to sort the array. sl@0: @return KErrNone if sort was successful sl@0: */ sl@0: IMPORT_C TInt Sort(TUint aEntrySortKey); sl@0: sl@0: public: sl@0: /** Write this CDirStreamable to a stream sl@0: @param aStream The stream to write to sl@0: */ sl@0: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; sl@0: sl@0: private: sl@0: CDirStreamable(); sl@0: void ConstructL(); sl@0: void ConstructL(CDir& aDir); sl@0: sl@0: void InternalizeL(RReadStream& aStream); sl@0: }; sl@0: } sl@0: sl@0: #endif sl@0: