![]() ![]() ![]()
|
BREW C++ ライブラリ & GUI フレームワーク & XML ミドルウェア : SophiaFramework UNIVERSE 5.0 |
ARM コンパイラでは、C++ 言語の例外は使えません。
static_exception クラスは C++ 言語と類似の例外処理機構を提供します。
static_exception クラスを使う場合は、static_exception クラスから派生したクラスを作成する必要があります。
テンプレート引数 T には、SFCError 型を処理できるクラスを使用します。
| コンストラクタ/デストラクタ |
|---|
|
static_exception( Void ) static_exception クラスのコンストラクタです。
|
|
~static_exception(
Void
) static_exception クラスのデストラクタです。
|
| パブリック関数 | |
|---|---|
| T const & |
static_catch(
Void
) 現在保持している例外を取得します。
|
| プロテクト関数 | |
|---|---|
| Void |
static_throw(
static_exception< T > const & param
) static_throw( T const & param ) 例外を設定します。
|
| Bool |
static_try(
Void
) 例外が保持されているかどうかを確かめます。
|
[ public, explicit ] static_exception(Void);
例外の値を SFERR_NO_ERROR で初期化します。
[ protected ]
~static_exception(
Void
);[ public, const ]
T const & static_catch(
Void
);
switch (static_catch()) {
// エラーに応じた処理
...
}
[ protected ] Void static_throw( static_exception< T > const & param // コピー元の static_exception オブジェクト );
[ protected ] Void static_throw( T const & param // 設定する例外 );
C++ 言語の throw とは異なり、 static_throw 関数を呼び出しても実行中の関数を抜けることはありません。
関数を抜ける必要がある場合には、明示的に return を記述してください。
また、static_throw 関数を呼び出す関数には、 static_throws マクロを目印に付けることができます。
Void func(Void) static_throws
{
// 現在の例外をチェック
if (!static_try()) {
// エラーが発生している場合
static_throw(SFERR_FAILED);
return;
}
...
}
// 例外が発生したかどうかのチェック if (static_try()) { // 例外が発生していない場合 ... } else { // 例外が発生している場合 ... }
|
Copyright (C) 2002 - 2008 Sophia Cradle Incorporated All Rights Reserved. |
![]() ![]() ![]()
|