os/security/contentmgmt/contentaccessfwfordrm/inc/dirstreamable.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 @publishedAll
    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 	*/
    46 	class CDirStreamable : public CDir
    47 		{
    48 	public:
    49 		/** Constuct an empty CDirStreamable 
    50 		@return a CDirStreamable with no entries
    51 		*/
    52 		IMPORT_C static CDirStreamable* NewL();
    53 
    54 		/** Construct a CDirStreamable object from the result
    55 		of a call to RFs::GetDir()
    56 		
    57 		@param aDir A CDir object which has been constructed by a previous call 
    58 		to RFs::GetDir()
    59 		@return A new CDirStreamable object
    60 		*/
    61 		IMPORT_C static CDirStreamable* NewL(CDir& aDir);
    62 		
    63 		/** Construct a CDirStreamable object from a stream
    64 		
    65 		@param aStream The stream to read the CDirStreamable object from
    66 		@return A new CDirStreamable object
    67 		*/
    68 		IMPORT_C static CDirStreamable* NewL(RReadStream aStream);
    69 		
    70 	public:
    71         virtual ~CDirStreamable();
    72 
    73 		/** Add an entry 
    74 		@param aEntry The directory entry to add
    75 		*/
    76 		IMPORT_C void AddL(const TEntry &aEntry);
    77 
    78 		/** The number of file system entries in the CDirStreamable
    79 		
    80 		@return The number of TEntry objects in the CDirStreamable
    81 		*/
    82 	    IMPORT_C TInt Count() const;
    83 	    
    84 	    /** Retrieve the file system entry at a particular index
    85 		
    86 		@see TEntry
    87 
    88 	    @param aIndex The entry to retrieve
    89 	    @return A reference to the TEntry stored by the CDirStreamable
    90 		*/
    91 		IMPORT_C const TEntry& operator[](TInt aIndex) const;
    92 		
    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
    96 		*/
    97         IMPORT_C TInt Sort(TUint aEntrySortKey);
    98         
    99     public:
   100 		/** Write this CDirStreamable to a stream
   101 	    @param aStream The stream to write to
   102 		*/
   103     	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   104 
   105 	private:
   106 		CDirStreamable();
   107 		void ConstructL();
   108 		void ConstructL(CDir& aDir);
   109 		
   110 		void InternalizeL(RReadStream& aStream);
   111 		};
   112 	}
   113 	
   114 #endif
   115