is_generic_value.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef BOOST_SYSTEM_DETAIL_IS_GENERIC_VALUE_HPP_INCLUDED
  2. #define BOOST_SYSTEM_DETAIL_IS_GENERIC_VALUE_HPP_INCLUDED
  3. // Copyright 2018 Peter Dimov
  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. #include <boost/system/detail/errc.hpp>
  10. namespace boost
  11. {
  12. namespace system
  13. {
  14. namespace detail
  15. {
  16. inline bool is_generic_value( int ev ) BOOST_NOEXCEPT
  17. {
  18. using namespace errc;
  19. static int const gen[] =
  20. {
  21. success,
  22. address_family_not_supported,
  23. address_in_use,
  24. address_not_available,
  25. already_connected,
  26. argument_list_too_long,
  27. argument_out_of_domain,
  28. bad_address,
  29. bad_file_descriptor,
  30. bad_message,
  31. broken_pipe,
  32. connection_aborted,
  33. connection_already_in_progress,
  34. connection_refused,
  35. connection_reset,
  36. cross_device_link,
  37. destination_address_required,
  38. device_or_resource_busy,
  39. directory_not_empty,
  40. executable_format_error,
  41. file_exists,
  42. file_too_large,
  43. filename_too_long,
  44. function_not_supported,
  45. host_unreachable,
  46. identifier_removed,
  47. illegal_byte_sequence,
  48. inappropriate_io_control_operation,
  49. interrupted,
  50. invalid_argument,
  51. invalid_seek,
  52. io_error,
  53. is_a_directory,
  54. message_size,
  55. network_down,
  56. network_reset,
  57. network_unreachable,
  58. no_buffer_space,
  59. no_child_process,
  60. no_link,
  61. no_lock_available,
  62. no_message_available,
  63. no_message,
  64. no_protocol_option,
  65. no_space_on_device,
  66. no_stream_resources,
  67. no_such_device_or_address,
  68. no_such_device,
  69. no_such_file_or_directory,
  70. no_such_process,
  71. not_a_directory,
  72. not_a_socket,
  73. not_a_stream,
  74. not_connected,
  75. not_enough_memory,
  76. not_supported,
  77. operation_canceled,
  78. operation_in_progress,
  79. operation_not_permitted,
  80. operation_not_supported,
  81. operation_would_block,
  82. owner_dead,
  83. permission_denied,
  84. protocol_error,
  85. protocol_not_supported,
  86. read_only_file_system,
  87. resource_deadlock_would_occur,
  88. resource_unavailable_try_again,
  89. result_out_of_range,
  90. state_not_recoverable,
  91. stream_timeout,
  92. text_file_busy,
  93. timed_out,
  94. too_many_files_open_in_system,
  95. too_many_files_open,
  96. too_many_links,
  97. too_many_symbolic_link_levels,
  98. value_too_large,
  99. wrong_protocol_type
  100. };
  101. int const n = sizeof( gen ) / sizeof( gen[0] );
  102. for( int i = 0; i < n; ++i )
  103. {
  104. if( ev == gen[ i ] ) return true;
  105. }
  106. return false;
  107. }
  108. } // namespace detail
  109. } // namespace system
  110. } // namespace boost
  111. #endif // #ifndef BOOST_SYSTEM_DETAIL_IS_GENERIC_VALUE_HPP_INCLUDED