OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_PLATFORM_FILE_H_ | 5 #ifndef BASE_PLATFORM_FILE_H_ |
6 #define BASE_PLATFORM_FILE_H_ | 6 #define BASE_PLATFORM_FILE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 base::Time creation_time; | 93 base::Time creation_time; |
94 }; | 94 }; |
95 | 95 |
96 // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and | 96 // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and |
97 // |created| is provided, |created| will be set to true if the file was created | 97 // |created| is provided, |created| will be set to true if the file was created |
98 // or to false in case the file was just opened. |error_code| can be NULL. | 98 // or to false in case the file was just opened. |error_code| can be NULL. |
99 PlatformFile CreatePlatformFile(const FilePath& name, | 99 PlatformFile CreatePlatformFile(const FilePath& name, |
100 int flags, | 100 int flags, |
101 bool* created, | 101 bool* created, |
102 PlatformFileError* error_code); | 102 PlatformFileError* error_code); |
103 // Deprecated. | |
104 PlatformFile CreatePlatformFile(const std::wstring& name, | |
105 int flags, | |
106 bool* created); | |
107 | 103 |
108 // Closes a file handle. Returns |true| on success and |false| otherwise. | 104 // Closes a file handle. Returns |true| on success and |false| otherwise. |
109 bool ClosePlatformFile(PlatformFile file); | 105 bool ClosePlatformFile(PlatformFile file); |
110 | 106 |
111 // Reads the given number of bytes (or until EOF is reached) starting with the | 107 // Reads the given number of bytes (or until EOF is reached) starting with the |
112 // given offset. Returns the number of bytes read, or -1 on error. | 108 // given offset. Returns the number of bytes read, or -1 on error. |
113 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size); | 109 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size); |
114 | 110 |
115 // Writes the given buffer into the file at the given offset, overwritting any | 111 // Writes the given buffer into the file at the given offset, overwritting any |
116 // data that was previously there. Returns the number of bytes written, or -1 | 112 // data that was previously there. Returns the number of bytes written, or -1 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return temp; | 163 return temp; |
168 } | 164 } |
169 | 165 |
170 private: | 166 private: |
171 PlatformFile* value_; | 167 PlatformFile* value_; |
172 }; | 168 }; |
173 | 169 |
174 } // namespace base | 170 } // namespace base |
175 | 171 |
176 #endif // BASE_PLATFORM_FILE_H_ | 172 #endif // BASE_PLATFORM_FILE_H_ |
OLD | NEW |