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 "build/build_config.h" | 9 #include "build/build_config.h" |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 19 matching lines...) Expand all Loading... | |
30 PLATFORM_FILE_CREATE = 2, | 30 PLATFORM_FILE_CREATE = 2, |
31 PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file. | 31 PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file. |
32 PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. | 32 PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. |
33 PLATFORM_FILE_READ = 16, | 33 PLATFORM_FILE_READ = 16, |
34 PLATFORM_FILE_WRITE = 32, | 34 PLATFORM_FILE_WRITE = 32, |
35 PLATFORM_FILE_EXCLUSIVE_READ = 64, // EXCLUSIVE is opposite of Windows SHARE | 35 PLATFORM_FILE_EXCLUSIVE_READ = 64, // EXCLUSIVE is opposite of Windows SHARE |
36 PLATFORM_FILE_EXCLUSIVE_WRITE = 128, | 36 PLATFORM_FILE_EXCLUSIVE_WRITE = 128, |
37 PLATFORM_FILE_ASYNC = 256, | 37 PLATFORM_FILE_ASYNC = 256, |
38 PLATFORM_FILE_TEMPORARY = 512, // Used on Windows only | 38 PLATFORM_FILE_TEMPORARY = 512, // Used on Windows only |
39 PLATFORM_FILE_HIDDEN = 1024, // Used on Windows only | 39 PLATFORM_FILE_HIDDEN = 1024, // Used on Windows only |
40 PLATFORM_FILE_DELETE_ON_CLOSE = 2048 | 40 PLATFORM_FILE_DELETE_ON_CLOSE = 2048, |
41 PLATFORM_FILE_TRUNCATE = 4096 // Used on Windows only | |
darin (slow to review)
2010/08/24 17:43:14
don't we need to support truncation on other platf
dumi
2010/08/24 19:14:57
this belongs to a different CL. removed.
| |
42 }; | |
43 | |
44 // TODO(dumi): add more specific error codes for CreatePlatformFile(). | |
45 // TODO(dumi): add more error codes as we add new methods to FileUtilProxy. | |
46 enum PlatformFileErrors { | |
47 PLATFORM_FILE_OK = 0, | |
48 PLATFORM_FILE_ERROR = -1 | |
41 }; | 49 }; |
42 | 50 |
43 // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and | 51 // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and |
44 // |created| is provided, |created| will be set to true if the file was created | 52 // |created| is provided, |created| will be set to true if the file was created |
45 // or to false in case the file was just opened. | 53 // or to false in case the file was just opened. |
46 PlatformFile CreatePlatformFile(const FilePath& name, | 54 PlatformFile CreatePlatformFile(const FilePath& name, |
47 int flags, | 55 int flags, |
48 bool* created); | 56 bool* created); |
49 // Deprecated. | 57 // Deprecated. |
50 PlatformFile CreatePlatformFile(const std::wstring& name, | 58 PlatformFile CreatePlatformFile(const std::wstring& name, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 return temp; | 96 return temp; |
89 } | 97 } |
90 | 98 |
91 private: | 99 private: |
92 PlatformFile* value_; | 100 PlatformFile* value_; |
93 }; | 101 }; |
94 | 102 |
95 } // namespace base | 103 } // namespace base |
96 | 104 |
97 #endif // BASE_PLATFORM_FILE_H_ | 105 #endif // BASE_PLATFORM_FILE_H_ |
OLD | NEW |