mirror of
https://github.com/boostorg/system.git
synced 2025-12-25 16:28:05 +01:00
Compare commits
3 Commits
feature/up
...
feature/op
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c02cd2b004 | ||
|
|
c8c5ad1ce5 | ||
|
|
361834e49c |
@@ -725,7 +725,7 @@ constexpr void assign( int val, const error_category & cat ) noexcept;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Effects: :: `*this = error_code( val, cat );`.
|
||||
Effects: :: `*this = error_code( val, cat )`.
|
||||
|
||||
```
|
||||
void assign( int val, const error_category & cat,
|
||||
@@ -734,7 +734,7 @@ void assign( int val, const error_category & cat,
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Effects: :: `*this = error_code( val, cat, loc );`.
|
||||
Effects: :: `*this = error_code( val, cat, loc )`.
|
||||
|
||||
```
|
||||
template<typename ErrorCodeEnum>
|
||||
@@ -753,7 +753,7 @@ constexpr void clear() noexcept;
|
||||
* {blank}
|
||||
+
|
||||
Effects: ::
|
||||
`*this = error_code();`.
|
||||
`*this = error_code()`.
|
||||
|
||||
#### Observers
|
||||
|
||||
@@ -1700,8 +1700,8 @@ template<class Ch, class Tr, class T, class E>
|
||||
* {blank}
|
||||
+
|
||||
Effects: ::
|
||||
- If `*this` holds a value `t`, `os << "value:" << t;`.
|
||||
- If `*this` holds an error `e`, `os << "error:" << e;`.
|
||||
- If `*this` holds a value `t`, `os << "value:" << t`.
|
||||
- If `*this` holds an error `e`, `os << "error:" << e`.
|
||||
Returns: ::
|
||||
`os`.
|
||||
|
||||
@@ -1943,8 +1943,8 @@ template<class Ch, class Tr, class E>
|
||||
* {blank}
|
||||
+
|
||||
Effects: ::
|
||||
- If `*this` holds a value, `os << "value:void";`.
|
||||
- If `*this` holds an error `e`, `os << "error:" << e;`.
|
||||
- If `*this` holds a value, `os << "value:void"`.
|
||||
- If `*this` holds an error `e`, `os << "error:" << e`.
|
||||
Returns: ::
|
||||
`os`.
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ private:
|
||||
friend std::size_t hash_value( error_code const & ec );
|
||||
friend BOOST_SYSTEM_CONSTEXPR bool detail::failed_impl( int ev, error_category const & cat );
|
||||
|
||||
friend class error_code;
|
||||
friend class error_condition;
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||
public:
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ inline bool error_category::equivalent( int code, const error_condition & condit
|
||||
|
||||
inline bool error_category::equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return *this == code.category() && code.value() == condition;
|
||||
return code.equals( condition, *this );
|
||||
}
|
||||
|
||||
inline char const * error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
|
||||
|
||||
@@ -285,6 +285,30 @@ public:
|
||||
|
||||
// relationals:
|
||||
|
||||
private:
|
||||
|
||||
// private equality for use in error_category::equivalent
|
||||
|
||||
friend class error_category;
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR bool equals( int val, error_category const& cat ) const BOOST_NOEXCEPT
|
||||
{
|
||||
if( lc_flags_ == 0 )
|
||||
{
|
||||
return val == 0 && cat.id_ == detail::system_category_id;
|
||||
}
|
||||
else if( lc_flags_ == 1 )
|
||||
{
|
||||
return cat.id_ == detail::interop_category_id && val == value();
|
||||
}
|
||||
else
|
||||
{
|
||||
return val == d1_.val_ && cat == *d1_.cat_;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// the more symmetrical non-member syntax allows enum
|
||||
// conversions work for both rhs and lhs.
|
||||
|
||||
|
||||
@@ -47,6 +47,13 @@ private:
|
||||
int val_;
|
||||
error_category const * cat_;
|
||||
|
||||
private:
|
||||
|
||||
boost::ulong_long_type cat_id() const BOOST_NOEXCEPT
|
||||
{
|
||||
return cat_? cat_->id_: detail::generic_category_id;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// constructors:
|
||||
@@ -180,7 +187,22 @@ public:
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return lhs.val_ == rhs.val_ && lhs.category() == rhs.category();
|
||||
if( lhs.val_ != rhs.val_ )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if( lhs.cat_ == 0 )
|
||||
{
|
||||
return rhs.cat_id() == detail::generic_category_id;
|
||||
}
|
||||
else if( rhs.cat_ == 0 )
|
||||
{
|
||||
return lhs.cat_id() == detail::generic_category_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return *lhs.cat_ == *rhs.cat_;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
|
||||
|
||||
Reference in New Issue
Block a user