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> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 kSetPositionRequest = 8, | 69 kSetPositionRequest = 8, |
70 kTruncateRequest = 9, | 70 kTruncateRequest = 9, |
71 kLengthRequest = 10, | 71 kLengthRequest = 10, |
72 kLengthFromPathRequest = 11, | 72 kLengthFromPathRequest = 11, |
73 kLastModifiedRequest = 12, | 73 kLastModifiedRequest = 12, |
74 kFlushRequest = 13, | 74 kFlushRequest = 13, |
75 kReadByteRequest = 14, | 75 kReadByteRequest = 14, |
76 kWriteByteRequest = 15, | 76 kWriteByteRequest = 15, |
77 kReadRequest = 16, | 77 kReadRequest = 16, |
78 kReadListRequest = 17, | 78 kReadListRequest = 17, |
79 kWriteListRequest = 18 | 79 kWriteListRequest = 18, |
| 80 kDeleteLinkRequest = 19 |
80 }; | 81 }; |
81 | 82 |
82 ~File(); | 83 ~File(); |
83 | 84 |
84 // Read/Write attempt to transfer num_bytes to/from buffer. It returns | 85 // Read/Write attempt to transfer num_bytes to/from buffer. It returns |
85 // the number of bytes read/written. | 86 // the number of bytes read/written. |
86 int64_t Read(void* buffer, int64_t num_bytes); | 87 int64_t Read(void* buffer, int64_t num_bytes); |
87 int64_t Write(const void* buffer, int64_t num_bytes); | 88 int64_t Write(const void* buffer, int64_t num_bytes); |
88 | 89 |
89 // ReadFully and WriteFully do attempt to transfer num_bytes to/from | 90 // ReadFully and WriteFully do attempt to transfer num_bytes to/from |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 static File* Open(const char* path, FileOpenMode mode); | 125 static File* Open(const char* path, FileOpenMode mode); |
125 | 126 |
126 // Create a file object for the specified stdio file descriptor | 127 // Create a file object for the specified stdio file descriptor |
127 // (stdin, stout or stderr). | 128 // (stdin, stout or stderr). |
128 static File* OpenStdio(int fd); | 129 static File* OpenStdio(int fd); |
129 | 130 |
130 static bool Exists(const char* path); | 131 static bool Exists(const char* path); |
131 static bool Create(const char* path); | 132 static bool Create(const char* path); |
132 static bool CreateLink(const char* path, const char* target); | 133 static bool CreateLink(const char* path, const char* target); |
133 static bool Delete(const char* path); | 134 static bool Delete(const char* path); |
| 135 static bool DeleteLink(const char* path); |
134 static off_t LengthFromPath(const char* path); | 136 static off_t LengthFromPath(const char* path); |
135 static time_t LastModified(const char* path); | 137 static time_t LastModified(const char* path); |
136 static char* LinkTarget(const char* pathname); | 138 static char* LinkTarget(const char* pathname); |
137 static bool IsAbsolutePath(const char* path); | 139 static bool IsAbsolutePath(const char* path); |
138 static char* GetCanonicalPath(const char* path); | 140 static char* GetCanonicalPath(const char* path); |
139 static char* GetContainingDirectory(char* path); | 141 static char* GetContainingDirectory(char* path); |
140 static const char* PathSeparator(); | 142 static const char* PathSeparator(); |
141 static const char* StringEscapedPathSeparator(); | 143 static const char* StringEscapedPathSeparator(); |
142 static Type GetType(const char* path, bool follow_links); | 144 static Type GetType(const char* path, bool follow_links); |
143 static Identical AreIdentical(const char* file_1, const char* file_2); | 145 static Identical AreIdentical(const char* file_1, const char* file_2); |
(...skipping 11 matching lines...) Expand all Loading... |
155 | 157 |
156 // FileHandle is an OS specific class which stores data about the file. | 158 // FileHandle is an OS specific class which stores data about the file. |
157 FileHandle* handle_; // OS specific handle for the file. | 159 FileHandle* handle_; // OS specific handle for the file. |
158 | 160 |
159 static NativeService file_service_; | 161 static NativeService file_service_; |
160 | 162 |
161 DISALLOW_COPY_AND_ASSIGN(File); | 163 DISALLOW_COPY_AND_ASSIGN(File); |
162 }; | 164 }; |
163 | 165 |
164 #endif // BIN_FILE_H_ | 166 #endif // BIN_FILE_H_ |
OLD | NEW |