WPILibC++
2025.2.1
Loading...
Searching...
No Matches
Errc.h
Go to the documentation of this file.
1
//===- llvm/Support/Errc.h - Defines the wpi::errc enum --------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// While std::error_code works OK on all platforms we use, there are some
10
// some problems with std::errc that can be avoided by using our own
11
// enumeration:
12
//
13
// * std::errc is a namespace in some implementations. That means that ADL
14
// doesn't work and it is sometimes necessary to write std::make_error_code
15
// or in templates:
16
// using std::make_error_code;
17
// make_error_code(...);
18
//
19
// with this enum it is safe to always just use make_error_code.
20
//
21
// * Some implementations define fewer names than others. This header has
22
// the intersection of all the ones we support.
23
//
24
// * std::errc is just marked with is_error_condition_enum. This means that
25
// common patterns like AnErrorCode == errc::no_such_file_or_directory take
26
// 4 virtual calls instead of two comparisons.
27
//===----------------------------------------------------------------------===//
28
29
#ifndef WPIUTIL_WPI_ERRC_H
30
#define WPIUTIL_WPI_ERRC_H
31
32
#include <system_error>
33
34
namespace
wpi
{
35
enum class
errc
{
36
argument_list_too_long
= int(std::errc::argument_list_too_long),
37
argument_out_of_domain
= int(std::errc::argument_out_of_domain),
38
bad_address
= int(std::errc::bad_address),
39
bad_file_descriptor
= int(std::errc::bad_file_descriptor),
40
broken_pipe
= int(std::errc::broken_pipe),
41
// There is no delete_pending in std::errc; this error code is negative to
42
// avoid conflicts. This error roughly corresponds with Windows'
43
// STATUS_DELETE_PENDING 0xC0000056.
44
delete_pending
= -56,
45
device_or_resource_busy
= int(std::errc::device_or_resource_busy),
46
directory_not_empty
= int(std::errc::directory_not_empty),
47
executable_format_error
= int(std::errc::executable_format_error),
48
file_exists
= int(std::errc::file_exists),
49
file_too_large
= int(std::errc::file_too_large),
50
filename_too_long
= int(std::errc::filename_too_long),
51
function_not_supported
= int(std::errc::function_not_supported),
52
illegal_byte_sequence
= int(std::errc::illegal_byte_sequence),
53
inappropriate_io_control_operation
=
54
int(std::errc::inappropriate_io_control_operation),
55
interrupted
= int(std::errc::interrupted),
56
invalid_argument
= int(std::errc::invalid_argument),
57
invalid_seek
= int(std::errc::invalid_seek),
58
io_error
= int(std::errc::io_error),
59
is_a_directory
= int(std::errc::is_a_directory),
60
no_child_process
= int(std::errc::no_child_process),
61
no_lock_available
= int(std::errc::no_lock_available),
62
no_space_on_device
= int(std::errc::no_space_on_device),
63
no_such_device_or_address
= int(std::errc::no_such_device_or_address),
64
no_such_device
= int(std::errc::no_such_device),
65
no_such_file_or_directory
= int(std::errc::no_such_file_or_directory),
66
no_such_process
= int(std::errc::no_such_process),
67
not_a_directory
= int(std::errc::not_a_directory),
68
not_enough_memory
= int(std::errc::not_enough_memory),
69
not_supported
= int(std::errc::not_supported),
70
operation_not_permitted
= int(std::errc::operation_not_permitted),
71
permission_denied
= int(std::errc::permission_denied),
72
read_only_file_system
= int(std::errc::read_only_file_system),
73
resource_deadlock_would_occur
= int(std::errc::resource_deadlock_would_occur),
74
resource_unavailable_try_again
=
75
int(std::errc::resource_unavailable_try_again),
76
result_out_of_range
= int(std::errc::result_out_of_range),
77
too_many_files_open_in_system
= int(std::errc::too_many_files_open_in_system),
78
too_many_files_open
= int(std::errc::too_many_files_open),
79
too_many_links
= int(std::errc::too_many_links)
80
};
81
82
inline
std::error_code
make_error_code
(
errc
E) {
83
return
std::error_code(
static_cast<
int
>
(E), std::generic_category());
84
}
85
}
86
87
namespace
std
{
88
template
<>
struct
is_error_code_enum<
wpi
::errc> : std::true_type {};
89
}
90
#endif
std
Implement std::hash so that hash_code can be used in STL containers.
Definition
PointerIntPair.h:280
wpi
Foonathan namespace.
Definition
ntcore_cpp.h:26
wpi::errc
errc
Definition
Errc.h:35
wpi::errc::read_only_file_system
@ read_only_file_system
wpi::errc::no_space_on_device
@ no_space_on_device
wpi::errc::argument_list_too_long
@ argument_list_too_long
wpi::errc::not_a_directory
@ not_a_directory
wpi::errc::no_such_file_or_directory
@ no_such_file_or_directory
wpi::errc::broken_pipe
@ broken_pipe
wpi::errc::too_many_files_open_in_system
@ too_many_files_open_in_system
wpi::errc::file_exists
@ file_exists
wpi::errc::inappropriate_io_control_operation
@ inappropriate_io_control_operation
wpi::errc::argument_out_of_domain
@ argument_out_of_domain
wpi::errc::executable_format_error
@ executable_format_error
wpi::errc::illegal_byte_sequence
@ illegal_byte_sequence
wpi::errc::no_lock_available
@ no_lock_available
wpi::errc::no_such_device_or_address
@ no_such_device_or_address
wpi::errc::directory_not_empty
@ directory_not_empty
wpi::errc::filename_too_long
@ filename_too_long
wpi::errc::operation_not_permitted
@ operation_not_permitted
wpi::errc::result_out_of_range
@ result_out_of_range
wpi::errc::bad_file_descriptor
@ bad_file_descriptor
wpi::errc::file_too_large
@ file_too_large
wpi::errc::function_not_supported
@ function_not_supported
wpi::errc::not_supported
@ not_supported
wpi::errc::bad_address
@ bad_address
wpi::errc::not_enough_memory
@ not_enough_memory
wpi::errc::device_or_resource_busy
@ device_or_resource_busy
wpi::errc::invalid_seek
@ invalid_seek
wpi::errc::too_many_links
@ too_many_links
wpi::errc::io_error
@ io_error
wpi::errc::no_child_process
@ no_child_process
wpi::errc::no_such_process
@ no_such_process
wpi::errc::delete_pending
@ delete_pending
wpi::errc::resource_unavailable_try_again
@ resource_unavailable_try_again
wpi::errc::invalid_argument
@ invalid_argument
wpi::errc::permission_denied
@ permission_denied
wpi::errc::too_many_files_open
@ too_many_files_open
wpi::errc::resource_deadlock_would_occur
@ resource_deadlock_would_occur
wpi::errc::is_a_directory
@ is_a_directory
wpi::errc::no_such_device
@ no_such_device
wpi::errc::interrupted
@ interrupted
wpi::make_error_code
std::error_code make_error_code(errc E)
Definition
Errc.h:82
wpi
Errc.h
Generated on Fri Jan 10 2025 07:37:21 for WPILibC++ by
1.12.0