OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_DISK_CACHE_OS_FILE_H_ | |
6 #define NET_DISK_CACHE_OS_FILE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "build/build_config.h" | |
11 | |
12 namespace disk_cache { | |
13 | |
14 #if defined(OS_WIN) | |
15 #include <windows.h> | |
16 typedef HANDLE OSFile; | |
17 #elif defined(OS_POSIX) | |
18 typedef int OSFile; | |
19 const OSFile INVALID_HANDLE_VALUE = -1; | |
20 #endif | |
21 | |
22 enum OSFileFlags { | |
23 OS_FILE_OPEN = 1, | |
24 OS_FILE_CREATE = 2, | |
25 OS_FILE_OPEN_ALWAYS = 4, // May create a new file. | |
26 OS_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. | |
27 OS_FILE_READ = 16, | |
28 OS_FILE_WRITE = 32, | |
29 OS_FILE_SHARE_READ = 64, | |
30 OS_FILE_SHARE_WRITE = 128 | |
31 }; | |
32 | |
33 // Creates or open the given file. If OS_FILE_OPEN_ALWAYS is used, and |created| | |
34 // is provided, |created| will be set to true if the file was created or to | |
35 // false in case the file was just opened. | |
36 OSFile CreateOSFile(const std::wstring& name, int flags, bool* created); | |
37 | |
38 } // namespace disk_cache | |
39 | |
40 #endif // NET_DISK_CACHE_OS_FILE_H_ | |
OLD | NEW |