| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #if defined(_WIN32) | 8 #if defined(_WIN32) |
| 9 typedef signed __int64 int64_t; | 9 typedef signed __int64 int64_t; |
| 10 typedef unsigned __int8 uint8_t; | 10 typedef unsigned __int8 uint8_t; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return WriteFully(&byte, 1); | 39 return WriteFully(&byte, 1); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Get the length of the file. Returns a negative value if the length cannot | 42 // Get the length of the file. Returns a negative value if the length cannot |
| 43 // be determined (e.g. not seekable device). | 43 // be determined (e.g. not seekable device). |
| 44 off_t Length(); | 44 off_t Length(); |
| 45 | 45 |
| 46 // Get the current position in the file. | 46 // Get the current position in the file. |
| 47 // Returns a negative value if position cannot be determined. | 47 // Returns a negative value if position cannot be determined. |
| 48 off_t Position(); | 48 off_t Position(); |
| 49 off_t SetPosition(int64_t position); |
| 49 | 50 |
| 50 // Flush contents of file. | 51 // Flush contents of file. |
| 51 void Flush(); | 52 void Flush(); |
| 52 | 53 |
| 53 const char* name() const { return name_; } | 54 const char* name() const { return name_; } |
| 54 | 55 |
| 55 static File* Open(const char* name, bool writable); | 56 static File* Open(const char* name, bool writable); |
| 56 static bool Exists(const char* name); | 57 static bool Exists(const char* name); |
| 57 static bool Create(const char* name); | 58 static bool Create(const char* name); |
| 58 static bool IsAbsolutePath(const char* pathname); | 59 static bool IsAbsolutePath(const char* pathname); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 const char* name_; | 71 const char* name_; |
| 71 // FileHandle is an OS specific class which stores data about the file. | 72 // FileHandle is an OS specific class which stores data about the file. |
| 72 FileHandle* handle_; // OS specific handle for the file. | 73 FileHandle* handle_; // OS specific handle for the file. |
| 73 | 74 |
| 74 // DISALLOW_COPY_AND_ASSIGN(File). | 75 // DISALLOW_COPY_AND_ASSIGN(File). |
| 75 File(const File&); | 76 File(const File&); |
| 76 void operator=(const File&); | 77 void operator=(const File&); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 #endif // BIN_FILE_H_ | 80 #endif // BIN_FILE_H_ |
| OLD | NEW |