| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 kSocket = 3, | 60 kSocket = 3, |
| 61 kOther = 4 | 61 kOther = 4 |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 enum FileRequest { | 64 enum FileRequest { |
| 65 kExistsRequest = 0, | 65 kExistsRequest = 0, |
| 66 kCreateRequest = 1, | 66 kCreateRequest = 1, |
| 67 kDeleteRequest = 2, | 67 kDeleteRequest = 2, |
| 68 kOpenRequest = 3, | 68 kOpenRequest = 3, |
| 69 kFullPathRequest = 4, | 69 kFullPathRequest = 4, |
| 70 kDirectoryRequest = 5, | 70 kCloseRequest = 5, |
| 71 kCloseRequest = 6, | 71 kPositionRequest = 6, |
| 72 kPositionRequest = 7, | 72 kSetPositionRequest = 7, |
| 73 kSetPositionRequest = 8, | 73 kTruncateRequest = 8, |
| 74 kTruncateRequest = 9, | 74 kLengthRequest = 9, |
| 75 kLengthRequest = 10, | 75 kLengthFromPathRequest = 10, |
| 76 kLengthFromPathRequest = 11, | 76 kLastModifiedRequest = 11, |
| 77 kLastModifiedRequest = 12, | 77 kFlushRequest = 12, |
| 78 kFlushRequest = 13, | 78 kReadByteRequest = 13, |
| 79 kReadByteRequest = 14, | 79 kWriteByteRequest = 14, |
| 80 kWriteByteRequest = 15, | 80 kReadRequest = 15, |
| 81 kReadRequest = 16, | 81 kReadIntoRequest = 16, |
| 82 kReadIntoRequest = 17, | 82 kWriteFromRequest = 17, |
| 83 kWriteFromRequest = 18, | 83 kCreateLinkRequest = 18, |
| 84 kCreateLinkRequest = 19, | 84 kDeleteLinkRequest = 19, |
| 85 kDeleteLinkRequest = 20, | 85 kLinkTargetRequest = 20, |
| 86 kLinkTargetRequest = 21, | 86 kTypeRequest = 21, |
| 87 kTypeRequest = 22, | 87 kIdenticalRequest = 22, |
| 88 kIdenticalRequest = 23, | 88 kStatRequest = 23 |
| 89 kStatRequest = 24 | |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 enum FileStat { | 91 enum FileStat { |
| 93 // These match the constants in FileStat in file_system_entity.dart. | 92 // These match the constants in FileStat in file_system_entity.dart. |
| 94 kType = 0, | 93 kType = 0, |
| 95 kCreatedTime = 1, | 94 kCreatedTime = 1, |
| 96 kModifiedTime = 2, | 95 kModifiedTime = 2, |
| 97 kAccessedTime = 3, | 96 kAccessedTime = 3, |
| 98 kMode = 4, | 97 kMode = 4, |
| 99 kSize = 5, | 98 kSize = 5, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 static bool Create(const char* path); | 151 static bool Create(const char* path); |
| 153 static bool CreateLink(const char* path, const char* target); | 152 static bool CreateLink(const char* path, const char* target); |
| 154 static bool Delete(const char* path); | 153 static bool Delete(const char* path); |
| 155 static bool DeleteLink(const char* path); | 154 static bool DeleteLink(const char* path); |
| 156 static off_t LengthFromPath(const char* path); | 155 static off_t LengthFromPath(const char* path); |
| 157 static void Stat(const char* path, int64_t* data); | 156 static void Stat(const char* path, int64_t* data); |
| 158 static time_t LastModified(const char* path); | 157 static time_t LastModified(const char* path); |
| 159 static char* LinkTarget(const char* pathname); | 158 static char* LinkTarget(const char* pathname); |
| 160 static bool IsAbsolutePath(const char* path); | 159 static bool IsAbsolutePath(const char* path); |
| 161 static char* GetCanonicalPath(const char* path); | 160 static char* GetCanonicalPath(const char* path); |
| 162 static char* GetContainingDirectory(char* path); | |
| 163 static const char* PathSeparator(); | 161 static const char* PathSeparator(); |
| 164 static const char* StringEscapedPathSeparator(); | 162 static const char* StringEscapedPathSeparator(); |
| 165 static Type GetType(const char* path, bool follow_links); | 163 static Type GetType(const char* path, bool follow_links); |
| 166 static Identical AreIdentical(const char* file_1, const char* file_2); | 164 static Identical AreIdentical(const char* file_1, const char* file_2); |
| 167 static StdioHandleType GetStdioHandleType(int fd); | 165 static StdioHandleType GetStdioHandleType(int fd); |
| 168 | 166 |
| 169 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); | 167 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); |
| 170 | 168 |
| 171 static Dart_Port GetServicePort(); | 169 static Dart_Port GetServicePort(); |
| 172 | 170 |
| 173 private: | 171 private: |
| 174 explicit File(FileHandle* handle) : handle_(handle) { } | 172 explicit File(FileHandle* handle) : handle_(handle) { } |
| 175 void Close(); | 173 void Close(); |
| 176 | 174 |
| 177 static const int kClosedFd = -1; | 175 static const int kClosedFd = -1; |
| 178 | 176 |
| 179 // FileHandle is an OS specific class which stores data about the file. | 177 // FileHandle is an OS specific class which stores data about the file. |
| 180 FileHandle* handle_; // OS specific handle for the file. | 178 FileHandle* handle_; // OS specific handle for the file. |
| 181 | 179 |
| 182 static NativeService file_service_; | 180 static NativeService file_service_; |
| 183 | 181 |
| 184 DISALLOW_COPY_AND_ASSIGN(File); | 182 DISALLOW_COPY_AND_ASSIGN(File); |
| 185 }; | 183 }; |
| 186 | 184 |
| 187 } // namespace bin | 185 } // namespace bin |
| 188 } // namespace dart | 186 } // namespace dart |
| 189 | 187 |
| 190 #endif // BIN_FILE_H_ | 188 #endif // BIN_FILE_H_ |
| OLD | NEW |