errors.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_SIGSLOTS_LITE_ERRORS_HPP_
00013 #define ECL_SIGSLOTS_LITE_ERRORS_HPP_
00014 
00015 /*****************************************************************************
00016 ** Namespaces
00017 *****************************************************************************/
00018 
00019 namespace ecl {
00020 namespace lite {
00021 namespace sigslots {
00022 
00030 enum ErrorFlag {
00031         NoError = 0,                            
00032         UnknownError = -1,              
00033         OutOfResourcesError = -21,      
00034 };
00035 
00041 class Error {
00042 public:
00048         Error(const sigslots::ErrorFlag& flag = UnknownError) : error_flag(flag) {}
00053         virtual sigslots::ErrorFlag flag() const { return error_flag; }
00059         virtual const char* what() const {
00060                 switch (error_flag) {
00061                         case (NoError) : { return noErrorString(); }
00062                         case (OutOfResourcesError) : { return outOfResourcesErrorString(); }
00063                         default : { return unknownErrorString(); }
00064                 }
00065         }
00066 private:
00067         const char* noErrorString() const { return "No error."; }
00068         const char* unknownErrorString() const { return "Unknown error."; }
00069         const char* outOfResourcesErrorString() const { return "You cannot add any more to this signal/slot interface (capacity is already fully utilised)."; }
00070         ErrorFlag error_flag;
00071 
00072 };
00073 
00074 } // namespace sigslots
00075 } // namespace lite
00076 } // namespace ecl
00077 
00078 #endif /* ECL_SIGSLOTS_LITE_ERRORS_HPP_ */


ecl_sigslots_lite
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 11:27:15