contentmgmt/contentaccessfwfordrm/inc/dirstreamable.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /** 
       
    21 @file
       
    22 
       
    23 @publishedPartner
       
    24 @released
       
    25 */
       
    26 
       
    27 
       
    28 #ifndef __DIRSTREAMABLE_H__
       
    29 #define __DIRSTREAMABLE_H__
       
    30 
       
    31 #include <f32file.h>
       
    32 #include <s32strm.h>
       
    33 #include <caf/caftypes.h>
       
    34 
       
    35 namespace ContentAccess
       
    36 	{
       
    37 	/** Emulates the behavior of a CDir object with the addition of
       
    38 	streaming. 
       
    39 	
       
    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
       
    44 
       
    45 	@publishedPartner
       
    46 	@released
       
    47 	*/
       
    48 	class CDirStreamable : public CDir
       
    49 		{
       
    50 	public:
       
    51 		/** Constuct an empty CDirStreamable 
       
    52 		@return a CDirStreamable with no entries
       
    53 		*/
       
    54 		IMPORT_C static CDirStreamable* NewL();
       
    55 
       
    56 		/** Construct a CDirStreamable object from the result
       
    57 		of a call to RFs::GetDir()
       
    58 		
       
    59 		@param aDir A CDir object which has been constructed by a previous call 
       
    60 		to RFs::GetDir()
       
    61 		@return A new CDirStreamable object
       
    62 		*/
       
    63 		IMPORT_C static CDirStreamable* NewL(CDir& aDir);
       
    64 		
       
    65 		/** Construct a CDirStreamable object from a stream
       
    66 		
       
    67 		@param aStream The stream to read the CDirStreamable object from
       
    68 		@return A new CDirStreamable object
       
    69 		*/
       
    70 		IMPORT_C static CDirStreamable* NewL(RReadStream aStream);
       
    71 		
       
    72 	public:
       
    73         virtual ~CDirStreamable();
       
    74 
       
    75 		/** Add an entry 
       
    76 		@param aEntry The directory entry to add
       
    77 		*/
       
    78 		IMPORT_C void AddL(const TEntry &aEntry);
       
    79 
       
    80 		/** The number of file system entries in the CDirStreamable
       
    81 		
       
    82 		@return The number of TEntry objects in the CDirStreamable
       
    83 		*/
       
    84 	    IMPORT_C TInt Count() const;
       
    85 	    
       
    86 	    /** Retrieve the file system entry at a particular index
       
    87 		
       
    88 		@see TEntry
       
    89 
       
    90 	    @param aIndex The entry to retrieve
       
    91 	    @return A reference to the TEntry stored by the CDirStreamable
       
    92 		*/
       
    93 		IMPORT_C const TEntry& operator[](TInt aIndex) const;
       
    94 		
       
    95 	    /** Sort the entries in the specified order 
       
    96 	    @param aEntrySortKey A TEntryKey value used to sort the array.
       
    97 	    @return KErrNone if sort was successful
       
    98 		*/
       
    99         IMPORT_C TInt Sort(TUint aEntrySortKey);
       
   100         
       
   101     public:
       
   102 		/** Write this CDirStreamable to a stream
       
   103 	    @param aStream The stream to write to
       
   104 		*/
       
   105     	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   106 
       
   107 	private:
       
   108 		CDirStreamable();
       
   109 		void ConstructL();
       
   110 		void ConstructL(CDir& aDir);
       
   111 		
       
   112 		void InternalizeL(RReadStream& aStream);
       
   113 		};
       
   114 	}
       
   115 	
       
   116 #endif
       
   117