15#ifndef A_UTIL_UTIL_RESULT_RESULT_INFO_DECL_HEADER_INCLUDED
16#define A_UTIL_UTIL_RESULT_RESULT_INFO_DECL_HEADER_INCLUDED
24#ifndef DEV_ESSENTIAL_DISABLE_MAKE_RESULT_CHECK_RESERVED_ZERO
25#define DEV_ESSENTIAL_INTERNAL_MAKE_RESULT_CHECK_NOT_ZERO(_no) _no != 0
27#define DEV_ESSENTIAL_INTERNAL_MAKE_RESULT_CHECK_NOT_ZERO(...) true
36#define _MAKE_RESULT(_no, _label) \
38 struct ResultType_##_label : public ::a_util::result::ResultInfo<ResultType_##_label> { \
39 static std::int32_t getCode() \
41 static_assert(std::is_same<decltype((_no)), std::int32_t>::value, \
42 #_no " is not in range of std::int32_t."); \
45 static const char* getLabel() \
50 const ::a_util::result::ResultInfo<ResultType_##_label> _label = ResultType_##_label(); \
52 static_assert(DEV_ESSENTIAL_INTERNAL_MAKE_RESULT_CHECK_NOT_ZERO(_no), \
53 "'0' is not allowed, because it is reserved for results indicating no error. " \
54 "Please use a_util::result::SUCCESS instead. To disable this check, define " \
55 "'DEV_ESSENTIAL_DISABLE_MAKE_RESULT_CHECK_RESERVED_ZERO'")
66template <
typename ResultType>
68bool isOk(
const ResultType& result);
77template <
typename ResultType>
79bool isFailed(
const ResultType& result);
129template <
typename ResultTypeLHS,
typename ResultTypeRHS>
130bool operator==(
const ResultInfo<ResultTypeLHS>& lhs,
const ResultInfo<ResultTypeRHS>& rhs);
140template <
typename ResultTypeLHS,
typename ResultTypeRHS>
141bool operator!=(
const ResultInfo<ResultTypeLHS>& lhs,
const ResultInfo<ResultTypeRHS>& rhs);
151template <
typename ResultTypeLHS,
typename ResultTypeRHS>
152bool operator<(
const ResultInfo<ResultTypeLHS>& lhs,
const ResultInfo<ResultTypeRHS>& rhs);
162template <
typename ResultTypeLHS,
typename ResultTypeRHS>
163bool operator>(
const ResultInfo<ResultTypeLHS>& lhs,
const ResultInfo<ResultTypeRHS>& rhs);
173template <
typename ResultTypeLHS,
typename ResultTypeRHS>
174bool operator<=(
const ResultInfo<ResultTypeLHS>& lhs,
const ResultInfo<ResultTypeRHS>& rhs);
184template <
typename ResultTypeLHS,
typename ResultTypeRHS>
185bool operator>=(
const ResultInfo<ResultTypeLHS>& lhs,
const ResultInfo<ResultTypeRHS>& rhs);
#define DEV_ESSENTIAL_DEPRECATED(msg)
Definition deprecated.h:44
bool operator!=(const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
Definition result_info_impl.h:66
bool operator>(const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
Definition result_info_impl.h:78
bool operator>=(const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
Definition result_info_impl.h:90
bool operator==(const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
Definition result_info_impl.h:58
bool isOk(const ResultType &result)
Definition result_info_impl.h:24
bool operator<=(const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
Definition result_info_impl.h:84
bool operator<(const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
Definition result_info_impl.h:72
bool isFailed(const ResultType &result)
Definition result_info_impl.h:30
Serves as the root component, with common functionality documented in core functionality.
Definition base.h:24
Definition result_info_decl.h:86
static std::int32_t getCode()
Definition result_info_impl.h:42
static const char * getLabel()
Definition result_info_impl.h:36