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