os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/inc/T_FileData.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 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 "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 @test
    21 @internalComponent
    22 
    23 This contains CT_FileData
    24 */
    25 
    26 #if (!defined __T_FILE_DATA_H__)
    27 #define __T_FILE_DATA_H__
    28 
    29 //	User Includes
    30 #include "DataWrapperBase.h"
    31 #include "T_FsData.h"
    32 #include "T_FileActiveCallback.h"
    33 
    34 //	EPOC includes
    35 #include <f32file.h>
    36 
    37 class CT_FileData: public CDataWrapperBase
    38 	{
    39 public:
    40 	static CT_FileData*	NewL();
    41 	~CT_FileData();
    42 
    43 	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
    44 	virtual TAny*	GetObject();
    45 
    46 protected:
    47 	CT_FileData();
    48 	void ConstructL();
    49 
    50 private:
    51 	//	Commands
    52 	void	DoCmdNewL();
    53 	void	DoCmdDestructor();
    54 	void	DoCmdCreateL(const TDesC& aSection);
    55 	void	DoCmdOpenL(const TDesC& aSection);
    56 	void	DoCmdWriteL(const TDesC& aSection, const TInt aSyncErrorIndex);
    57 	void	DoCmdClose();
    58 	void 	DoCmdReplaceL(const TDesC& aSection);
    59 	void	DoCmdReadL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    60 	void 	DoCmdFlushL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    61 	void 	DoCmdTempL(const TDesC& aSection);
    62 	void 	DoCmdRenameL(const TDesC& aSection);
    63 	void	DoCmdSeekL(const TDesC& aSection);
    64 	void	DoCmdReadCancelL(const TDesC& aSection);
    65 	void 	DoCmdLockL(const TDesC& aSection);
    66 	void 	DoCmdUnLockL(const TDesC& aSection);
    67 	void	DoCmdSizeL(const TDesC& aSection);
    68 	void	DoCmdSetSizeL(const TDesC& aSection);
    69 	void	DoCmdAttL(const TDesC& aSection);
    70 	void	DoCmdSetAttL(const TDesC& aSection);
    71 	void 	DoCmdModifiedL(const TDesC& aSection);
    72 	void 	DoCmdSetModifiedL(const TDesC& aSection);
    73 	void 	DoCmdSetL(const TDesC& aSection);
    74 	void 	DoCmdChangeModeL(const TDesC& aSection);
    75 	void	DoCmdDriveL(const TDesC& aSection);
    76 	void	DoCmdBlockMap(const TDesC& aSection);
    77 	void 	DoCmdDuplicateL(const TDesC& aSection);
    78 	void	DoCmdFullName(const TDesC& aSection);
    79 	void 	DoCmdNameL(const TDesC& aSection);
    80 		
    81 	
    82 
    83 	//	Helpers
    84 	inline void	DoCleanup();
    85 	
    86 	TBool GetFileModeL(const TDesC& aParameterName, const TDesC& aSection, TUint& aFileMode);
    87 	TBool ConvertToSeek(const TDesC& aParameterName, const TDesC& aSection, TSeek& aSeek);
    88 	TBool ConvertToOwnerType(const TDesC& aParameterName, const TDesC& aSection, TOwnerType& aResult);
    89 	TBool ConvertToAttributeL(const TDesC& aParameterName, const TDesC& aSection, TUint& aAttribute);
    90     TBool ConvertToBlockMapUsage(const TDesC& aParameterName, const TDesC& aSection, TBlockMapUsage& aResult);
    91 	
    92 	void RunL(CActive* aActive, const TInt aIndex); 
    93 	void DoCancel(CActive* aActive, TInt aIndex);
    94 	
    95 	void ReadCancelAll();	
    96 	void ReadCancel();
    97 	void DoAsynchronousWritesL(const TDesC& aSection, const TInt aSyncErrorIndex);
    98 	void DoSynchronousWritesL(const TDesC& aSection);
    99 	void HandleExpectedString(const TDesC8& aReadedData, const TDesC& aSection);
   100 	void HandleExpectedString(const TDesC& aReadedData, const TDesC& aSection);	
   101 	void DoSynchronousReadsL(const TDesC& aSection);
   102 	void DoAsynchronousReadsL(const TDesC& aSection, const TInt aAsyncErrorIndex);	
   103 	
   104 	void PrintFileAttributes(TUint aAttValue);
   105 	
   106 	void ToArrayL(RPointerArray<HBufC>& aArray, HBufC*& aBuffer);
   107 	RPointerArray<HBufC> SplitL(const TDesC& aInput, const char* aToken);
   108 
   109 
   110 private:
   111 	/** Instance for handling to resource file */
   112 	RPointerArray<CT_FileActiveCallback> iReadCallbackArray;
   113 	RPointerArray<CActiveCallback> iWriteCallbackArray;
   114 	RPointerArray<CActiveCallback> iFlushCallbackArray;
   115 	RFile*		iFile;
   116 	TBool 		iFileOpened;
   117 	};
   118 
   119 #endif /* __T_FILE_DATA_H__ */