|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // $Header$ |
|
15 // CCatalogue.h |
|
16 // This header file introduces the CDmpfile (dump file) class. |
|
17 // |
|
18 // |
|
19 |
|
20 #ifndef __CDMPFILE_H__ |
|
21 #define __CDMPFILE_H__ |
|
22 |
|
23 //----------------------------------------------------------------------------- |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <f32file.h> |
|
27 #include <e32std.h> // |
|
28 #include <s32file.h> // |
|
29 #include <e32hal.h> // |
|
30 #include <fbs.h> // |
|
31 |
|
32 //----------------------------------------------------------------------------- |
|
33 |
|
34 class CDmpfile : public CBase |
|
35 { |
|
36 |
|
37 public: // Constructors and destructors |
|
38 |
|
39 static CDmpfile* New (); |
|
40 static CDmpfile* NewL (); |
|
41 static CDmpfile* NewLC(); |
|
42 ~CDmpfile(); |
|
43 |
|
44 private: // Constructors and destructors |
|
45 |
|
46 void ConstructL(); |
|
47 CDmpfile( ) {}; |
|
48 |
|
49 public: // New functions |
|
50 |
|
51 // Open. Open existing file without replacing it. If |
|
52 // it does not already exist, create it. |
|
53 TInt Open( const TDesC& aFile ); |
|
54 TInt Open( const TDesC& aPath, const TDesC& aFile ); |
|
55 |
|
56 // Replace. Open existing file replacing its contents. |
|
57 // If it does not already exist, create it. |
|
58 TInt Replace( const TDesC& aFile ); |
|
59 TInt Replace( const TDesC& aPath, const TDesC& aFile ); |
|
60 |
|
61 // Open or Replace again. These functions first close |
|
62 // the file if it happens to have been left open, and |
|
63 // then Open or Replace. You can call these ones also |
|
64 // after closing the file yourself. |
|
65 TInt Open(); |
|
66 TInt Replace(); |
|
67 |
|
68 // Close file. |
|
69 void Close(); |
|
70 |
|
71 // Write. |
|
72 TInt Write( const TDesC8& aDes ); |
|
73 TInt Write( const TDesC8& aDes, TInt aLength ); |
|
74 |
|
75 // Flush. |
|
76 TInt Flush(); |
|
77 |
|
78 // Set flush write On/Off. |
|
79 void SetFlush( TBool doFlush=ETrue ); |
|
80 |
|
81 // Get size. Negative KErr* if fails. |
|
82 TInt Size(); |
|
83 |
|
84 // Is Open? |
|
85 TBool IsOpen(); |
|
86 |
|
87 // Get (full) file name. |
|
88 TPtrC FileName() const; |
|
89 |
|
90 // Get error, error code returned by the last called |
|
91 // function. |
|
92 TInt Error(); |
|
93 |
|
94 private: |
|
95 |
|
96 // Open/Replace. |
|
97 TInt DoOpen(); |
|
98 TInt DoReplace(); |
|
99 |
|
100 private: // Data |
|
101 |
|
102 // Is open? |
|
103 TBool iIsOpen; |
|
104 |
|
105 // Flush write? |
|
106 TBool iDoFlush; |
|
107 |
|
108 // File (full) name. |
|
109 TFileName iFileName; |
|
110 |
|
111 // Parse buffer. |
|
112 TParse iParse; |
|
113 |
|
114 // File server session. |
|
115 RFs iFs; |
|
116 |
|
117 // File handle. |
|
118 RFile iFile; |
|
119 |
|
120 // Last error. |
|
121 TInt iError; |
|
122 |
|
123 }; |
|
124 |
|
125 //----------------------------------------------------------------------------- |
|
126 |
|
127 #endif // __CDMPFILE_H__ |
|
128 |
|
129 //----------------------------------------------------------------------------- |
|
130 // End of File |
|
131 //----------------------------------------------------------------------------- |