![]() ![]() ![]()
|
SophiaFramework UNIVERSE 5.3 |
#include <SFCType.h.hpp>
class static_exception;
The exception of C++ programming language is not available in the ARM compiler.
The static_exception class provides the exception handling mechanism similar to C++ programming language.
When using the static_exception class, it is necessary to create a class derived from the static_exception class.
"T" in the template argument of static_exception must be the class where the SFCError type is available.
| Constructor/Destructor |
|---|
|
static_exception( Void ) Constructor of static_exception class.
|
|
~static_exception(
Void
) Destructor of the static_exception class.
|
| Public Functions | |
|---|---|
| T const & |
static_catch(
Void
) Get the current exception.
|
| Protected Functions | |
|---|---|
| Void |
static_throw(
static_exception< T > const & param
) Set an exception.
|
| Void |
static_throw(
T const & param
) Set an exception.
|
| Bool |
static_try(
Void
) Confirm whether or not the exception is retained.
|
[ public, explicit ] static_exception(Void);
The value of exception is initialized with SFERR_NO_ERROR.
[ protected ]
~static_exception(
Void
);[ public, const ]
T const & static_catch(
Void
);
switch (static_catch()) {
// processing according to the error
...
}
[ protected ] Void static_throw( static_exception< T > const & param // the source static_exception object );
[ protected ] Void static_throw( T const & param // the exception to specify );
The "static_throw" statement has a little different semantics from that of the "throw" in the C++ programming language. The next statement after the "static_throw" statement is always executed.
To exit the function, write the "return" statement explicitly after the "static_throw" statement.
The function including the "static_throw" statements can be marked with the "static_throws" macro.
Void func(Void) static_throws
{
// check the current exception
if (!static_try()) {
// when error occurs:
static_throw(SFERR_FAILED);
return;
}
...
}
// check whether error occurs if (static_try()) { // when no exception occurs: ... } else { // when an exception occurs: ... }
|
Copyright(c) 2002 - 2012 Sophia Cradle Incorporated All Rights Reserved. |
![]() ![]() ![]()
|