com_code.hpp
#include "nt_code.hpp"
namespace system_error2
{
using com_code = status_code<system_error2::_com_code_domain>;
using com_error = status_error<system_error2::_com_code_domain>;
class _com_code_domain;
constexpr system_error2::_com_code_domain const com_code_domain;
static constexpr system_error2::_com_code_domain const& _com_code_domain::get();
}
system_error2::com_code
using com_code = status_code<system_error2::_com_code_domain>;
(Windows only) A COM error code. Note semantic equivalence testing is only implemented for FACILITY_WIN32
and FACILITY_NT_BIT
. As you can see at https://blogs.msdn.microsoft.com/eldar/2007/04/03/a-lot-of-hresult-codes/, there are an awful lot of COM error codes, and keeping mapping tables for all of them would be impractical (for the Win32 and NT facilities, we actually reuse the mapping tables in win32_code
and nt_code
).
You can, of course, inherit your own COM code domain from this one and override the _do_equivalent()
function to add semantic equivalence testing for whichever extra COM codes that your application specifically needs.
system_error2::com_error
using com_error = status_error<system_error2::_com_code_domain>;
(Windows only) A specialisation of status_error
for the COM error code domain.
system_error2::_com_code_domain
class _com_code_domain
: public status_code_domain
{
public:
constexpr _com_code_domain(typename _base::unique_id_type id = 0xdc8275428b4effac) noexcept;
_com_code_domain(system_error2::_com_code_domain const&) = default;
_com_code_domain(system_error2::_com_code_domain&&) = default;
system_error2::_com_code_domain& operator=(system_error2::_com_code_domain const&) = default;
system_error2::_com_code_domain& operator=(system_error2::_com_code_domain&&) = default;
~_com_code_domain() = default;
static constexpr system_error2::_com_code_domain const& get();
virtual system_error2::status_code_domain::string_ref name() const noexcept;
protected:
virtual bool _do_failure(status_code<void> const& code) const noexcept;
virtual bool _do_equivalent(status_code<void> const& code1, status_code<void> const& code2) const noexcept;
virtual system_error2::generic_code _generic_code(status_code<void> const& code) const noexcept;
virtual system_error2::status_code_domain::string_ref _do_message(status_code<void> const& code) const noexcept;
virtual void _do_throw_exception(status_code<void> const& code) const;
};
(Windows only) The implementation of the domain for COM error codes and/or IErrorInfo
.
system_error2::_com_code_domain::_com_code_domain
constexpr _com_code_domain(typename _base::unique_id_type id = 0xdc8275428b4effac) noexcept;
Default constructor
system_error2::_com_code_domain::get
static constexpr system_error2::_com_code_domain const& get();
Constexpr singleton getter. Returns the constexpr com_code_domain variable.
system_error2::_com_code_domain::_do_equivalent
virtual bool _do_equivalent(status_code<void> const& code1, status_code<void> const& code2) const noexcept;
Note semantic equivalence testing is only implemented for FACILITY_WIN32
and FACILITY_NT_BIT
.
system_error2::com_code_domain
constexpr system_error2::_com_code_domain const com_code_domain;
(Windows only) A constexpr source variable for the COM code domain. Returned by _com_code_domain::get()
.