Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: runtime/bin/file.h

Issue 12314153: dart:io | Rename File.name to File.path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove stray line break. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 kCreateRequest = 1, 49 kCreateRequest = 1,
50 kDeleteRequest = 2, 50 kDeleteRequest = 2,
51 kOpenRequest = 3, 51 kOpenRequest = 3,
52 kFullPathRequest = 4, 52 kFullPathRequest = 4,
53 kDirectoryRequest = 5, 53 kDirectoryRequest = 5,
54 kCloseRequest = 6, 54 kCloseRequest = 6,
55 kPositionRequest = 7, 55 kPositionRequest = 7,
56 kSetPositionRequest = 8, 56 kSetPositionRequest = 8,
57 kTruncateRequest = 9, 57 kTruncateRequest = 9,
58 kLengthRequest = 10, 58 kLengthRequest = 10,
59 kLengthFromNameRequest = 11, 59 kLengthFromPathRequest = 11,
60 kLastModifiedRequest = 12, 60 kLastModifiedRequest = 12,
61 kFlushRequest = 13, 61 kFlushRequest = 13,
62 kReadByteRequest = 14, 62 kReadByteRequest = 14,
63 kWriteByteRequest = 15, 63 kWriteByteRequest = 15,
64 kReadRequest = 16, 64 kReadRequest = 16,
65 kReadListRequest = 17, 65 kReadListRequest = 17,
66 kWriteListRequest = 18 66 kWriteListRequest = 18
67 }; 67 };
68 68
69 ~File(); 69 ~File();
(...skipping 26 matching lines...) Expand all
96 96
97 // Truncate (or extend) the file to the given length in bytes. 97 // Truncate (or extend) the file to the given length in bytes.
98 bool Truncate(int64_t length); 98 bool Truncate(int64_t length);
99 99
100 // Flush contents of file. 100 // Flush contents of file.
101 bool Flush(); 101 bool Flush();
102 102
103 // Returns whether the file has been closed. 103 // Returns whether the file has been closed.
104 bool IsClosed(); 104 bool IsClosed();
105 105
106 // Open the file with the given name. The file is always opened for 106 // Open the file with the given path. The file is always opened for
107 // reading. If mode contains kWrite the file is opened for both 107 // reading. If mode contains kWrite the file is opened for both
108 // reading and writing. If mode contains kWrite and the file does 108 // reading and writing. If mode contains kWrite and the file does
109 // not exist the file is created. The file is truncated to length 0 if 109 // not exist the file is created. The file is truncated to length 0 if
110 // mode contains kTruncate. 110 // mode contains kTruncate.
111 static File* Open(const char* name, FileOpenMode mode); 111 static File* Open(const char* path, FileOpenMode mode);
112 112
113 // Create a file object for the specified stdio file descriptor 113 // Create a file object for the specified stdio file descriptor
114 // (stdin, stout or stderr). 114 // (stdin, stout or stderr).
115 static File* OpenStdio(int fd); 115 static File* OpenStdio(int fd);
116 116
117 static bool Exists(const char* name); 117 static bool Exists(const char* path);
118 static bool Create(const char* name); 118 static bool Create(const char* path);
119 static bool Delete(const char* name); 119 static bool Delete(const char* path);
120 static off_t LengthFromName(const char* name); 120 static off_t LengthFromPath(const char* path);
121 static time_t LastModified(const char* name); 121 static time_t LastModified(const char* path);
122 static bool IsAbsolutePath(const char* pathname); 122 static bool IsAbsolutePath(const char* path);
123 static char* GetCanonicalPath(const char* name); 123 static char* GetCanonicalPath(const char* path);
124 static char* GetContainingDirectory(char* name); 124 static char* GetContainingDirectory(char* path);
125 static const char* PathSeparator(); 125 static const char* PathSeparator();
126 static const char* StringEscapedPathSeparator(); 126 static const char* StringEscapedPathSeparator();
127 static StdioHandleType GetStdioHandleType(int fd); 127 static StdioHandleType GetStdioHandleType(int fd);
128 128
129 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); 129 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode);
130 130
131 static Dart_Port GetServicePort(); 131 static Dart_Port GetServicePort();
132 132
133 private: 133 private:
134 explicit File(FileHandle* handle) : handle_(handle) { } 134 explicit File(FileHandle* handle) : handle_(handle) { }
135 void Close(); 135 void Close();
136 136
137 static const int kClosedFd = -1; 137 static const int kClosedFd = -1;
138 138
139 // FileHandle is an OS specific class which stores data about the file. 139 // FileHandle is an OS specific class which stores data about the file.
140 FileHandle* handle_; // OS specific handle for the file. 140 FileHandle* handle_; // OS specific handle for the file.
141 141
142 static NativeService file_service_; 142 static NativeService file_service_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(File); 144 DISALLOW_COPY_AND_ASSIGN(File);
145 }; 145 };
146 146
147 #endif // BIN_FILE_H_ 147 #endif // BIN_FILE_H_
OLDNEW
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/file.cc » ('j') | runtime/bin/file_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698