ADTF  3.18.2
error_description_impl.h
Go to the documentation of this file.
1 
15 #ifndef A_UTIL_UTIL_RESULT_IMPL_ERROR_DESCRIPTION_IMPL_HEADER_INCLUDED
16 #define A_UTIL_UTIL_RESULT_IMPL_ERROR_DESCRIPTION_IMPL_HEADER_INCLUDED
17 
19 
20 namespace a_util {
21 namespace result {
22 namespace detail {
23 ErrorDescription::ErrorDescription(std::int32_t error_code,
24  const char* error_description,
25  std::int32_t line,
26  const char* file,
27  const char* function,
28  const char* error_label)
29  : _error_code(error_code),
30  _line_number(line),
31  _error_description(error_description),
32  _file_name(file),
33  _function_name(function),
34  _error_label(error_label)
35 {
36 }
37 
38 std::int32_t ErrorDescription::getErrorCode() const
39 {
40  return _error_code;
41 }
42 
43 std::int32_t ErrorDescription::getLine() const
44 {
45  return _line_number;
46 }
47 
49 {
50  return _error_description.c_str();
51 }
52 
53 const char* ErrorDescription::getFileName() const
54 {
55  return _file_name.c_str();
56 }
57 
59 {
60  return _function_name.c_str();
61 }
62 
64 {
65  return _error_label.c_str();
66 }
67 
68 template <typename T, template <typename = T> class ResultInfo>
70 {
71  return ::a_util::result::ResultInfo<T>::getCode();
72 }
73 
74 template <typename T, template <typename = T> class ResultInfo>
76 {
77  return -1;
78 }
79 
80 template <typename T, template <typename = T> class ResultInfo>
82 {
83  return "";
84 }
85 
86 template <typename T, template <typename = T> class ResultInfo>
88 {
89  return "";
90 }
91 
92 template <typename T, template <typename = T> class ResultInfo>
94 {
95  return "";
96 }
97 
98 template <typename T, template <typename = T> class ResultInfo>
100 {
101  return ::a_util::result::ResultInfo<T>::getLabel();
102 }
103 
104 } // namespace detail
105 } // namespace result
106 } // namespace a_util
107 
108 #endif // A_UTIL_UTIL_RESULT_IMPL_ERROR_DESCRIPTION_IMPL_HEADER_INCLUDED
const char * getFileName() const
Get name of the file the error was reported in.
const char * getFunctionName() const
Get name of the function the error was reported in.
const std::string _file_name
File in which the error occurred.
std::int32_t getLine() const
Get line in source file where the error was reported.
const char * getErrorDescription() const
Get error code as string representation.
const std::string _error_label
Error code as string representation.
const std::int32_t _line_number
Line number in which the error occurred.
std::int32_t getErrorCode() const
Get error code.
const std::string _error_description
Currently held error description.
const std::string _function_name
Function in which the error occurred.
const char * getErrorCodeLabel() const
Get error code label.
const std::int32_t _error_code
Currently held error code.
const char * getFunctionName() const override
Does not provide any useful information in this context.
std::int32_t getErrorCode() const override
Get error code using a_util::result::ResultInfo<T>::getCode()
const char * getErrorCodeLabel() const override
Get error label using a_util::result::ResultInfo<T>::getLabel()
const char * getFileName() const override
Does not provide any useful information in this context.
const char * getErrorDescription() const override
Does not provide any useful information in this context.
std::int32_t getLine() const override
Does not provide any useful information in this context.
Declare the default error description class for Result return values.
Serves as the root component, with common functionality documented in core functionality.
Definition: base.h:24
Basic result information template, used by a_util::result::Result.