PFUNC 1.0
|
Implementation of exceptions. More...
#include <exception>
#include <typeinfo>
#include <stdexcept>
#include <string>
#include <cstdlib>
#include <pfunc/config.h>
Go to the source code of this file.
Namespaces | |
namespace | pfunc |
Namespace for the C++ interface of PFUNC. | |
Defines | |
#define | LINE_TO_STR_HELP(line) #line |
#define | LINE_TO_STR(line) LINE_TO_STR_HELP(line) |
#define | FILE_AND_LINE() __FILE__ ":" LINE_TO_STR(__LINE__) |
#define | PFUNC_CATCH_AND_RETHROW(STRUCT_NAME, FUNC_NAME) |
#define | PFUNC_CATCH_AND_STORE(STRUCT_NAME, FUNC_NAME) |
#define | PFUNC_C_CATCH_AND_RETURN_EXCEPTION_CODE() |
#define | PFUNC_CHECK_AND_RETHROW() |
#define | PFUNC_CXX_CATCH_AND_RETHROW() |
#define | PFUNC_START_TRY_BLOCK() |
#define | PFUNC_CONSTRUCTOR_TRY_BLOCK() |
#define | PFUNC_END_TRY_BLOCK() |
#define | PFUNC_DEFINE_EXCEPT_PTR() |
#define | PFUNC_EXCEPT_PTR_INIT() |
#define | PFUNC_EXCEPT_PTR_CLEAR() |
#define | PFUNC_CAPTURE_RETURN_VALUE(var) |
Typedefs | |
typedef int | pfunc::error_code_type |
Implementation of exceptions.
#define FILE_AND_LINE | ( | ) | __FILE__ ":" LINE_TO_STR(__LINE__) |
Returns a string that represents the file name and the line number
#define LINE_TO_STR | ( | line | ) | LINE_TO_STR_HELP(line) |
Helper function to covert line number to string
#define LINE_TO_STR_HELP | ( | line | ) | #line |
Helper function to covert line number to string
#define PFUNC_C_CATCH_AND_RETURN_EXCEPTION_CODE | ( | ) |
#define PFUNC_CAPTURE_RETURN_VALUE | ( | var | ) |
#define PFUNC_CATCH_AND_RETHROW | ( | STRUCT_NAME, | |
FUNC_NAME | |||
) |
Generates a generic catch block that take in the structure and function name and rethrows the error. Depends on the variable being called "exception" Catch block for the constructor and destructor. Note that we know where the errors are coming from. Hence, we know that there is nothing that is deriving from exception_generic_impl. Else, we will have to use clone() and rethrow() methods to ensure that the information is preserved.
WARNING! Assumes you have a pointer called "except" of type "exception" defined in our class! Better define it!
#define PFUNC_CATCH_AND_STORE | ( | STRUCT_NAME, | |
FUNC_NAME | |||
) |
#define PFUNC_CHECK_AND_RETHROW | ( | ) |
#define PFUNC_CONSTRUCTOR_TRY_BLOCK | ( | ) |
#define PFUNC_CXX_CATCH_AND_RETHROW | ( | ) |
#define PFUNC_DEFINE_EXCEPT_PTR | ( | ) |
#define PFUNC_END_TRY_BLOCK | ( | ) |
#define PFUNC_EXCEPT_PTR_CLEAR | ( | ) |
#define PFUNC_EXCEPT_PTR_INIT | ( | ) |
#define PFUNC_START_TRY_BLOCK | ( | ) |