1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/caf/dirstreamable.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,117 @@
1.4 +/*
1.5 +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +/**
1.24 +@file
1.25 +
1.26 +@publishedPartner
1.27 +@released
1.28 +*/
1.29 +
1.30 +
1.31 +#ifndef __DIRSTREAMABLE_H__
1.32 +#define __DIRSTREAMABLE_H__
1.33 +
1.34 +#include <f32file.h>
1.35 +#include <s32strm.h>
1.36 +#include <caf/caftypes.h>
1.37 +
1.38 +namespace ContentAccess
1.39 + {
1.40 + /** Emulates the behavior of a CDir object with the addition of
1.41 + streaming.
1.42 +
1.43 + Functions are not virtual and do not override the CDir
1.44 + functions so most of the time this class will be used as if it was
1.45 + a CDir. It is only when used explicitly as a CDirStreamable that
1.46 + any additional functionality is invoked
1.47 +
1.48 + @publishedPartner
1.49 + @released
1.50 + */
1.51 + class CDirStreamable : public CDir
1.52 + {
1.53 + public:
1.54 + /** Constuct an empty CDirStreamable
1.55 + @return a CDirStreamable with no entries
1.56 + */
1.57 + IMPORT_C static CDirStreamable* NewL();
1.58 +
1.59 + /** Construct a CDirStreamable object from the result
1.60 + of a call to RFs::GetDir()
1.61 +
1.62 + @param aDir A CDir object which has been constructed by a previous call
1.63 + to RFs::GetDir()
1.64 + @return A new CDirStreamable object
1.65 + */
1.66 + IMPORT_C static CDirStreamable* NewL(CDir& aDir);
1.67 +
1.68 + /** Construct a CDirStreamable object from a stream
1.69 +
1.70 + @param aStream The stream to read the CDirStreamable object from
1.71 + @return A new CDirStreamable object
1.72 + */
1.73 + IMPORT_C static CDirStreamable* NewL(RReadStream aStream);
1.74 +
1.75 + public:
1.76 + virtual ~CDirStreamable();
1.77 +
1.78 + /** Add an entry
1.79 + @param aEntry The directory entry to add
1.80 + */
1.81 + IMPORT_C void AddL(const TEntry &aEntry);
1.82 +
1.83 + /** The number of file system entries in the CDirStreamable
1.84 +
1.85 + @return The number of TEntry objects in the CDirStreamable
1.86 + */
1.87 + IMPORT_C TInt Count() const;
1.88 +
1.89 + /** Retrieve the file system entry at a particular index
1.90 +
1.91 + @see TEntry
1.92 +
1.93 + @param aIndex The entry to retrieve
1.94 + @return A reference to the TEntry stored by the CDirStreamable
1.95 + */
1.96 + IMPORT_C const TEntry& operator[](TInt aIndex) const;
1.97 +
1.98 + /** Sort the entries in the specified order
1.99 + @param aEntrySortKey A TEntryKey value used to sort the array.
1.100 + @return KErrNone if sort was successful
1.101 + */
1.102 + IMPORT_C TInt Sort(TUint aEntrySortKey);
1.103 +
1.104 + public:
1.105 + /** Write this CDirStreamable to a stream
1.106 + @param aStream The stream to write to
1.107 + */
1.108 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.109 +
1.110 + private:
1.111 + CDirStreamable();
1.112 + void ConstructL();
1.113 + void ConstructL(CDir& aDir);
1.114 +
1.115 + void InternalizeL(RReadStream& aStream);
1.116 + };
1.117 + }
1.118 +
1.119 +#endif
1.120 +