|
23 | 23 | #ifndef IO_H |
24 | 24 | #define IO_H |
25 | 25 |
|
26 | | -/** A string is a string; simple as that */ |
27 | | -typedef std::string string; |
28 | | - |
29 | 26 | /** |
30 | 27 | * Simple class to perform binary and string reading from a file. |
31 | 28 | */ |
32 | 29 | class FileReader { |
33 | 30 | FILE *file; ///< The file to be read by this instance |
34 | | - string filename; ///< The filename of the file |
| 31 | + std::string filename; ///< The filename of the file |
35 | 32 |
|
36 | 33 | public: |
37 | 34 | /** |
38 | 35 | * Create a new reader for the given file. |
39 | 36 | * @param filename the file to read from |
40 | 37 | * @param binary read the file as binary or text? |
41 | 38 | */ |
42 | | - FileReader(string filename, bool binary = true); |
| 39 | + FileReader(const std::string &filename, bool binary = true); |
43 | 40 |
|
44 | 41 | /** |
45 | 42 | * Cleans up our mess |
@@ -96,24 +93,24 @@ class FileReader { |
96 | 93 | * Get the filename of this file. |
97 | 94 | * @return the filename |
98 | 95 | */ |
99 | | - string GetFilename() const; |
| 96 | + const std::string &GetFilename() const; |
100 | 97 | }; |
101 | 98 |
|
102 | 99 | /** |
103 | 100 | * Simple class to perform binary and string writing to a file. |
104 | 101 | */ |
105 | 102 | class FileWriter { |
106 | 103 | FILE *file; ///< The file to be read by this instance |
107 | | - string filename; ///< The filename of the file |
108 | | - string filename_new; ///< The filename for the temporary file |
| 104 | + std::string filename; ///< The filename of the file |
| 105 | + std::string filename_new; ///< The filename for the temporary file |
109 | 106 |
|
110 | 107 | public: |
111 | 108 | /** |
112 | 109 | * Create a new writer for the given file. |
113 | 110 | * @param filename the file to write to |
114 | 111 | * @param binary write the file as binary or text? |
115 | 112 | */ |
116 | | - FileWriter(string filename, bool binary = true); |
| 113 | + FileWriter(const std::string &filename, bool binary = true); |
117 | 114 |
|
118 | 115 | /** |
119 | 116 | * Cleans up our mess |
@@ -162,7 +159,7 @@ class FileWriter { |
162 | 159 | * Get the filename of this file. |
163 | 160 | * @return the filename |
164 | 161 | */ |
165 | | - string GetFilename() const; |
| 162 | + const std::string &GetFilename() const; |
166 | 163 |
|
167 | 164 | /** |
168 | 165 | * Close the output, i.e. commit the file to disk. |
|
0 commit comments