Chris@16
|
1 // boost/system/windows_error.hpp ------------------------------------------//
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright Beman Dawes 2007
|
Chris@16
|
4
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7
|
Chris@16
|
8 // See library home page at http://www.boost.org/libs/system
|
Chris@16
|
9
|
Chris@16
|
10 #ifndef BOOST_WINDOWS_ERROR_HPP
|
Chris@16
|
11 #define BOOST_WINDOWS_ERROR_HPP
|
Chris@16
|
12
|
Chris@16
|
13 // This header is effectively empty for compiles on operating systems where
|
Chris@16
|
14 // it is not applicable.
|
Chris@16
|
15
|
Chris@16
|
16 #include <boost/system/config.hpp>
|
Chris@16
|
17
|
Chris@16
|
18 #ifdef BOOST_WINDOWS_API
|
Chris@16
|
19
|
Chris@16
|
20 #include <boost/system/error_code.hpp>
|
Chris@16
|
21 #include <winerror.h>
|
Chris@16
|
22
|
Chris@16
|
23 namespace boost
|
Chris@16
|
24 {
|
Chris@16
|
25 namespace system
|
Chris@16
|
26 {
|
Chris@16
|
27
|
Chris@16
|
28 // Microsoft Windows ---------------------------------------------------//
|
Chris@16
|
29
|
Chris@16
|
30 // To construct an error_code after a API error:
|
Chris@16
|
31 //
|
Chris@16
|
32 // error_code( ::GetLastError(), system_category() )
|
Chris@16
|
33
|
Chris@16
|
34 namespace windows_error
|
Chris@16
|
35 {
|
Chris@16
|
36 enum windows_error_code
|
Chris@16
|
37 {
|
Chris@16
|
38 success = 0,
|
Chris@16
|
39 // These names and values are based on Windows winerror.h
|
Chris@16
|
40 invalid_function = ERROR_INVALID_FUNCTION,
|
Chris@16
|
41 file_not_found = ERROR_FILE_NOT_FOUND,
|
Chris@16
|
42 path_not_found = ERROR_PATH_NOT_FOUND,
|
Chris@16
|
43 too_many_open_files = ERROR_TOO_MANY_OPEN_FILES,
|
Chris@16
|
44 access_denied = ERROR_ACCESS_DENIED,
|
Chris@16
|
45 invalid_handle = ERROR_INVALID_HANDLE,
|
Chris@16
|
46 arena_trashed = ERROR_ARENA_TRASHED,
|
Chris@16
|
47 not_enough_memory = ERROR_NOT_ENOUGH_MEMORY,
|
Chris@16
|
48 invalid_block = ERROR_INVALID_BLOCK,
|
Chris@16
|
49 bad_environment = ERROR_BAD_ENVIRONMENT,
|
Chris@16
|
50 bad_format = ERROR_BAD_FORMAT,
|
Chris@16
|
51 invalid_access = ERROR_INVALID_ACCESS,
|
Chris@16
|
52 outofmemory = ERROR_OUTOFMEMORY,
|
Chris@16
|
53 invalid_drive = ERROR_INVALID_DRIVE,
|
Chris@16
|
54 current_directory = ERROR_CURRENT_DIRECTORY,
|
Chris@16
|
55 not_same_device = ERROR_NOT_SAME_DEVICE,
|
Chris@16
|
56 no_more_files = ERROR_NO_MORE_FILES,
|
Chris@16
|
57 write_protect = ERROR_WRITE_PROTECT,
|
Chris@16
|
58 bad_unit = ERROR_BAD_UNIT,
|
Chris@16
|
59 not_ready = ERROR_NOT_READY,
|
Chris@16
|
60 bad_command = ERROR_BAD_COMMAND,
|
Chris@16
|
61 crc = ERROR_CRC,
|
Chris@16
|
62 bad_length = ERROR_BAD_LENGTH,
|
Chris@16
|
63 seek = ERROR_SEEK,
|
Chris@16
|
64 not_dos_disk = ERROR_NOT_DOS_DISK,
|
Chris@16
|
65 sector_not_found = ERROR_SECTOR_NOT_FOUND,
|
Chris@16
|
66 out_of_paper = ERROR_OUT_OF_PAPER,
|
Chris@16
|
67 write_fault = ERROR_WRITE_FAULT,
|
Chris@16
|
68 read_fault = ERROR_READ_FAULT,
|
Chris@16
|
69 gen_failure = ERROR_GEN_FAILURE,
|
Chris@16
|
70 sharing_violation = ERROR_SHARING_VIOLATION,
|
Chris@16
|
71 lock_violation = ERROR_LOCK_VIOLATION,
|
Chris@16
|
72 wrong_disk = ERROR_WRONG_DISK,
|
Chris@16
|
73 sharing_buffer_exceeded = ERROR_SHARING_BUFFER_EXCEEDED,
|
Chris@16
|
74 handle_eof = ERROR_HANDLE_EOF,
|
Chris@16
|
75 handle_disk_full= ERROR_HANDLE_DISK_FULL,
|
Chris@16
|
76 rem_not_list = ERROR_REM_NOT_LIST,
|
Chris@16
|
77 dup_name = ERROR_DUP_NAME,
|
Chris@16
|
78 bad_net_path = ERROR_BAD_NETPATH,
|
Chris@16
|
79 network_busy = ERROR_NETWORK_BUSY,
|
Chris@16
|
80 // ...
|
Chris@16
|
81 file_exists = ERROR_FILE_EXISTS,
|
Chris@16
|
82 cannot_make = ERROR_CANNOT_MAKE,
|
Chris@16
|
83 // ...
|
Chris@16
|
84 broken_pipe = ERROR_BROKEN_PIPE,
|
Chris@16
|
85 open_failed = ERROR_OPEN_FAILED,
|
Chris@16
|
86 buffer_overflow = ERROR_BUFFER_OVERFLOW,
|
Chris@16
|
87 disk_full= ERROR_DISK_FULL,
|
Chris@16
|
88 // ...
|
Chris@16
|
89 lock_failed = ERROR_LOCK_FAILED,
|
Chris@16
|
90 busy = ERROR_BUSY,
|
Chris@16
|
91 cancel_violation = ERROR_CANCEL_VIOLATION,
|
Chris@16
|
92 already_exists = ERROR_ALREADY_EXISTS
|
Chris@16
|
93 // ...
|
Chris@16
|
94
|
Chris@16
|
95 // TODO: add more Windows errors
|
Chris@16
|
96 };
|
Chris@16
|
97
|
Chris@16
|
98 } // namespace windows
|
Chris@16
|
99
|
Chris@16
|
100 # ifndef BOOST_SYSTEM_NO_DEPRECATED
|
Chris@16
|
101 namespace windows = windows_error;
|
Chris@16
|
102 # endif
|
Chris@16
|
103
|
Chris@16
|
104 template<> struct is_error_code_enum<windows_error::windows_error_code>
|
Chris@16
|
105 { static const bool value = true; };
|
Chris@16
|
106
|
Chris@16
|
107 namespace windows_error
|
Chris@16
|
108 {
|
Chris@16
|
109 inline error_code make_error_code( windows_error_code e )
|
Chris@16
|
110 { return error_code( e, system_category() ); }
|
Chris@16
|
111 }
|
Chris@16
|
112
|
Chris@16
|
113 } // namespace system
|
Chris@16
|
114 } // namespace boost
|
Chris@16
|
115
|
Chris@16
|
116 #endif // BOOST_WINDOWS_API
|
Chris@16
|
117
|
Chris@16
|
118 #endif // BOOST_WINDOWS_ERROR_HPP
|