theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - 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::Set (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::Set (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::Set (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

◆ 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 73 of file MkExceptionC_cc.hh.

77 {
79 MkErrorLog(hdl, NULL, debug, callfunc, lvl);
80 }
#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 31 of file MkExceptionC_cc.cc.

31 {
32 hdl = e.hdl;
34 }
#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 41 of file MkExceptionC_cc.cc.

41 {
42 MK_ERR const def = MkErrorFORMAT_1M(err);
43 MkRtSetup_XN(def);
44 hdl = (err && err != def ? err : MkErrorDup(def));
45
47 MkErrorReset(def,caller,line,false);
48 }
struct MkErrorS * MK_ERR
class-shortcut for struct MkErrorS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MkErrorReset(...)
#define MkErrorFORMAT_1M(m)
#define MkErrorDup(...)
#define MkRtSetup_XN(x)
+ 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 50 of file MkExceptionC_cc.cc.

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

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

60 {
61 throw MkExceptionC(mng,caller,line);
62 }
MkExceptionC(MK_ERR err, MK_STRN const caller, MK_I32 const line)
constructor
+ Here is the caller graph for this function:

◆ Set() [1/3]

MK_ERR ccmkkernel::MkExceptionC::Set ( 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 80 of file MkExceptionC_cc.cc.

81 {
82 MK_ERR err = MkErrorFORMAT_1M(mng);
83 MkRtSetup_XN(err);
84
85 MkErrorSetC (err, msg.c_str(), caller, -1);
86
87 return err;
88 }
#define MkErrorSetC(...)

◆ Set() [2/3]

static MK_ERR ccmkkernel::MkExceptionC::Set ( 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 98 of file MkExceptionC_cc.hh.

102 {
103 return Set(expobj, &exception, callfunc);
104 }
static MK_ERR Set(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...

◆ Set() [3/3]

MK_ERR ccmkkernel::MkExceptionC::Set ( 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 64 of file MkExceptionC_cc.cc.

65 {
66 MK_ERR err = MkErrorFORMAT_1M(mng);
67 MkRtSetup_XN(err);
68
69 MkExceptionC const * const mqex = dynamic_cast<MkExceptionC const * const>(ex);
70
71 if (mqex != NULL) {
72 MkErrorSetE (err, mqex->hdl);
73 } else {
74 MkErrorSetC (err, ex->what(), caller, -1);
75 }
76
77 return err;
78 }
#define MkErrorSetE(...)
+ 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 68 of file MkExceptionC_cc.hh.

68 {
69 return MkBUF_R(&hdl->text).storage.first.C;
70 }
#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 36 of file MkExceptionC_cc.cc.

36 {
39 }
#define MkRefDecr_X(x)

Variable Documentation

◆ hdl

MK_ERR ccmkkernel::MkExceptionC::hdl
protected

link to the MkErrorC object

Definition at line 48 of file MkExceptionC_cc.hh.