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