diff --git a/doc/reference.html b/doc/reference.html index 05c2102..24efd4e 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -38,6 +38,7 @@
This reference documentation describes components that -programs may use to report error conditions originating from the operating +
This reference documentation describes components that programs may use to report error conditions originating from the operating system or other low-level application program interfaces.
Boost.System library components never change the value of
errno
.
The library is documented to use several C++11 features, including
+noexcept
and explicit conversion operators. The actual implementation
+uses C++11 features only when they are available, and otherwise falls back on
+C++03 features.
Users may defined the following macros if desired. Sensible defaults are provided, so users may ignore these macros if they prefer.
@@ -178,6 +183,9 @@ fixed by globally adding () to these names to turn them into function calls. namespace system { class error_category; + const error_category & system_category() noexcept; + const error_category & generic_category() noexcept; + class error_code; class error_condition; @@ -281,21 +289,21 @@ fixed by globally adding () to these names to turn them into function calls. // non-member functions - bool operator==( const error_code & lhs, const error_code & rhs ); - bool operator==( const error_code & code, const error_condition & condition ); - bool operator==( const error_condition & condition, const error_code & code ); - bool operator==( const error_condition & lhs, const error_condition & rhs ); + bool operator==( const error_code & lhs, const error_code & rhs ) noexcept; + bool operator==( const error_code & code, const error_condition & condition ) noexcept; + bool operator==( const error_condition & condition, const error_code & code ) noexcept; + bool operator==( const error_condition & lhs, const error_condition & rhs ) noexcept; - bool operator!=( const error_code & lhs, const error_code & rhs ); - bool operator!=( const error_code & code, const error_condition & condition ); - bool operator!=( const error_condition & condition, const error_code & code ); - bool operator!=( const error_condition & lhs, const error_condition & rhs ); + bool operator!=( const error_code & lhs, const error_code & rhs ) noexcept; + bool operator!=( const error_code & code, const error_condition & condition ) noexcept; + bool operator!=( const error_condition & condition, const error_code & code ) noexcept; + bool operator!=( const error_condition & lhs, const error_condition & rhs ) noexcept; - bool operator<( const error_code & lhs, const error_code & rhs ); - bool operator<( const error_condition & lhs, const error_condition & rhs ); + bool operator<( const error_code & lhs, const error_code & rhs ) noexcept; + bool operator<( const error_condition & lhs, const error_condition & rhs ) noexcept; - error_code make_error_code( errc::errc_t e ); - error_condition make_error_condition( errc::errc_t e ); + error_code make_error_code( errc::errc_t e ) noexcept; + error_condition make_error_condition( errc::errc_t e ) noexcept; template <class charT, class traits> std::basic_ostream<charT,traits>& @@ -312,6 +320,17 @@ is_error_condition_enum templates to indicate that a type is eligible for classerror_code
and error_condition
automatic
conversions respectively.
+const error_category & system_category();+
++Returns: A reference to a
+error_category
object + identifying errors originating from the operating system.
const error_category & generic_category();+
++Returns: A reference to a
+error_category
object + identifying portable error conditions.
error_category
The class error_category
defines the base class for types used
to identify the source and encoding of a particular category of error code.
error_category
virtual membersClasses derived from error_category
shall behave as specified in
this subclause.
virtual const char * name() const=0;+
virtual const char * name() const noexcept =0;
-Returns: a string naming the error category.
-Throws: Nothing.
virtual string message( int ev ) const=0;+
virtual string message( int ev ) const noexcept =0;
-Returns: A string that describes the error denoted by
-ev
.Throws: Nothing.
virtual error_condition default_error_condition( int ev ) const;
virtual error_condition default_error_condition( int ev ) const noexcept;
-Returns:
error_condition( ev, *this )
.@@ -375,52 +390,33 @@ this subclause. and return it as an-error_condition
for that category. --end note]Throws: Nothing.
-
virtual bool equivalent( int code, const error_condition &
-condition )
-const;
virtual bool equivalent( int code, const error_condition & condition ) const noexcept;
-Returns:
-default_error_condition( code ) == condition
.Throws: Nothing.
-
virtual bool equivalent( const error_code & code, int condition ) const;
virtual bool equivalent( const error_code & code, int condition ) const noexcept;
+Returns:
-*this == code.category() && code.value() == condition
.Throws: Nothing.
-
error_category
non-virtual membersbool operator==( const error_category & rhs ) const;
bool operator==( const error_category & rhs ) const noexcept;
-Returns:
this == &rhs
.
bool operator!=( const error_category & rhs ) const;
bool operator!=( const error_category & rhs ) const noexcept;
-Returns:
this != &rhs
.
bool operator<( const error_category & rhs ) const;+
bool operator<( const error_category & rhs ) const noexcept;
--Returns:
+std::less<const error_category*>()( this, &rhs )
.Returns:
std::less<const error_category*>()( this, &rhs + noexcept)
.-[Note:
std::less
provides a total ordering for pointers. --end note]Throws: Nothing.
-
error_category
-non-member functionsconst error_category & system_category();-
--Returns: A reference to a
-error_category
object - identifying errors originating from the operating system.Throws: Nothing.
-
const error_category & generic_category();-
-Returns: A reference to a
-error_category
object - identifying portable error conditions.Throws: Nothing.
error_code
ErrorCodeEnum
>
- error_code( ErrorCodeEnum
e );
+ error_code( ErrorCodeEnum
e ) noexcept;
// modifiers:
- void assign( int val, const error_category & cat );
+ void assign( int val, const error_category & cat ) noexcept;
template<typename ErrorCodeEnum
>
- error_code & operator=( ErrorCodeEnum
val );;
- void clear();
+ error_code & operator=( ErrorCodeEnum
val ) noexcept;
+ void clear() noexcept;
// observers:
- int value() const;
- cont error_category & category() const;
- error_condition default_error_condition() const;
+ int value() const noexcept;
+ cont error_category & category() const noexcept;
+ error_condition default_error_condition() const noexcept;
string message() const;
operator unspecified-bool-type() const;
@@ -467,71 +463,63 @@ error_code synopsis
error_code
constructorserror_code();+
error_code() noexcept;
-Effects: Constructs an object of type
error_code
.Postconditions:
-val_ == 0 && cat_ == &system_category()
.Throws: Nothing.
error_code( int val, const error_category & cat );+
error_code( int val, const error_category & cat ) noexcept;
Effects: Constructs an object of type
error_code
.Postconditions:
-val_ == val && cat_ == &cat
.Throws: Nothing.
template <class+ error_code(ErrorCodeEnum
> - error_code(ErrorCodeEnum
val );
ErrorCodeEnum
val ) noexcept;
Effects: Constructs an object of type
error_code
.Postconditions:
-*this == make_error_code( val )
.Throws: Nothing.
Remarks: This constructor shall not participate in overload resolution unless
is_error_code_enum<ErrorCodeEnum>::value
istrue
.
error_code
modifiersvoid assign( int val, const error_category & cat );+
void assign( int val, const error_category & cat ) noexcept;
Postconditions:
-val_ == val && cat_ == &cat
.Throws: Nothing.
template<typename+ error_code & operator=(ErrorCodeEnum
> - error_code & operator=(ErrorCodeEnum
val );
ErrorCodeEnum
val ) noexcept;
-Postconditions:
-*this == make_error_code( val )
.Throws: Nothing.
Remarks: This operator shall not participate in overload resolution unless
is_error_code_enum<ErrorCodeEnum>::value
istrue
.
void clear();
void clear() noexcept;
postcondition:
value() == 0 && category() == system_category()
error_code
observersint value() const;
int value() const noexcept;
-Returns:
-val_
.Throws: Nothing.
-
const error_category & category() const;
const error_category & category() const noexcept;
-Returns:
-*cat_
.Throws: Nothing.
-
error_condition default_error_condition() const;+ +
error_condition default_error_condition() const noexcept;
-Returns:
-category().default_error_condition( value())
.Throws: Nothing.
string message() const;
string message() const;
-Returns:
category().message( value())
.Throws: Nothing.
operator unspecified-bool-type() const;
operator unspecified-bool-type() const;
Returns: if
public: // constructors: - error_condition(); - error_condition( int val, const error_category & cat ); + error_condition() noexcept; + error_condition( int val, const error_category & cat ) noexcept; template <class ErrorConditionEnum> - error_condition( errorConditionEnum val ); + error_condition( errorConditionEnum val ) noexcept; // modifiers: - void assign( int val, const error_category & cat ); + void assign( int val, const error_category & cat ) noexcept; template<typename ErrorConditionEnum> - error_condition & operator=( ErrorConditionEnum val ); - void clear(); + error_condition & operator=( ErrorConditionEnum val ) noexcept; + void clear() noexcept; // observers: - int value() const; - const error_category & category() const; + int value() const noexcept; + const error_category & category() const noexcept; string message() const; - operator unspecified-bool-type () const; + operator unspecified-bool-type () const noexcept; private: int val_; // exposition only @@ -586,65 +574,57 @@ implementation specific. --end note ]value() != 0
, returns a value that will evaluatetrue
in a boolean context; otherwise, returns a value that will @@ -560,22 +548,22 @@ implementation specific. --end note ]
error_condition
constructorserror_condition();+
error_condition() noexcept;
-Effects: Constructs an object of type
error_condition
.Postconditions:
-val_ == 0 and cat_ == &generic_category()
.Throws: Nothing.
error_condition( int val, const error_category & cat );+
error_condition( int val, const error_category & cat ) noexcept;
Effects: Constructs an object of type error_condition.
Postconditions:
-val_ == val and cat_ == &cat
.Throws: Nothing.
template <class ErrorConditionEnum> - error_condition( ErrorConditionEnum e );+ error_condition( ErrorConditionEnum e ) noexcept;
Effects: Constructs an object of type
error_condition
.Postconditions:
-*this == make_error_condition(e)
.Throws: Nothing.
Remarks: This constructor shall not participate in overload resolution unless
is_error_condition_enum<ErrorConditionEnum>::value
istrue
.
error_condition
modifiersvoid assign( int val, const error_category & cat );+
void assign( int val, const error_category & cat ) noexcept;
Postconditions:
-val_ == val and cat_ == &cat
.Throws: Nothing.
template<typename ErrorConditionEnum> - error_condition & operator=( ErrorConditionEnum e );+ error_condition & operator=( ErrorConditionEnum e ) noexcept;
-Postconditions:
*this == make_error_condition( e )
.Returns:
-*this
.Throws: Nothing.
Remarks: This operator shall not participate in overload resolution unless
is_error_condition_enum<ErrorConditionEnum>::value
istrue
.
void clear();
void clear() noexcept;
-postcondition:
+value() == 0 && category() == generic_category()
Postcondition:
value() == 0 && category() == generic_category()
error_condition
observersint value() const;+
int value() const noexcept;
-Returns:
-val_
.Throws: Nothing
const error_category & category() const;+
const error_category & category() const noexcept;
Returns:
-*cat_
.Throws: Nothing.
string message() const;
Returns:
-category().message( value() )
.Throws: Nothing.
operator unspecified-bool-type () const;
@@ -690,58 +670,50 @@ semantics:
bool operator==( const error_code & lhs, const error_code & rhs );+
bool operator==( const error_code & lhs, const error_code & rhs ) noexcept;
-Returns:
-lhs.category() == rhs.category() && lhs.value() == rhs.value()
.Throws: Nothing.
bool operator==( const error_code & code, const error_condition & condition ); -bool operator==( const error_condition & condition, const error_code & code );+
bool operator==( const error_code & code, const error_condition & condition ) noexcept; +bool operator==( const error_condition & condition, const error_code & code ) noexcept;
-Returns:
-code.category().equivalent( code.value(), condition )
.
|| condition.category().equivalent( code, condition.value() )Throws: Nothing.
bool operator==( const error_condition & lhs, const error_condition & rhs );+
bool operator==( const error_condition & lhs, const error_condition & rhs ) noexcept;
-Returns:
-lhs.category() == rhs.category() && lhs.value() == rhs.value()
.Throws: Nothing.
bool operator!=( const error_code & lhs, const error_code & rhs );+
bool operator!=( const error_code & lhs, const error_code & rhs ) noexcept;
-Returns:
-!(lhs == rhs )
.Throws: Nothing.
bool operator!=( const error_code & code, const error_condition & condition ); -bool operator!=( const error_condition & condition, const error_code & code );+
bool operator!=( const error_code & code, const error_condition & condition ) noexcept; +bool operator!=( const error_condition & condition, const error_code & code ) noexcept;
-Returns:
-!( code == condition )
.Throws: Nothing.
bool operator!=( const error_condition & lhs, const error_condition & rhs );+
bool operator!=( const error_condition & lhs, const error_condition & rhs ) noexcept;
-Returns:
-!(lhs == rhs )
.Throws: Nothing.
bool operator<( const error_code & lhs, const error_code & rhs );+
bool operator<( const error_code & lhs, const error_code & rhs ) noexcept;
-Returns:
-lhs.category() < rhs.category()
.
|| (lhs.category() == rhs.category() && lhs.value() < rhs.value())Throws: Nothing.
bool operator<( const error_condition & lhs, const error_condition & rhs );+
bool operator<( const error_condition & lhs, const error_condition & rhs ) noexcept;
-Returns:
-lhs.category() < rhs.category()
.
|| (lhs.category() == rhs.category() && lhs.value() < rhs.value())Throws: Nothing.
error_code make_error_code( errc::errc_t e );+
error_code make_error_code( errc::errc_t e ) noexcept;
-Returns:
error_code( e, generic_category())
.
error_condition make_error_condition( errc::errc_t e );+
error_condition make_error_condition( errc::errc_t e ) noexcept;
@@ -840,10 +812,10 @@ application program interfaces.Returns:
error_condition( static_cast<int>( e ), generic_category())
.
Revised -June 29, 2010 +February 27, 2013
-© Copyright Beman Dawes, 2006, 2007, 2008
+© Copyright Beman Dawes, 2006, 2007, 2008, 2013
Distributed under the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt
diff --git a/include/boost/system/error_code.hpp b/include/boost/system/error_code.hpp index c305a25..3e7689c 100644 --- a/include/boost/system/error_code.hpp +++ b/include/boost/system/error_code.hpp @@ -388,7 +388,7 @@ namespace boost || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val); } - private: + private: int m_val; const error_category * m_cat; @@ -422,13 +422,13 @@ namespace boost // non-member functions ------------------------------------------------// inline bool operator!=( const error_code & lhs, - const error_code & rhs ) + const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT { return !(lhs == rhs); } inline bool operator!=( const error_condition & lhs, - const error_condition & rhs ) + const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT { return !(lhs == rhs); } @@ -480,11 +480,11 @@ namespace boost namespace errc { // explicit conversion: - inline error_code make_error_code( errc_t e ) + inline error_code make_error_code( errc_t e ) BOOST_SYSTEM_NOEXCEPT { return error_code( e, generic_category() ); } // implicit conversion: - inline error_condition make_error_condition( errc_t e ) + inline error_condition make_error_condition( errc_t e ) BOOST_SYSTEM_NOEXCEPT { return error_condition( e, generic_category() ); } }