com_runtime_error and sec_runtime_error expanded to full classes (from typedef) to allow correct run-time-type separation
This commit is contained in:
parent
f94b72379e
commit
986762649f
@ -29,19 +29,7 @@ namespace winstd
|
||||
class WINSTD_API bstr;
|
||||
class WINSTD_API variant;
|
||||
class WINSTD_API com_initializer;
|
||||
|
||||
///
|
||||
/// \defgroup WinStdExceptions Exceptions
|
||||
/// Additional exceptions
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// COM runtime error
|
||||
///
|
||||
typedef num_runtime_error<HRESULT> com_runtime_error;
|
||||
|
||||
/// @}
|
||||
class WINSTD_API com_runtime_error;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@ -975,4 +963,53 @@ namespace winstd
|
||||
protected:
|
||||
HRESULT m_result; ///< Result of CoInitialize call
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// \defgroup WinStdExceptions Exceptions
|
||||
/// Additional exceptions
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// COM runtime error
|
||||
///
|
||||
/// \note Must be defined as derived class from num_runtime_error<> to allow correct type info for dynamic typecasting and prevent folding with other derivates of num_runtime_error<>.
|
||||
///
|
||||
class WINSTD_API com_runtime_error : public num_runtime_error<HRESULT>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] error COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<HRESULT>(num, msg.c_str())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_z_ const char *msg) : num_runtime_error<HRESULT>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies an exception
|
||||
///
|
||||
/// \param[in] other Exception to copy from
|
||||
///
|
||||
inline com_runtime_error(const com_runtime_error &other) : num_runtime_error<HRESULT>(other)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ namespace winstd
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Windows runtime error
|
||||
/// Numerical runtime error
|
||||
///
|
||||
template <typename _Tn>
|
||||
class num_runtime_error : public std::runtime_error
|
||||
@ -798,7 +798,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num Numeric error code
|
||||
/// \param[in] num Windows error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline win_runtime_error(_In_ error_type num, _In_z_ const char *msg) : num_runtime_error<DWORD>(num, msg)
|
||||
|
@ -31,19 +31,7 @@ namespace winstd
|
||||
class WINSTD_API sec_credentials;
|
||||
class WINSTD_API sec_context;
|
||||
class WINSTD_API sec_buffer_desc;
|
||||
|
||||
///
|
||||
/// \defgroup WinStdExceptions Exceptions
|
||||
/// Additional exceptions
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// COM runtime error
|
||||
///
|
||||
typedef num_runtime_error<SECURITY_STATUS> sec_runtime_error;
|
||||
|
||||
/// @}
|
||||
class WINSTD_API sec_runtime_error;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@ -358,4 +346,53 @@ namespace winstd
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
///
|
||||
/// \defgroup WinStdExceptions Exceptions
|
||||
/// Additional exceptions
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// COM runtime error
|
||||
///
|
||||
/// \note Must be defined as derived class from num_runtime_error<> to allow correct type info for dynamic typecasting and prevent folding with other derivates of num_runtime_error<>.
|
||||
///
|
||||
class WINSTD_API sec_runtime_error : public num_runtime_error<SECURITY_STATUS>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] error Security provider error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline sec_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<SECURITY_STATUS>(num, msg.c_str())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num Security provider error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline sec_runtime_error(_In_ error_type num, _In_z_ const char *msg) : num_runtime_error<SECURITY_STATUS>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies an exception
|
||||
///
|
||||
/// \param[in] other Exception to copy from
|
||||
///
|
||||
inline sec_runtime_error(const sec_runtime_error &other) : num_runtime_error<SECURITY_STATUS>(other)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user