theKernel 10.0
Loading...
Searching...
No Matches
MkExceptionC_CC_API

MkExceptionC - the final class to connect the MkErrorC with the C++ error … More...

+ Collaboration diagram for MkExceptionC_CC_API:

Classes

class  ccmkkernel::MkExceptionC
 MkExceptionC - The default-exception of the Programming-Language-Micro-Kernel (PLMK)More...
 

Functions

 ccmkkernel::MkExceptionC::MkExceptionC (MK_ERR err, MK_STRN const caller, MK_I32 const line)
 constructor
 
 ccmkkernel::MkExceptionC::MkExceptionC (MK_MNGN const mng, MK_STRN const caller, MK_I32 const line)
 constructor
 
 ccmkkernel::MkExceptionC::MkExceptionC (const MkExceptionC &e)
 copy constructor
 
virtual ccmkkernel::MkExceptionC::~MkExceptionC () throw ()
 destructor
 
virtual MK_STRN ccmkkernel::MkExceptionC::what () const throw ()
 Returns the explanatory string.
 
void ccmkkernel::MkExceptionC::Log (MK_DBG debug=0, MK_STRN callfunc=__builtin_FUNCTION(), MK_I32 lvl=0) const
 log the error to MkLogFileC (default: stderr) … → C-API: ErrorLog
 
static void ccmkkernel::MkExceptionC::Raise (MK_MNGN const expobj, MK_STRN const callfunc=__builtin_FUNCTION(), MK_I32 const callline=__builtin_LINE())
 convert an MkErrorC into a Target-Programming-Language (TPL) exception … → C-API: libmkkernel::MkExceptionRaise
 
static MK_ERR ccmkkernel::MkExceptionC::Catch (MK_MNGN const expobj, std::exception const *exception, MK_STRN const callfunc=__builtin_FUNCTION())
 convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::MkExceptionCatch
 
static MK_ERR ccmkkernel::MkExceptionC::Catch (MK_MNGN const expobj, std::exception const &exception, MK_STRN const callfunc=__builtin_FUNCTION())
 convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::MkExceptionCatch
 
static MK_ERR ccmkkernel::MkExceptionC::Catch (MK_MNGN const expobj, const std::string &msg, MK_STRN const callfunc=__builtin_FUNCTION())
 convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::MkExceptionCatch
 

Variables

MK_ERR ccmkkernel::MkExceptionC::hdl
 link to the MkErrorC object
 

Detailed Description

MkExceptionC - the final class to connect the MkErrorC with the C++ error …

MkExceptionC - The default-exception of the Programming-Language-Micro-Kernel (PLMK)

The Programming-Language-Micro-Kernel (PLMK) provide with MkErrorC a complete error-handling with focus to support the "C" Programming-Language. The support include catch, raise, signal and attributes. In addition every Target-Programming-Language (TPL) add their own error-handling and the purpose of MkExceptionC is to integrate the MkErrorC into the Target-Programming-Language (TPL).

The default-exception MkExceptionC is used to connect the MkErrorC with the Target-Programming-Language (TPL) error-object.

The implementation of an exception depends heavily on the Target-Programming-Language (TPL), starting with no exception at all, for example. C, an exception as a class object, or as an exception as a global attribute.

Attention

Function Documentation

◆ Catch() [1/3]

MK_ERR ccmkkernel::MkExceptionC::Catch ( MK_MNGN const expobj,
const std::string & msg,
MK_STRN const callfunc = __builtin_FUNCTION() )
static

convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::MkExceptionCatch

Definition at line 84 of file MkExceptionC_cc.cc.

85 {
86 MK_ERR err = MkErrorFORMAT_1M(mng);
87 MkRtSetup_XN(err);
88
89 MkErrorSetC (err, msg.c_str(), caller, -1);
90
91 return err;
92 }
struct MkErrorS * MK_ERR
class-shortcut for struct MkErrorS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MkErrorSetC(...)
#define MkErrorFORMAT_1M(m)
#define MkRtSetup_XN(x)

◆ Catch() [2/3]

static MK_ERR ccmkkernel::MkExceptionC::Catch ( MK_MNGN const expobj,
std::exception const & exception,
MK_STRN const callfunc = __builtin_FUNCTION() )
inlinestatic

convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::MkExceptionCatch

Definition at line 85 of file MkExceptionC_cc.hh.

89 {
90 return Catch(expobj, &exception, callfunc);
91 }
static MK_ERR Catch(MK_MNGN const expobj, std::exception const *exception, MK_STRN const callfunc=__builtin_FUNCTION())
convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::Mk...

◆ Catch() [3/3]

MK_ERR ccmkkernel::MkExceptionC::Catch ( MK_MNGN const expobj,
std::exception const * exception,
MK_STRN const callfunc = __builtin_FUNCTION() )
static

