summaryrefslogtreecommitdiff
path: root/boost/asio/impl/serial_port_base.ipp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/impl/serial_port_base.ipp')
-rw-r--r--boost/asio/impl/serial_port_base.ipp35
1 files changed, 17 insertions, 18 deletions
diff --git a/boost/asio/impl/serial_port_base.ipp b/boost/asio/impl/serial_port_base.ipp
index 0344fa54a3..51f66c161a 100644
--- a/boost/asio/impl/serial_port_base.ipp
+++ b/boost/asio/impl/serial_port_base.ipp
@@ -2,7 +2,7 @@
// impl/serial_port_base.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -21,13 +21,13 @@
#if defined(BOOST_ASIO_HAS_SERIAL_PORT)
#include <stdexcept>
-#include <boost/throw_exception.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/serial_port_base.hpp>
+#include <boost/asio/detail/throw_exception.hpp>
#if defined(GENERATING_DOCUMENTATION)
# define BOOST_ASIO_OPTION_STORAGE implementation_defined
-#elif defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
# define BOOST_ASIO_OPTION_STORAGE DCB
#else
# define BOOST_ASIO_OPTION_STORAGE termios
@@ -41,7 +41,7 @@ namespace asio {
boost::system::error_code serial_port_base::baud_rate::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
storage.BaudRate = value_;
#else
speed_t baud;
@@ -111,7 +111,6 @@ boost::system::error_code serial_port_base::baud_rate::store(
case 4000000: baud = B4000000; break;
# endif
default:
- baud = B0;
ec = boost::asio::error::invalid_argument;
return ec;
}
@@ -129,7 +128,7 @@ boost::system::error_code serial_port_base::baud_rate::store(
boost::system::error_code serial_port_base::baud_rate::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
value_ = storage.BaudRate;
#else
speed_t baud = ::cfgetospeed(&storage);
@@ -215,14 +214,14 @@ serial_port_base::flow_control::flow_control(
if (t != none && t != software && t != hardware)
{
std::out_of_range ex("invalid flow_control value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
boost::system::error_code serial_port_base::flow_control::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
storage.fOutxCtsFlow = FALSE;
storage.fOutxDsrFlow = FALSE;
storage.fTXContinueOnXoff = TRUE;
@@ -289,7 +288,7 @@ boost::system::error_code serial_port_base::flow_control::store(
boost::system::error_code serial_port_base::flow_control::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
if (storage.fOutX && storage.fInX)
{
value_ = software;
@@ -333,14 +332,14 @@ serial_port_base::parity::parity(serial_port_base::parity::type t)
if (t != none && t != odd && t != even)
{
std::out_of_range ex("invalid parity value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
boost::system::error_code serial_port_base::parity::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
switch (value_)
{
case none:
@@ -387,7 +386,7 @@ boost::system::error_code serial_port_base::parity::store(
boost::system::error_code serial_port_base::parity::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
if (storage.Parity == EVENPARITY)
{
value_ = even;
@@ -428,14 +427,14 @@ serial_port_base::stop_bits::stop_bits(
if (t != one && t != onepointfive && t != two)
{
std::out_of_range ex("invalid stop_bits value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
boost::system::error_code serial_port_base::stop_bits::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
switch (value_)
{
case one:
@@ -471,7 +470,7 @@ boost::system::error_code serial_port_base::stop_bits::store(
boost::system::error_code serial_port_base::stop_bits::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
if (storage.StopBits == ONESTOPBIT)
{
value_ = one;
@@ -501,14 +500,14 @@ serial_port_base::character_size::character_size(unsigned int t)
if (t < 5 || t > 8)
{
std::out_of_range ex("invalid character_size value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
boost::system::error_code serial_port_base::character_size::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
storage.ByteSize = value_;
#else
storage.c_cflag &= ~CSIZE;
@@ -528,7 +527,7 @@ boost::system::error_code serial_port_base::character_size::store(
boost::system::error_code serial_port_base::character_size::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
value_ = storage.ByteSize;
#else
if ((storage.c_cflag & CSIZE) == CS5) { value_ = 5; }