| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 off_t SetPosition(int64_t position); | 49 off_t SetPosition(int64_t position); |
| 50 | 50 |
| 51 // Flush contents of file. | 51 // Flush contents of file. |
| 52 void Flush(); | 52 void Flush(); |
| 53 | 53 |
| 54 const char* name() const { return name_; } | 54 const char* name() const { return name_; } |
| 55 | 55 |
| 56 static File* Open(const char* name, bool writable); | 56 static File* Open(const char* name, bool writable); |
| 57 static bool Exists(const char* name); | 57 static bool Exists(const char* name); |
| 58 static bool Create(const char* name); | 58 static bool Create(const char* name); |
| 59 static bool Delete(const char* name); |
| 59 static bool IsAbsolutePath(const char* pathname); | 60 static bool IsAbsolutePath(const char* pathname); |
| 60 static char* GetCanonicalPath(const char* name); | 61 static char* GetCanonicalPath(const char* name); |
| 61 static const char* PathSeparator(); | 62 static const char* PathSeparator(); |
| 62 static const char* StringEscapedPathSeparator(); | 63 static const char* StringEscapedPathSeparator(); |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { } | 66 File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { } |
| 66 void Close(); | 67 void Close(); |
| 67 bool IsClosed(); | 68 bool IsClosed(); |
| 68 | 69 |
| 69 static const int kClosedFd = -1; | 70 static const int kClosedFd = -1; |
| 70 | 71 |
| 71 const char* name_; | 72 const char* name_; |
| 72 // FileHandle is an OS specific class which stores data about the file. | 73 // FileHandle is an OS specific class which stores data about the file. |
| 73 FileHandle* handle_; // OS specific handle for the file. | 74 FileHandle* handle_; // OS specific handle for the file. |
| 74 | 75 |
| 75 // DISALLOW_COPY_AND_ASSIGN(File). | 76 // DISALLOW_COPY_AND_ASSIGN(File). |
| 76 File(const File&); | 77 File(const File&); |
| 77 void operator=(const File&); | 78 void operator=(const File&); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 #endif // BIN_FILE_H_ | 81 #endif // BIN_FILE_H_ |
| OLD | NEW |