convert an Target-Programming-Language (TPL) exception into an MkErrorC … → C-API: libmkkernel::MkExceptionCatch

Definition at line 62 of file MkExceptionC_cc.cc.

63 {
64 std::stringstream ss;
65 MK_ERR err = MkErrorFORMAT_1M(mng);
66 MkRtSetup_XN(err);
67
68 auto* mqex = dynamic_cast<MkExceptionC const * const>(ex);
69 if (mqex != NULL) {
70 MkErrorSetE (err, mqex->hdl);
71 return err ;
72 }
73 auto* krex = dynamic_cast<MkKernelException const * const>(ex);
74 if (krex != NULL) {
75 MkErrorSetC (err, ex->what(), caller, -1);
76 MkErrorStackFormat (err, krex->func.c_str(), krex->file.c_str(), krex->line);
77 return err ;
78 }
79
80 MkErrorSetC (err, ex->what(), caller, -1);
81 return err;
82 }
#define MkErrorStackFormat(...)
#define MkErrorSetE(...)
MkExceptionC(MK_ERR err, MK_STRN const caller, MK_I32 const line)
constructor
+ Here is the caller graph for this function:

◆ Log()

void ccmkkernel::MkExceptionC::Log ( MK_DBG debug = 0,
MK_STRN callfunc = __builtin_FUNCTION(),
MK_I32 lvl = 0 ) const
inline

log the error to MkLogFileC (default: stderr) … → C-API: ErrorLog

Definition at line 60 of file MkExceptionC_cc.hh.

64 {
66 MkErrorLog(hdl, NULL, debug, callfunc, lvl);
67 }
#define MkErrorLog(...)
MK_ERR hdl
link to the MkErrorC object
#define MkRtSetup_X(x)

◆ MkExceptionC() [1/3]

ccmkkernel::MkExceptionC::MkExceptionC ( const MkExceptionC & e)

copy constructor

Definition at line 29 of file MkExceptionC_cc.cc.

29 {
30 hdl = e.hdl;
32 }
#define MkRefIncr_1X(x)

◆ MkExceptionC() [2/3]

ccmkkernel::MkExceptionC::MkExceptionC ( MK_ERR err,
MK_STRN const caller,
MK_I32 const line )
protected

constructor

Definition at line 39 of file MkExceptionC_cc.cc.

39 {
40 MK_ERR const def = MkErrorFORMAT_1M(err);
41 MkRtSetup_XN(def);
42 hdl = (err && err != def ? err : MkErrorDup(def));
43
45 MkErrorReset(def,caller,line,false);
46 }
#define MkErrorReset(...)
#define MkErrorDup(...)
+ Here is the caller graph for this function:

◆ MkExceptionC() [3/3]

ccmkkernel::MkExceptionC::MkExceptionC ( MK_MNGN const mng,
MK_STRN const caller,
MK_I32 const line )
protected

constructor

Definition at line 48 of file MkExceptionC_cc.cc.

48 {
49 MK_ERR const def = MkErrorFORMAT_1M(mng);
50 MkRtSetup_XN(def);
51 hdl = MkErrorDup(def);
52
54 MkErrorReset(def,caller,line,false);
55 }

◆ Raise()

void ccmkkernel::MkExceptionC::Raise ( MK_MNGN const expobj,
MK_STRN const callfunc = __builtin_FUNCTION(),
MK_I32 const callline = __builtin_LINE() )
static

convert an MkErrorC into a Target-Programming-Language (TPL) exception … → C-API: libmkkernel::MkExceptionRaise

Definition at line 57 of file MkExceptionC_cc.cc.

58 {
59 throw MkExceptionC(mng,caller,line);
60 }
+ Here is the caller graph for this function:

◆ what()

virtual MK_STRN ccmkkernel::MkExceptionC::what ( ) const
throw ( )
inlinevirtual

Returns the explanatory string.

Returns
Pointer to a null-terminated string with explanatory information. The pointer is guaranteed to be valid at least until the exception object from which it is obtained is destroyed, or until a non-const member function on the exception object is called.

Definition at line 55 of file MkExceptionC_cc.hh.

55 {
56 return MkBUF_R(&hdl->text).storage.first.C;
57 }
#define MkBUF_R(x)
cast a known-object into an MkBufferS reference
struct MkBuffer1024S text
the error message

◆ ~MkExceptionC()

ccmkkernel::MkExceptionC::~MkExceptionC ( )
throw ( )
virtual

destructor

Definition at line 34 of file MkExceptionC_cc.cc.

34 {
37 }
#define MkRefDecr_X(x)

Variable Documentation

◆ hdl

MK_ERR ccmkkernel::MkExceptionC::hdl
protected

link to the MkErrorC object

Definition at line 35 of file MkExceptionC_cc.hh.