8#ifndef INCLUDED_BSLSTL_ERROR
9#define INCLUDED_BSLSTL_ERROR
78#include <bslscm_version.h>
103#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
107#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
109#include <system_error>
113using std::error_category;
114using std::error_code;
115using std::error_condition;
116using std::generic_category;
117using std::system_category;
118using std::make_error_code;
119using std::make_error_condition;
123#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
128struct hash<error_code> :
std::hash<error_code>
133struct hash<error_condition> :
std::hash<error_condition>
147class error_condition;
191 virtual std::string
message(
int value)
const = 0;
218 typedef BloombergLP::bsls::UnspecifiedBool<error_code> UnspecifiedBool;
219 typedef UnspecifiedBool::BoolType BoolType;
238 template <
class ERROR_CODE_ENUM>
241 BoolType>::type = 0);
256 template <
class ERROR_CODE_ENUM>
259 operator=(ERROR_CODE_ENUM value);
280 operator BoolType()
const;
299 typedef BloombergLP::bsls::UnspecifiedBool<error_condition>
301 typedef UnspecifiedBool::BoolType BoolType;
320 template <
class ERROR_CONDITION_ENUM>
324 BoolType>::type = 0);
336 template <
class ERROR_CONDITION_ENUM>
339 operator=(ERROR_CONDITION_ENUM value);
350 std::string message()
const;
356 operator BoolType()
const;
383template <
class HASHALG>
387template <
class HASHALG>
410template <
class CHAR_TYPE,
class CHAR_TRAITS>
412std::basic_ostream<CHAR_TYPE, CHAR_TRAITS>&
operator<<(
413 std::basic_ostream<CHAR_TYPE, CHAR_TRAITS>& stream,
451 return *
this == code.
category() && code.value() == condition;
457 return strerror(value);
463 return "error_category";
470 return this == &other;
477 return !(*
this == other);
484 return std::less<const error_category *>()(
this, &other);
502, d_category_p(&category)
506template <
class ERROR_CODE_ENUM>
533template <
class ERROR_CODE_ENUM>
548 return *d_category_p;
570error_code::operator BoolType()
const
572 return UnspecifiedBool::makeValue(value());
576template <
class HASHALG>
579 using ::BloombergLP::bslh::hashAppend;
580 hashAppend(hashAlgorithm,
static_cast<const void *
>(&
object.category()));
591template <
class CHAR_TYPE,
class CHAR_TRAITS>
593std::basic_ostream<CHAR_TYPE, CHAR_TRAITS>&
operator<<(
594 std::basic_ostream<CHAR_TYPE, CHAR_TRAITS>& stream,
595 const error_code& code)
597 return stream << code.category().name() <<
':' << code.value();
615, d_category_p(&category)
619template <
class ERROR_CONDITION_ENUM>
622 ERROR_CONDITION_ENUM value,
645template <
class ERROR_CONDITION_ENUM>
660 return *d_category_p;
676error_condition::operator BoolType()
const
678 return UnspecifiedBool::makeValue(value());
682template <
class HASHALG>
685 using ::BloombergLP::bslh::hashAppend;
686 hashAppend(hashAlgorithm,
static_cast<const void *
>(&
object.category()));
700 return lhs.category() ==
rhs.category() &&
lhs.value() ==
rhs.value();
706 return lhs.category().equivalent(
lhs.value(),
rhs) ||
707 rhs.category().equivalent(
lhs,
rhs.value());
713 return rhs.category().equivalent(
rhs.value(),
lhs) ||
714 lhs.category().equivalent(
rhs,
lhs.value());
720 return lhs.category() ==
rhs.category() &&
lhs.value() ==
rhs.value();
750 return lhs.category() <
rhs.category() ||
751 (
lhs.category() ==
rhs.category() &&
lhs.value() <
rhs.value());
757 return lhs.category() <
rhs.category() ||
758 (
lhs.category() ==
rhs.category() &&
lhs.value() <
rhs.value());
775#if !defined(BSLS_PLATFORM_OS_DARWIN) || defined (BSLS_PLATFORM_CMP_GNU)
780 template <
class TYPE>
785struct hash<
bsl::error_code> : BloombergLP::bslh::Hash<>
790struct hash<
bsl::error_condition> : BloombergLP::bslh::Hash<>
Definition bslstl_error.h:157
bool operator==(const error_category &other) const BSLS_KEYWORD_NOEXCEPT
Return whether this object is the same as the specified other.
Definition bslstl_error.h:467
bool operator<(const error_category &other) const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_error.h:481
virtual ~error_category()
Destroy this object.
virtual const char * name() const BSLS_KEYWORD_NOEXCEPT=0
Return the name of this error category.
Definition bslstl_error.h:461
error_category()
Create an object of this type.
Definition bslstl_error.h:426
bool operator!=(const error_category &other) const BSLS_KEYWORD_NOEXCEPT
Return whether this object is different than the specified other.
Definition bslstl_error.h:474
virtual bool equivalent(int code, const error_condition &condition) const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_error.h:439
virtual error_condition default_error_condition(int value) const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_error.h:432
virtual std::string message(int value) const =0
Definition bslstl_error.h:455
Definition bslstl_error.h:214
error_condition default_error_condition() const
Definition bslstl_error.h:552
error_code()
Definition bslstl_error.h:493
std::string message() const
Return a string describing this object.
Definition bslstl_error.h:558
const error_category & category() const
Return a const reference to the category held by this object.
Definition bslstl_error.h:546
void clear()
Set this object to hold the value 0 and the system category.
Definition bslstl_error.h:527
int value() const
Return the value held by this object.
Definition bslstl_error.h:564
void assign(int value, const error_category &category)
Set this object to hold the specified value and category.
Definition bslstl_error.h:520
enable_if< is_error_code_enum< ERROR_CODE_ENUM >::value, error_code & >::type operator=(ERROR_CODE_ENUM value)
Definition bslstl_error.h:537
Definition bslstl_error.h:295
int value() const
Return the value held by this object.
Definition bslstl_error.h:670
void clear()
Set this object to hold the value 0 and the generic category.
Definition bslstl_error.h:639
const error_category & category() const
Return a const reference to the category held by this object.
Definition bslstl_error.h:658
enable_if< is_error_condition_enum< ERROR_CONDITION_ENUM >::value, error_condition & >::type operator=(ERROR_CONDITION_ENUM value)
Definition bslstl_error.h:649
void assign(int value, const error_category &category)
Set this object to hold the specified value and category.
Definition bslstl_error.h:632
std::string message() const
Return a string describing this object.
Definition bslstl_error.h:664
error_condition()
Definition bslstl_error.h:606
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
Definition bdlat_valuetypefunctions.h:939
error_code make_error_code(errc::Enum value)
Definition bslstl_error.h:585
const error_category & system_category()
Return a const reference to the unique system category object.
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const array< TYPE, SIZE > &input)
Pass the specified input to the specified hashAlgorithm
Definition bslstl_array.h:959
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
std::basic_ostream< CHAR_TYPE, TRAITS > & operator<<(std::basic_ostream< CHAR_TYPE, TRAITS > &os, const bitset< N > &x)
Definition bslstl_bitset.h:1417
ALLOCATOR & lhs
Definition bslstl_string.h:3917
const error_category & generic_category()
Return a const reference to the unique generic category object.
error_condition make_error_condition(errc::Enum value)
Definition bslstl_error.h:691
Definition bdldfp_decimal.h:5549
Definition bslmf_enableif.h:530
Enum
Definition bslstl_errc.h:144
Definition bslstl_hash.h:495
Definition bslstl_iserrorcodeenum.h:156
Definition bslstl_iserrorconditionenum.h:156
Definition bslstl_error.h:781