Solution46
CAppTestMenuBase.cpp
[詳解]
1 //=============================================================================
2 /// @file
3 /// テストアプリケーションメインメニュー実装ファイル
4 ///
5 /// テストアプリケーションメインメニュー実装ファイルです。
6 ///
7 /// $Id: CAppTestMenuBase.cpp 245 2019-03-20 15:03:41Z admin $
8 /// $Date: 2019-03-21 00:03:41 +0900 (2019/03/21 (木)) $
9 /// $Author: admin $
10 ///
11 /// @attention なし
12 
13 #pragma managed( push, off )
14 
15 //=============================================================================
16 // インクルードファイル
17 #include <CAppTestMenuBase.h>
18 #include <AppTest.h>
19 #include <CConsole.h>
20 
21 //=============================================================================
22 // テストアプリケーション名前空間
23 namespace AppTest {
24  //=========================================================================
25  // テストアプリケーションメニュー基底クラス
26  //=========================================================================
27  // 構築子と解体子
28  //-------------------------------------------------------------------------
29  // コンストラクタ
30  CAppTestMenuBase::CAppTestMenuBase( SMenuInfo const* psMenuInfo ) noexcept
31  // 基底クラスコンストラクタ
32  : CConsoleMenu( psMenuInfo )
33  {}
34 
35  //=========================================================================
36  // 静的公開関数
37  //-------------------------------------------------------------------------
38  // 終了メッセージ出力関数
39  bool CAppTestMenuBase::OutputFinishMessage( wchar_t const* pszFormat, ... ) noexcept {
40  // 引数リストを作成する
41  va_list vaArgs;
42  va_start( vaArgs, pszFormat );
43 
44  // 処理ブロック
45  bool result = false;
46  do {
47  // 書式設定文字列を展開する
48  CString cString;
49  wchar_t const* pszText = cString.FormatArgs( pszFormat, vaArgs );
50  if ( nullptr == pszText ) {
51  // 失敗!
52  break;
53  }
54 
55  // コンソールに行出力する
56  ConsoleLine( pszText );
58 
59  // 成功!
60  result = true;
61  } while ( false );
62 
63  // 引数リストを解放する
64  va_end( vaArgs );
65 
66  // 実行結果を返す
67  return result;
68  }
69 }
70 
71 #pragma managed( pop )
テストアプリケーション名前空間
Definition: AppTest.h:25
テストアプリケーションメニュー基底クラスヘッダファイル
メニュー定義情報構造体
Definition: CConsoleMenu.h:55
#define ConsoleNewLine()
改行出力マクロ
Definition: CConsole.h:29
コンソールメニュークラス
Definition: CConsoleMenu.h:32
コンソール入出力クラスヘッダコンソール
文字列クラス
Definition: CString.h:31
static bool OutputFinishMessage(wchar_t const *pszFormat,...) noexcept
終了メッセージ出力関数
#define ConsoleLine(...)
ヘッダインデントなし書式設定文字列行出力マクロ
Definition: CConsole.h:34
CAppTestMenuBase(SMenuInfo const *psMenuInfo) noexcept
コンストラクタ
テストアプリケーションヘッダファイル
virtual wchar_t const * FormatArgs(wchar_t const *pszFormat, va_list vaArgs) noexcept
引数リスト書式設定文字列代入関数
Definition: CString.cpp:951