errors.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_SIGSLOTS_LITE_ERRORS_HPP_
13 #define ECL_SIGSLOTS_LITE_ERRORS_HPP_
14 
15 /*****************************************************************************
16 ** Namespaces
17 *****************************************************************************/
18 
19 namespace ecl {
20 namespace lite {
21 namespace sigslots {
22 
30 enum ErrorFlag {
31  NoError = 0,
32  UnknownError = -1,
34 };
35 
41 class Error {
42 public:
53  virtual sigslots::ErrorFlag flag() const { return error_flag; }
59  virtual const char* what() const {
60  switch (error_flag) {
61  case (NoError) : { return noErrorString(); }
62  case (OutOfResourcesError) : { return outOfResourcesErrorString(); }
63  default : { return unknownErrorString(); }
64  }
65  }
66 private:
67  const char* noErrorString() const { return "No error."; }
68  const char* unknownErrorString() const { return "Unknown error."; }
69  const char* outOfResourcesErrorString() const { return "You cannot add any more to this signal/slot interface (capacity is already fully utilised)."; }
71 
72 };
73 
74 } // namespace sigslots
75 } // namespace lite
76 } // namespace ecl
77 
78 #endif /* ECL_SIGSLOTS_LITE_ERRORS_HPP_ */
const char * noErrorString() const
Definition: errors.hpp:67
virtual sigslots::ErrorFlag flag() const
The flag identifying the error identified with this error handler.
Definition: errors.hpp:53
Extends the generic ecl error handler with some time specific error strings.
Definition: errors.hpp:41
const char * unknownErrorString() const
Definition: errors.hpp:68
const char * outOfResourcesErrorString() const
Definition: errors.hpp:69
ErrorFlag
Error flags for lite sigslots.
Definition: errors.hpp:30
virtual const char * what() const
A simple string verbosely representing the error that is handled.
Definition: errors.hpp:59
Error(const sigslots::ErrorFlag &flag=UnknownError)
Configures the error class with the specified error flag.
Definition: errors.hpp:48


ecl_sigslots_lite
Author(s): Daniel Stonier
autogenerated on Fri Jun 7 2019 21:52:46