|
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 #ifndef CPOSFILEHANDLER_H |
|
21 #define CPOSFILEHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <s32file.h> |
|
25 #include <badesca.h> |
|
26 #include "EPos_SimPsyConstants.h" |
|
27 |
|
28 /** |
|
29 * A helper class to access files and read from files. |
|
30 */ |
|
31 class CPosFileHandler : public CBase |
|
32 { |
|
33 public: // Constructors and destructor |
|
34 |
|
35 /** |
|
36 * Two-phased constructor. |
|
37 * |
|
38 * @param aFileName The name of the file to read from. |
|
39 */ |
|
40 static CPosFileHandler* NewL( |
|
41 /* IN */ const TDesC& aFileName |
|
42 ); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CPosFileHandler(); |
|
48 |
|
49 public: // New functions |
|
50 |
|
51 /** |
|
52 * Reads one line from file (asynchronously) |
|
53 * |
|
54 * @param aDes A buffer to store the incoming data. |
|
55 * |
|
56 * @return System wide error code. |
|
57 */ |
|
58 TInt Read( |
|
59 /* OUT */ TDes8& aDes |
|
60 ); |
|
61 |
|
62 /** |
|
63 * Populates the incoming array with simulation data. |
|
64 * |
|
65 * @param aArray An array to store the simulation data. |
|
66 */ |
|
67 void ReadL( |
|
68 /* OUT */ CDesC8Array& aArray |
|
69 ); |
|
70 |
|
71 private: |
|
72 |
|
73 /** |
|
74 * C++ default constructor. |
|
75 */ |
|
76 CPosFileHandler(); |
|
77 |
|
78 /** |
|
79 * EPOC constructor. |
|
80 * |
|
81 * @param aFileName The name of the file to read from. |
|
82 */ |
|
83 void ConstructL( |
|
84 /* IN */ const TDesC& aFileName |
|
85 ); |
|
86 |
|
87 /** |
|
88 * Resets the file handler to read from the start of the file. |
|
89 */ |
|
90 TInt ReadFromStart(); |
|
91 |
|
92 // Prohibit copy constructor |
|
93 CPosFileHandler( const CPosFileHandler& ); |
|
94 // Prohibit assigment operator |
|
95 CPosFileHandler& operator= ( const CPosFileHandler& ); |
|
96 |
|
97 private: // Data |
|
98 //Handle to file server session |
|
99 RFs iFsSession; |
|
100 |
|
101 //Instance of RFile. Creating, opening and operating on files. |
|
102 RFile iFile; |
|
103 |
|
104 //Instance of RFileReadStream. Reading of a stream from file. |
|
105 RFileReadStream iStream; |
|
106 |
|
107 HBufC* iFileName; |
|
108 }; |
|
109 |
|
110 #endif // CPOSFILEHANDLER_H |
|
111 |
|
112 // End of File |