epoc32/include/caf/dirstreamable.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
    23
@publishedPartner
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
	@publishedPartner
williamr@2
    46
	@released
williamr@2
    47
	*/
williamr@2
    48
	class CDirStreamable : public CDir
williamr@2
    49
		{
williamr@2
    50
	public:
williamr@2
    51
		/** Constuct an empty CDirStreamable 
williamr@2
    52
		@return a CDirStreamable with no entries
williamr@2
    53
		*/
williamr@2
    54
		IMPORT_C static CDirStreamable* NewL();
williamr@2
    55
williamr@2
    56
		/** Construct a CDirStreamable object from the result
williamr@2
    57
		of a call to RFs::GetDir()
williamr@2
    58
		
williamr@2
    59
		@param aDir A CDir object which has been constructed by a previous call 
williamr@2
    60
		to RFs::GetDir()
williamr@2
    61
		@return A new CDirStreamable object
williamr@2
    62
		*/
williamr@2
    63
		IMPORT_C static CDirStreamable* NewL(CDir& aDir);
williamr@2
    64
		
williamr@2
    65
		/** Construct a CDirStreamable object from a stream
williamr@2
    66
		
williamr@2
    67
		@param aStream The stream to read the CDirStreamable object from
williamr@2
    68
		@return A new CDirStreamable object
williamr@2
    69
		*/
williamr@2
    70
		IMPORT_C static CDirStreamable* NewL(RReadStream aStream);
williamr@2
    71
		
williamr@2
    72
	public:
williamr@2
    73
        virtual ~CDirStreamable();
williamr@2
    74
williamr@2
    75
		/** Add an entry 
williamr@2
    76
		@param aEntry The directory entry to add
williamr@2
    77
		*/
williamr@2
    78
		IMPORT_C void AddL(const TEntry &aEntry);
williamr@2
    79
williamr@2
    80
		/** The number of file system entries in the CDirStreamable
williamr@2
    81
		
williamr@2
    82
		@return The number of TEntry objects in the CDirStreamable
williamr@2
    83
		*/
williamr@2
    84
	    IMPORT_C TInt Count() const;
williamr@2
    85
	    
williamr@2
    86
	    /** Retrieve the file system entry at a particular index
williamr@2
    87
		
williamr@2
    88
		@see TEntry
williamr@2
    89
williamr@2
    90
	    @param aIndex The entry to retrieve
williamr@2
    91
	    @return A reference to the TEntry stored by the CDirStreamable
williamr@2
    92
		*/
williamr@2
    93
		IMPORT_C const TEntry& operator[](TInt aIndex) const;
williamr@2
    94
		
williamr@2
    95
	    /** Sort the entries in the specified order 
williamr@2
    96
	    @param aEntrySortKey A TEntryKey value used to sort the array.
williamr@2
    97
	    @return KErrNone if sort was successful
williamr@2
    98
		*/
williamr@2
    99
        IMPORT_C TInt Sort(TUint aEntrySortKey);
williamr@2
   100
        
williamr@2
   101
    public:
williamr@2
   102
		/** Write this CDirStreamable to a stream
williamr@2
   103
	    @param aStream The stream to write to
williamr@2
   104
		*/
williamr@2
   105
    	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   106
williamr@2
   107
	private:
williamr@2
   108
		CDirStreamable();
williamr@2
   109
		void ConstructL();
williamr@2
   110
		void ConstructL(CDir& aDir);
williamr@2
   111
		
williamr@2
   112
		void InternalizeL(RReadStream& aStream);
williamr@2
   113
		};
williamr@2
   114
	}
williamr@2
   115
	
williamr@2
   116
#endif
williamr@2
   117