author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@2 | 5 |
* under the terms of the License "Eclipse Public License v1.0" |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@2 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
|
williamr@2 | 20 |
/** |
williamr@2 | 21 |
@file |
williamr@2 | 22 |
|
williamr@4 | 23 |
@publishedAll |
williamr@2 | 24 |
@released |
williamr@2 | 25 |
*/ |
williamr@2 | 26 |
|
williamr@2 | 27 |
|
williamr@2 | 28 |
#ifndef __DIRSTREAMABLE_H__ |
williamr@2 | 29 |
#define __DIRSTREAMABLE_H__ |
williamr@2 | 30 |
|
williamr@2 | 31 |
#include <f32file.h> |
williamr@2 | 32 |
#include <s32strm.h> |
williamr@2 | 33 |
#include <caf/caftypes.h> |
williamr@2 | 34 |
|
williamr@2 | 35 |
namespace ContentAccess |
williamr@2 | 36 |
{ |
williamr@2 | 37 |
/** Emulates the behavior of a CDir object with the addition of |
williamr@2 | 38 |
streaming. |
williamr@2 | 39 |
|
williamr@2 | 40 |
Functions are not virtual and do not override the CDir |
williamr@2 | 41 |
functions so most of the time this class will be used as if it was |
williamr@2 | 42 |
a CDir. It is only when used explicitly as a CDirStreamable that |
williamr@2 | 43 |
any additional functionality is invoked |
williamr@2 | 44 |
|
williamr@2 | 45 |
*/ |
williamr@2 | 46 |
class CDirStreamable : public CDir |
williamr@2 | 47 |
{ |
williamr@2 | 48 |
public: |
williamr@2 | 49 |
/** Constuct an empty CDirStreamable |
williamr@2 | 50 |
@return a CDirStreamable with no entries |
williamr@2 | 51 |
*/ |
williamr@2 | 52 |
IMPORT_C static CDirStreamable* NewL(); |
williamr@2 | 53 |
|
williamr@2 | 54 |
/** Construct a CDirStreamable object from the result |
williamr@2 | 55 |
of a call to RFs::GetDir() |
williamr@2 | 56 |
|
williamr@2 | 57 |
@param aDir A CDir object which has been constructed by a previous call |
williamr@2 | 58 |
to RFs::GetDir() |
williamr@2 | 59 |
@return A new CDirStreamable object |
williamr@2 | 60 |
*/ |
williamr@2 | 61 |
IMPORT_C static CDirStreamable* NewL(CDir& aDir); |
williamr@2 | 62 |
|
williamr@2 | 63 |
/** Construct a CDirStreamable object from a stream |
williamr@2 | 64 |
|
williamr@2 | 65 |
@param aStream The stream to read the CDirStreamable object from |
williamr@2 | 66 |
@return A new CDirStreamable object |
williamr@2 | 67 |
*/ |
williamr@2 | 68 |
IMPORT_C static CDirStreamable* NewL(RReadStream aStream); |
williamr@2 | 69 |
|
williamr@2 | 70 |
public: |
williamr@2 | 71 |
virtual ~CDirStreamable(); |
williamr@2 | 72 |
|
williamr@2 | 73 |
/** Add an entry |
williamr@2 | 74 |
@param aEntry The directory entry to add |
williamr@2 | 75 |
*/ |
williamr@2 | 76 |
IMPORT_C void AddL(const TEntry &aEntry); |
williamr@2 | 77 |
|
williamr@2 | 78 |
/** The number of file system entries in the CDirStreamable |
williamr@2 | 79 |
|
williamr@2 | 80 |
@return The number of TEntry objects in the CDirStreamable |
williamr@2 | 81 |
*/ |
williamr@2 | 82 |
IMPORT_C TInt Count() const; |
williamr@2 | 83 |
|
williamr@2 | 84 |
/** Retrieve the file system entry at a particular index |
williamr@2 | 85 |
|
williamr@2 | 86 |
@see TEntry |
williamr@2 | 87 |
|
williamr@2 | 88 |
@param aIndex The entry to retrieve |
williamr@2 | 89 |
@return A reference to the TEntry stored by the CDirStreamable |
williamr@2 | 90 |
*/ |
williamr@2 | 91 |
IMPORT_C const TEntry& operator[](TInt aIndex) const; |
williamr@2 | 92 |
|
williamr@2 | 93 |
/** Sort the entries in the specified order |
williamr@2 | 94 |
@param aEntrySortKey A TEntryKey value used to sort the array. |
williamr@2 | 95 |
@return KErrNone if sort was successful |
williamr@2 | 96 |
*/ |
williamr@2 | 97 |
IMPORT_C TInt Sort(TUint aEntrySortKey); |
williamr@2 | 98 |
|
williamr@2 | 99 |
public: |
williamr@2 | 100 |
/** Write this CDirStreamable to a stream |
williamr@2 | 101 |
@param aStream The stream to write to |
williamr@2 | 102 |
*/ |
williamr@2 | 103 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
williamr@2 | 104 |
|
williamr@2 | 105 |
private: |
williamr@2 | 106 |
CDirStreamable(); |
williamr@2 | 107 |
void ConstructL(); |
williamr@2 | 108 |
void ConstructL(CDir& aDir); |
williamr@2 | 109 |
|
williamr@2 | 110 |
void InternalizeL(RReadStream& aStream); |
williamr@2 | 111 |
}; |
williamr@2 | 112 |
} |
williamr@2 | 113 |
|
williamr@2 | 114 |
#endif |
williamr@2 | 115 |