| 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 RUNTIME_BIN_FILE_H_ | 5 #ifndef RUNTIME_BIN_FILE_H_ |
| 6 #define RUNTIME_BIN_FILE_H_ | 6 #define RUNTIME_BIN_FILE_H_ |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // FileMode.READ, FileMode.WRITE, FileMode.APPEND, | 53 // FileMode.READ, FileMode.WRITE, FileMode.APPEND, |
| 54 // FileMode.WRITE_ONLY and FileMode.WRITE_ONLY_APPEND in file.dart. | 54 // FileMode.WRITE_ONLY and FileMode.WRITE_ONLY_APPEND in file.dart. |
| 55 enum DartFileOpenMode { | 55 enum DartFileOpenMode { |
| 56 kDartRead = 0, | 56 kDartRead = 0, |
| 57 kDartWrite = 1, | 57 kDartWrite = 1, |
| 58 kDartAppend = 2, | 58 kDartAppend = 2, |
| 59 kDartWriteOnly = 3, | 59 kDartWriteOnly = 3, |
| 60 kDartWriteOnlyAppend = 4 | 60 kDartWriteOnlyAppend = 4 |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // These values have to be kept in sync with the values of |
| 64 // _FileTranslation.text and _FileTranslation.binary in file_impl.dart |
| 65 enum DartFileTranslation { |
| 66 kText = 0, |
| 67 kBinary = 1, |
| 68 }; |
| 69 |
| 63 enum Type { kIsFile = 0, kIsDirectory = 1, kIsLink = 2, kDoesNotExist = 3 }; | 70 enum Type { kIsFile = 0, kIsDirectory = 1, kIsLink = 2, kDoesNotExist = 3 }; |
| 64 | 71 |
| 65 enum Identical { kIdentical = 0, kDifferent = 1, kError = 2 }; | 72 enum Identical { kIdentical = 0, kDifferent = 1, kError = 2 }; |
| 66 | 73 |
| 67 enum StdioHandleType { | 74 enum StdioHandleType { |
| 68 kTerminal = 0, | 75 kTerminal = 0, |
| 69 kPipe = 1, | 76 kPipe = 1, |
| 70 kFile = 2, | 77 kFile = 2, |
| 71 kSocket = 3, | 78 kSocket = 3, |
| 72 kOther = 4 | 79 kOther = 4 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // be determined (e.g. not seekable device). | 126 // be determined (e.g. not seekable device). |
| 120 int64_t Length(); | 127 int64_t Length(); |
| 121 | 128 |
| 122 // Get the current position in the file. | 129 // Get the current position in the file. |
| 123 // Returns a negative value if position cannot be determined. | 130 // Returns a negative value if position cannot be determined. |
| 124 int64_t Position(); | 131 int64_t Position(); |
| 125 | 132 |
| 126 // Set the byte position in the file. | 133 // Set the byte position in the file. |
| 127 bool SetPosition(int64_t position); | 134 bool SetPosition(int64_t position); |
| 128 | 135 |
| 136 // Set the translation mode of the file. This is currently a no-op unless the |
| 137 // file is for a terminal on Windows. |
| 138 void SetTranslation(DartFileTranslation translation); |
| 139 |
| 129 // Truncate (or extend) the file to the given length in bytes. | 140 // Truncate (or extend) the file to the given length in bytes. |
| 130 bool Truncate(int64_t length); | 141 bool Truncate(int64_t length); |
| 131 | 142 |
| 132 // Flush contents of file. | 143 // Flush contents of file. |
| 133 bool Flush(); | 144 bool Flush(); |
| 134 | 145 |
| 135 // Lock range of a file. | 146 // Lock range of a file. |
| 136 bool Lock(LockType lock, int64_t start, int64_t end); | 147 bool Lock(LockType lock, int64_t start, int64_t end); |
| 137 | 148 |
| 138 // Returns whether the file has been closed. | 149 // Returns whether the file has been closed. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 Dart_WeakPersistentHandle weak_handle_; | 258 Dart_WeakPersistentHandle weak_handle_; |
| 248 | 259 |
| 249 friend class ReferenceCounted<File>; | 260 friend class ReferenceCounted<File>; |
| 250 DISALLOW_COPY_AND_ASSIGN(File); | 261 DISALLOW_COPY_AND_ASSIGN(File); |
| 251 }; | 262 }; |
| 252 | 263 |
| 253 } // namespace bin | 264 } // namespace bin |
| 254 } // namespace dart | 265 } // namespace dart |
| 255 | 266 |
| 256 #endif // RUNTIME_BIN_FILE_H_ | 267 #endif // RUNTIME_BIN_FILE_H_ |
| OLD | NEW |