annotate DEPENDENCIES/generic/include/boost/asio/detail/io_control.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // detail/io_control.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASIO_DETAIL_IO_CONTROL_HPP
Chris@16 12 #define BOOST_ASIO_DETAIL_IO_CONTROL_HPP
Chris@16 13
Chris@16 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 15 # pragma once
Chris@16 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 17
Chris@16 18 #include <boost/asio/detail/config.hpp>
Chris@16 19 #include <cstddef>
Chris@16 20 #include <boost/asio/detail/socket_types.hpp>
Chris@16 21
Chris@16 22 #include <boost/asio/detail/push_options.hpp>
Chris@16 23
Chris@16 24 namespace boost {
Chris@16 25 namespace asio {
Chris@16 26 namespace detail {
Chris@16 27 namespace io_control {
Chris@16 28
Chris@16 29 // IO control command for non-blocking I/O.
Chris@16 30 class non_blocking_io
Chris@16 31 {
Chris@16 32 public:
Chris@16 33 // Default constructor.
Chris@16 34 non_blocking_io()
Chris@16 35 : value_(0)
Chris@16 36 {
Chris@16 37 }
Chris@16 38
Chris@16 39 // Construct with a specific command value.
Chris@16 40 non_blocking_io(bool value)
Chris@16 41 : value_(value ? 1 : 0)
Chris@16 42 {
Chris@16 43 }
Chris@16 44
Chris@16 45 // Get the name of the IO control command.
Chris@16 46 int name() const
Chris@16 47 {
Chris@16 48 return static_cast<int>(BOOST_ASIO_OS_DEF(FIONBIO));
Chris@16 49 }
Chris@16 50
Chris@16 51 // Set the value of the I/O control command.
Chris@16 52 void set(bool value)
Chris@16 53 {
Chris@16 54 value_ = value ? 1 : 0;
Chris@16 55 }
Chris@16 56
Chris@16 57 // Get the current value of the I/O control command.
Chris@16 58 bool get() const
Chris@16 59 {
Chris@16 60 return value_ != 0;
Chris@16 61 }
Chris@16 62
Chris@16 63 // Get the address of the command data.
Chris@16 64 detail::ioctl_arg_type* data()
Chris@16 65 {
Chris@16 66 return &value_;
Chris@16 67 }
Chris@16 68
Chris@16 69 // Get the address of the command data.
Chris@16 70 const detail::ioctl_arg_type* data() const
Chris@16 71 {
Chris@16 72 return &value_;
Chris@16 73 }
Chris@16 74
Chris@16 75 private:
Chris@16 76 detail::ioctl_arg_type value_;
Chris@16 77 };
Chris@16 78
Chris@16 79 // I/O control command for getting number of bytes available.
Chris@16 80 class bytes_readable
Chris@16 81 {
Chris@16 82 public:
Chris@16 83 // Default constructor.
Chris@16 84 bytes_readable()
Chris@16 85 : value_(0)
Chris@16 86 {
Chris@16 87 }
Chris@16 88
Chris@16 89 // Construct with a specific command value.
Chris@16 90 bytes_readable(std::size_t value)
Chris@16 91 : value_(static_cast<detail::ioctl_arg_type>(value))
Chris@16 92 {
Chris@16 93 }
Chris@16 94
Chris@16 95 // Get the name of the IO control command.
Chris@16 96 int name() const
Chris@16 97 {
Chris@16 98 return static_cast<int>(BOOST_ASIO_OS_DEF(FIONREAD));
Chris@16 99 }
Chris@16 100
Chris@16 101 // Set the value of the I/O control command.
Chris@16 102 void set(std::size_t value)
Chris@16 103 {
Chris@16 104 value_ = static_cast<detail::ioctl_arg_type>(value);
Chris@16 105 }
Chris@16 106
Chris@16 107 // Get the current value of the I/O control command.
Chris@16 108 std::size_t get() const
Chris@16 109 {
Chris@16 110 return static_cast<std::size_t>(value_);
Chris@16 111 }
Chris@16 112
Chris@16 113 // Get the address of the command data.
Chris@16 114 detail::ioctl_arg_type* data()
Chris@16 115 {
Chris@16 116 return &value_;
Chris@16 117 }
Chris@16 118
Chris@16 119 // Get the address of the command data.
Chris@16 120 const detail::ioctl_arg_type* data() const
Chris@16 121 {
Chris@16 122 return &value_;
Chris@16 123 }
Chris@16 124
Chris@16 125 private:
Chris@16 126 detail::ioctl_arg_type value_;
Chris@16 127 };
Chris@16 128
Chris@16 129 } // namespace io_control
Chris@16 130 } // namespace detail
Chris@16 131 } // namespace asio
Chris@16 132 } // namespace boost
Chris@16 133
Chris@16 134 #include <boost/asio/detail/pop_options.hpp>
Chris@16 135
Chris@16 136 #endif // BOOST_ASIO_DETAIL_IO_CONTROL_HPP