OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef BIN_FILE_H_ | 5 #ifndef BIN_FILE_H_ |
6 #define BIN_FILE_H_ | 6 #define BIN_FILE_H_ |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 #include <sys/types.h> | 11 #include <sys/types.h> |
12 | 12 |
13 #include "bin/builtin.h" | 13 #include "bin/builtin.h" |
14 #include "bin/dartutils.h" | 14 #include "bin/dartutils.h" |
15 | 15 |
16 | 16 |
17 namespace dart { | 17 namespace dart { |
18 namespace bin { | 18 namespace bin { |
19 | 19 |
20 // Forward declaration. | 20 // Forward declaration. |
21 class FileHandle; | 21 class FileHandle; |
22 | 22 |
23 class File { | 23 class File { |
24 public: | 24 public: |
25 enum FileOpenMode { | 25 enum FileOpenMode { |
26 kRead = 0, | 26 kRead = 0, |
27 kWrite = 1, | 27 kWrite = 1, |
28 kTruncate = 1 << 2, | 28 kTruncate = 1 << 2, |
29 kWriteTruncate = kWrite | kTruncate | 29 kWriteOnly = 1 << 3, |
| 30 kWriteTruncate = kWrite | kTruncate, |
| 31 kWriteOnlyTruncate = kWriteOnly | kTruncate |
30 }; | 32 }; |
31 | 33 |
32 // These values have to be kept in sync with the mode values of | 34 // These values have to be kept in sync with the mode values of |
33 // FileMode.READ, FileMode.WRITE and FileMode.APPEND in file.dart. | 35 // FileMode.READ, FileMode.WRITE, FileMode.APPEND, |
| 36 // FileMode.WRITE_ONLY and FileMode.WRITE_ONLY_APPEND in file.dart. |
34 enum DartFileOpenMode { | 37 enum DartFileOpenMode { |
35 kDartRead = 0, | 38 kDartRead = 0, |
36 kDartWrite = 1, | 39 kDartWrite = 1, |
37 kDartAppend = 2 | 40 kDartAppend = 2, |
| 41 kDartWriteOnly = 3, |
| 42 kDartWriteOnlyAppend = 4 |
38 }; | 43 }; |
39 | 44 |
40 enum Type { | 45 enum Type { |
41 kIsFile = 0, | 46 kIsFile = 0, |
42 kIsDirectory = 1, | 47 kIsDirectory = 1, |
43 kIsLink = 2, | 48 kIsLink = 2, |
44 kDoesNotExist = 3 | 49 kDoesNotExist = 3 |
45 }; | 50 }; |
46 | 51 |
47 enum Identical { | 52 enum Identical { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // FileHandle is an OS specific class which stores data about the file. | 196 // FileHandle is an OS specific class which stores data about the file. |
192 FileHandle* handle_; // OS specific handle for the file. | 197 FileHandle* handle_; // OS specific handle for the file. |
193 | 198 |
194 DISALLOW_COPY_AND_ASSIGN(File); | 199 DISALLOW_COPY_AND_ASSIGN(File); |
195 }; | 200 }; |
196 | 201 |
197 } // namespace bin | 202 } // namespace bin |
198 } // namespace dart | 203 } // namespace dart |
199 | 204 |
200 #endif // BIN_FILE_H_ | 205 #endif // BIN_FILE_H_ |
OLD | NEW |