theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - cs - py - rb - jv - cc
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 87 of file MkExceptionC_cc.cc.

88 {
89 MK_ERR err = MkErrorFORMAT_1M(mng);
90 MkRtSetup_XN(err);
91
92 MkErrorSetC (err, msg.c_str(), caller, -1);
93
94 return err;
95 }
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 88 of file MkExceptionC_cc.hh.

92 {
93 return Catch(expobj, &exception, callfunc);
94 }
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 65 of file MkExceptionC_cc.cc.

66 {
67 std::stringstream ss;
68 MK_ERR err = MkErrorFORMAT_1M(mng);
69 MkRtSetup_XN(err);
70
71 auto* mqex = dynamic_cast<MkExceptionC const * const>(ex);
72 if (mqex != NULL) {
73 MkErrorSetE (err, mqex->hdl);
74 return err ;
75 }
76 auto* krex = dynamic_cast<MkKernelException const * const>(ex);
77 if (krex != NULL) {
78 MkErrorSetC (err, ex->what(), caller, -1);
79 MkErrorStackFormat (err, krex->func.c_str(), krex->file.c_str(), krex->line);
80 return err ;
81 }
82
83 MkErrorSetC (err, ex->what(), caller, -1);
84 return err;
85 }
#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 63 of file MkExceptionC_cc.hh.

67 {
69 MkErrorLog(hdl, NULL, debug, callfunc, lvl);
70 }
#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 32 of file MkExceptionC_cc.cc.

32 {
33 hdl = e.hdl;
35 }
#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 42 of file MkExceptionC_cc.cc.

42 {
43 MK_ERR const def = MkErrorFORMAT_1M(err);
44 MkRtSetup_XN(def);
45 hdl = (err && err != def ? err : MkErrorDup(def));
46
48 MkErrorReset(def,caller,line,false);
49 }
#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 51 of file MkExceptionC_cc.cc.

51 {
52 MK_ERR const def = MkErrorFORMAT_1M(mng);
53 MkRtSetup_XN(def);
54 hdl = MkErrorDup(def);
55
57 MkErrorReset(def,caller,line,false);
58 }

◆ 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 60 of file MkExceptionC_cc.cc.

61 {
62 throw MkExceptionC(mng,caller,line);
63 }
+ 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 58 of file MkExceptionC_cc.hh.

58 {
59 return MkBUF_R(&hdl->text).storage.first.C;
60 }
#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 37 of file MkExceptionC_cc.cc.

37 {
40 }
#define MkRefDecr_X(x)

Variable Documentation

◆ hdl

MK_ERR ccmkkernel::MkExceptionC::hdl
protected

link to the MkErrorC object

Definition at line 38 of file MkExceptionC_cc.hh.