前回までの記事
- C++Builder XEでCodeSite Expressを使用する(1)Live Logging チュートリアル
- C++Builder XEでCodeSite Expressを使用する(2)File Logging チュートリアル
- C++Builder XEでCodeSite Expressを使用する(3)CodeSite Live/File Viewreのログを見やすくする
C++Builder XEのCodeSite Expressで使える主要なメソッドをまとめます。
AddCheckPoint
チェックポイントカウンターを増加し、その値をCheckPointメッセージとして送ります。
for (int i = 0; i < 10; ++i)
{
CodeSite->AddCheckPoint();
}
ResetCheckPoint
チェックポイントカウンターを0に戻します。
CodeSite->AddCheckPoint();
CodeSite->AddCheckPoint();
CodeSite->ResetCheckPoint();
CodeSite->AddCheckPoint();
CodeSite->AddCheckPoint();
CodeSite->ResetCheckPoint();
SendDateTime
日時の値を送ります。
CodeSite->SendDateTime("SendDateTime", TDateTime(2011, 1, 2, 3, 4, 5, 6));
SendError
Errorメッセージを送ります。
CodeSite->SendError("エラーメッセージ");
//書式付き
CodeSite->SendError("フォーマット %s %d", ARRAYOFCONST(("テキスト", 1)));
SendException
ExceptionオブジェクトをExceptionメッセージとして送ります。
try {
StrToInt("A");
} catch (Exception& E) {
CodeSite->SendException(&E);
}
SendFmtMsg
書式付きメッセージを送ります。
CodeSite->SendFmtMsg("フォーマット %s %d", ARRAYOFCONST(("テキスト", 1)));
SendReminder
Reminderメッセージを送ります。
CodeSite->SendReminder("Reminderメッセージ");
CodeSite->SendReminder("Reminderメッセージ %s %d", ARRAYOFCONST(("テキスト", 1)));
SendWarning
Warningメッセージを送ります。
CodeSite->SendWarning("Warningメッセージ");
CodeSite->SendWarning("Warningメッセージ %s %d", ARRAYOFCONST(("テキスト", 1)));
Assert
Expressionがfalseのとき、Errorメッセージを送ります。
bool expression = false;
CodeSite->Assert(expression, "false");
expression = true;
CodeSite->Assert(expression, "true");
Clear
すべてのメッセージをクリアします。
CodeSite->Clear();
ExceptionHandler
キャッチされなかった例外のメッセージを自動的にCodeSiteに送ります。
Application->OnException = CodeSite->ExceptionHandler;
EnterMethod / ExitMethod
EnterMethodはメソッドの開始地点を示します。
ExitMethodはメソッドの終了地点を示します。
CodeSite Live/File Viewreでは、メソッドのログがインデントされて表示されます。
CodeSite->EnterMethod("Button1Click");
CodeSite->Send("test");
CodeSite->ExitMethod("Button1Click");
Installed
CodeSite Toolsがシステムにインストールされているかどうかを調べます。
if (CodeSite->Installed()) {
ShowMessage("インストールされています。");
} else {
ShowMessage("インストールされていません。");
}