OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // or to false in case the file was just opened. |error_code| can be NULL. | 90 // or to false in case the file was just opened. |error_code| can be NULL. |
91 PlatformFile CreatePlatformFile(const FilePath& name, | 91 PlatformFile CreatePlatformFile(const FilePath& name, |
92 int flags, | 92 int flags, |
93 bool* created, | 93 bool* created, |
94 PlatformFileError* error_code); | 94 PlatformFileError* error_code); |
95 // Deprecated. | 95 // Deprecated. |
96 PlatformFile CreatePlatformFile(const std::wstring& name, | 96 PlatformFile CreatePlatformFile(const std::wstring& name, |
97 int flags, | 97 int flags, |
98 bool* created); | 98 bool* created); |
99 | 99 |
100 // Closes a file handle | 100 // Closes a file handle. Returns |true| on success and |false| otherwise. |
101 bool ClosePlatformFile(PlatformFile file); | 101 bool ClosePlatformFile(PlatformFile file); |
102 | 102 |
103 // Reads the given number of bytes (or until EOF is reached) starting with the | 103 // Reads the given number of bytes (or until EOF is reached) starting with the |
104 // given offset. Returns the number of bytes read, or -1 on error. | 104 // given offset. Returns the number of bytes read, or -1 on error. |
105 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size); | 105 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size); |
106 | 106 |
107 // Writes the given buffer into the file at the given offset, overwritting any | 107 // Writes the given buffer into the file at the given offset, overwritting any |
108 // data that was previously there. Returns the number of bytes written, or -1 | 108 // data that was previously there. Returns the number of bytes written, or -1 |
109 // on error. | 109 // on error. |
110 int WritePlatformFile(PlatformFile file, int64 offset, | 110 int WritePlatformFile(PlatformFile file, int64 offset, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return temp; | 159 return temp; |
160 } | 160 } |
161 | 161 |
162 private: | 162 private: |
163 PlatformFile* value_; | 163 PlatformFile* value_; |
164 }; | 164 }; |
165 | 165 |
166 } // namespace base | 166 } // namespace base |
167 | 167 |
168 #endif // BASE_PLATFORM_FILE_H_ | 168 #endif // BASE_PLATFORM_FILE_H_ |
OLD | NEW |