Update contrib.
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 #ifndef __DIRSTREAMABLE_H__
29 #define __DIRSTREAMABLE_H__
33 #include <caf/caftypes.h>
35 namespace ContentAccess
37 /** Emulates the behavior of a CDir object with the addition of
40 Functions are not virtual and do not override the CDir
41 functions so most of the time this class will be used as if it was
42 a CDir. It is only when used explicitly as a CDirStreamable that
43 any additional functionality is invoked
46 class CDirStreamable : public CDir
49 /** Constuct an empty CDirStreamable
50 @return a CDirStreamable with no entries
52 IMPORT_C static CDirStreamable* NewL();
54 /** Construct a CDirStreamable object from the result
55 of a call to RFs::GetDir()
57 @param aDir A CDir object which has been constructed by a previous call
59 @return A new CDirStreamable object
61 IMPORT_C static CDirStreamable* NewL(CDir& aDir);
63 /** Construct a CDirStreamable object from a stream
65 @param aStream The stream to read the CDirStreamable object from
66 @return A new CDirStreamable object
68 IMPORT_C static CDirStreamable* NewL(RReadStream aStream);
71 virtual ~CDirStreamable();
74 @param aEntry The directory entry to add
76 IMPORT_C void AddL(const TEntry &aEntry);
78 /** The number of file system entries in the CDirStreamable
80 @return The number of TEntry objects in the CDirStreamable
82 IMPORT_C TInt Count() const;
84 /** Retrieve the file system entry at a particular index
88 @param aIndex The entry to retrieve
89 @return A reference to the TEntry stored by the CDirStreamable
91 IMPORT_C const TEntry& operator[](TInt aIndex) const;
93 /** Sort the entries in the specified order
94 @param aEntrySortKey A TEntryKey value used to sort the array.
95 @return KErrNone if sort was successful
97 IMPORT_C TInt Sort(TUint aEntrySortKey);
100 /** Write this CDirStreamable to a stream
101 @param aStream The stream to write to
103 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
108 void ConstructL(CDir& aDir);
110 void InternalizeL(RReadStream& aStream);