]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | // boost/system/windows_error.hpp ------------------------------------------// |
2 | ||
3 | // Copyright Beman Dawes 2007 | |
4 | ||
5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | // See library home page at http://www.boost.org/libs/system | |
9 | ||
10 | #ifndef BOOST_SYSTEM_WINDOWS_ERROR_HPP | |
11 | #define BOOST_SYSTEM_WINDOWS_ERROR_HPP | |
12 | ||
13 | // This header is effectively empty for compiles on operating systems where | |
14 | // it is not applicable. | |
15 | ||
16 | #include <boost/system/config.hpp> | |
17 | ||
18 | #ifdef BOOST_WINDOWS_API | |
19 | ||
20 | #include <boost/system/error_code.hpp> | |
b32b8144 FG |
21 | #include <boost/winapi/error_codes.hpp> |
22 | ||
23 | namespace boost | |
24 | { | |
25 | namespace system | |
26 | { | |
27 | ||
28 | // Microsoft Windows ---------------------------------------------------// | |
29 | ||
30 | // To construct an error_code after a API error: | |
31 | // | |
32 | // error_code( ::GetLastError(), system_category() ) | |
33 | ||
34 | namespace windows_error | |
35 | { | |
36 | enum windows_error_code | |
37 | { | |
38 | success = 0, | |
39 | // These names and values are based on Windows winerror.h | |
40 | invalid_function = boost::winapi::ERROR_INVALID_FUNCTION_, | |
41 | file_not_found = boost::winapi::ERROR_FILE_NOT_FOUND_, | |
42 | path_not_found = boost::winapi::ERROR_PATH_NOT_FOUND_, | |
43 | too_many_open_files = boost::winapi::ERROR_TOO_MANY_OPEN_FILES_, | |
44 | access_denied = boost::winapi::ERROR_ACCESS_DENIED_, | |
45 | invalid_handle = boost::winapi::ERROR_INVALID_HANDLE_, | |
46 | arena_trashed = boost::winapi::ERROR_ARENA_TRASHED_, | |
47 | not_enough_memory = boost::winapi::ERROR_NOT_ENOUGH_MEMORY_, | |
48 | invalid_block = boost::winapi::ERROR_INVALID_BLOCK_, | |
49 | bad_environment = boost::winapi::ERROR_BAD_ENVIRONMENT_, | |
50 | bad_format = boost::winapi::ERROR_BAD_FORMAT_, | |
51 | invalid_access = boost::winapi::ERROR_INVALID_ACCESS_, | |
52 | outofmemory = boost::winapi::ERROR_OUTOFMEMORY_, | |
53 | invalid_drive = boost::winapi::ERROR_INVALID_DRIVE_, | |
54 | current_directory = boost::winapi::ERROR_CURRENT_DIRECTORY_, | |
55 | not_same_device = boost::winapi::ERROR_NOT_SAME_DEVICE_, | |
56 | no_more_files = boost::winapi::ERROR_NO_MORE_FILES_, | |
57 | write_protect = boost::winapi::ERROR_WRITE_PROTECT_, | |
58 | bad_unit = boost::winapi::ERROR_BAD_UNIT_, | |
59 | not_ready = boost::winapi::ERROR_NOT_READY_, | |
60 | bad_command = boost::winapi::ERROR_BAD_COMMAND_, | |
61 | crc = boost::winapi::ERROR_CRC_, | |
62 | bad_length = boost::winapi::ERROR_BAD_LENGTH_, | |
63 | seek = boost::winapi::ERROR_SEEK_, | |
64 | not_dos_disk = boost::winapi::ERROR_NOT_DOS_DISK_, | |
65 | sector_not_found = boost::winapi::ERROR_SECTOR_NOT_FOUND_, | |
66 | out_of_paper = boost::winapi::ERROR_OUT_OF_PAPER_, | |
67 | write_fault = boost::winapi::ERROR_WRITE_FAULT_, | |
68 | read_fault = boost::winapi::ERROR_READ_FAULT_, | |
69 | gen_failure = boost::winapi::ERROR_GEN_FAILURE_, | |
70 | sharing_violation = boost::winapi::ERROR_SHARING_VIOLATION_, | |
71 | lock_violation = boost::winapi::ERROR_LOCK_VIOLATION_, | |
72 | wrong_disk = boost::winapi::ERROR_WRONG_DISK_, | |
73 | sharing_buffer_exceeded = boost::winapi::ERROR_SHARING_BUFFER_EXCEEDED_, | |
74 | handle_eof = boost::winapi::ERROR_HANDLE_EOF_, | |
1e59de90 TL |
75 | handle_disk_full = boost::winapi::ERROR_HANDLE_DISK_FULL_, |
76 | not_supported = boost::winapi::ERROR_NOT_SUPPORTED_, | |
b32b8144 FG |
77 | rem_not_list = boost::winapi::ERROR_REM_NOT_LIST_, |
78 | dup_name = boost::winapi::ERROR_DUP_NAME_, | |
79 | bad_net_path = boost::winapi::ERROR_BAD_NETPATH_, | |
80 | network_busy = boost::winapi::ERROR_NETWORK_BUSY_, | |
81 | // ... | |
82 | file_exists = boost::winapi::ERROR_FILE_EXISTS_, | |
83 | cannot_make = boost::winapi::ERROR_CANNOT_MAKE_, | |
84 | // ... | |
85 | broken_pipe = boost::winapi::ERROR_BROKEN_PIPE_, | |
86 | open_failed = boost::winapi::ERROR_OPEN_FAILED_, | |
87 | buffer_overflow = boost::winapi::ERROR_BUFFER_OVERFLOW_, | |
1e59de90 | 88 | disk_full = boost::winapi::ERROR_DISK_FULL_, |
b32b8144 FG |
89 | // ... |
90 | lock_failed = boost::winapi::ERROR_LOCK_FAILED_, | |
91 | busy = boost::winapi::ERROR_BUSY_, | |
92 | cancel_violation = boost::winapi::ERROR_CANCEL_VIOLATION_, | |
93 | already_exists = boost::winapi::ERROR_ALREADY_EXISTS_ | |
94 | // ... | |
95 | ||
96 | // TODO: add more Windows errors | |
97 | }; | |
98 | ||
99 | } // namespace windows | |
100 | ||
101 | # ifdef BOOST_SYSTEM_ENABLE_DEPRECATED | |
102 | namespace windows = windows_error; | |
103 | # endif | |
104 | ||
105 | template<> struct is_error_code_enum<windows_error::windows_error_code> | |
106 | { static const bool value = true; }; | |
107 | ||
108 | namespace windows_error | |
109 | { | |
110 | inline error_code make_error_code( windows_error_code e ) | |
111 | { return error_code( e, system_category() ); } | |
112 | } | |
113 | ||
114 | } // namespace system | |
115 | } // namespace boost | |
116 | ||
117 | #endif // BOOST_WINDOWS_API | |
118 | ||
119 | #endif // BOOST_SYSTEM_WINDOWS_ERROR_HPP |