Solution46
CStreamOut.h
[詳解]
1 //=============================================================================
2 /// @file
3 /// ストリーム出力クラスヘッダファイル
4 ///
5 /// ストリーム出力クラスヘッダファイルです。
6 ///
7 /// $Id: CStreamOut.h 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 once
14 #pragma managed( push, off )
15 
16 //=============================================================================
17 // インクルードファイル
18 #include <LibCommonDef.h>
19 
20 //=============================================================================
21 // 共通ライブラリ名前空間
22 namespace LibCommon {
23  //=========================================================================
24  /// ストリーム出力クラス
25  ///
26  /// ストリーム出力クラスです。
27  ///
28  /// @attention 抽象クラスです。
29  ///
30  class LIB_COMMON_API CStreamOut abstract {
31  //=====================================================================
32  // 構築子と解体子
33  protected:
34  //---------------------------------------------------------------------
35  /// コンストラクタ
36  ///
37  /// コンストラクタです。
38  ///
39  /// @param なし
40  /// @return なし
41  /// @attention なし
42  ///
43  explicit CStreamOut() noexcept;
44 
45  //---------------------------------------------------------------------
46  /// デストラクタ
47  ///
48  /// デストラクタです。
49  ///
50  /// @param なし
51  /// @return なし
52  /// @attention なし
53  ///
54  virtual ~CStreamOut() noexcept;
55 
56  //=====================================================================
57  // 公開関数
58  public:
59  //---------------------------------------------------------------------
60  /// 文字列出力関数
61  ///
62  /// 文字列出力関数です。
63  ///
64  /// @param[in] pszString 文字列ポインタ
65  /// @return 実行結果
66  /// - true 成功
67  /// - false 失敗
68  /// @attention 純粋仮想関数です。
69  ///
70  virtual bool OutputString( wchar_t const* pszString ) noexcept = 0;
71 
72  //---------------------------------------------------------------------
73  /// 1文字出力関数
74  ///
75  /// 1文字出力関数です。
76  ///
77  /// @param[in] ch 文字コード
78  /// @return 実行結果
79  /// - true 成功
80  /// - false 失敗
81  /// @attention なし
82  ///
83  virtual bool OutputChar( wchar_t ch ) noexcept;
84 
85  //---------------------------------------------------------------------
86  /// 書式設定文字列出力関数
87  ///
88  /// 書式設定文字列出力関数です。
89  ///
90  /// @param[in] pszFormat 書式設定文字列
91  /// @param[in] ... 可変長引数リスト
92  /// @return 実行結果
93  /// - true 成功
94  /// - false 失敗
95  /// @attention なし
96  ///
97  virtual bool OutputFormat( wchar_t const* pszFormat, ... ) noexcept;
98 
99  //---------------------------------------------------------------------
100  /// 引数リスト文字列出力関数
101  ///
102  /// 引数リスト文字列出力関数です。
103  ///
104  /// @param[in] pszFormat 書式設定文字列
105  /// @param[in] vaArgs 引数リスト
106  /// @return 実行結果
107  /// - true 成功
108  /// - false 失敗
109  /// @attention なし
110  ///
111  virtual bool OutputArgs( wchar_t const* pszFormat, va_list vaArgs ) noexcept;
112 
113  //---------------------------------------------------------------------
114  /// 改行出力関数
115  ///
116  /// 改行出力関数です。
117  ///
118  /// @param なし
119  /// @return 実行結果
120  /// - true 成功
121  /// - false 失敗
122  /// @attention なし
123  ///
124  virtual bool OutputNewLine() noexcept;
125 
126  //---------------------------------------------------------------------
127  /// 行ヘッダー出力関数
128  ///
129  /// 行ヘッダー出力関数です。
130  ///
131  /// @param なし
132  /// @return 実行結果
133  /// - true 成功
134  /// - false 失敗
135  /// @attention なし
136  ///
137  virtual bool OutputLineHeader() noexcept;
138 
139  //---------------------------------------------------------------------
140  /// 行番号更新関数
141  ///
142  /// 行番号更新関数です。
143  ///
144  /// @param なし
145  /// @return 実行結果
146  /// - true 成功
147  /// - false 失敗
148  /// @attention なし
149  ///
150  virtual bool UpdateLineNumber() noexcept { ++m_nLine; return true; }
151 
152  //---------------------------------------------------------------------
153  /// 行番号取得関数
154  ///
155  /// 行番号取得関数です。
156  ///
157  /// @param なし
158  /// @return 行番号
159  /// @attention なし
160  ///
161  virtual int GetLineNumber() noexcept { return m_nLine; }
162 
163  //---------------------------------------------------------------------
164  /// インデントカウント取得関数
165  ///
166  /// インデントカウント取得関数です。
167  ///
168  /// @param なし
169  /// @return インデントカウント
170  /// @attention なし
171  ///
172  virtual int GetIndentCount() noexcept { return m_nIndent; }
173 
174  //---------------------------------------------------------------------
175  /// インデント出力関数
176  ///
177  /// インデント出力関数です。
178  ///
179  /// @param なし
180  /// @return 実行結果
181  /// - true 成功
182  /// - false 失敗
183  /// @attention なし
184  ///
185  virtual bool OutputIndent() noexcept;
186 
187  //---------------------------------------------------------------------
188  /// インデント関数
189  ///
190  /// インデント関数です。
191  ///
192  /// @param なし
193  /// @return 実行結果
194  /// - true 成功
195  /// - false 失敗
196  /// @attention なし
197  ///
198  virtual bool Indent() noexcept;
199 
200  //---------------------------------------------------------------------
201  /// アンインデント関数
202  ///
203  /// アンインデント関数です。
204  ///
205  /// @param なし
206  /// @return 実行結果
207  /// - true 成功
208  /// - false 失敗
209  /// @attention なし
210  ///
211  virtual bool Unindent() noexcept;
212 
213  //---------------------------------------------------------------------
214  /// 文字列行出力関数
215  ///
216  /// 文字列行出力関数です。
217  ///
218  /// @param[in] pszString 文字列ポインタ
219  /// @param[in] bHeader 行ヘッダ出力フラグ
220  /// @param[in] bIndent インデント出力フラグ
221  /// @return 実行結果
222  /// - true 成功
223  /// - false 失敗
224  /// @attention なし
225  ///
226  virtual bool OutputLineString( wchar_t const* pszString, bool bHeader = true, bool bIndent = true ) noexcept;
227 
228  //---------------------------------------------------------------------
229  /// 書式設定文字列行出力関数
230  ///
231  /// 書式設定文字列行出力関数です。
232  ///
233  /// @param[in] pszFormat 書式設定文字列
234  /// @param[in] ... 可変長引数リスト
235  /// @return 実行結果
236  /// - true 成功
237  /// - false 失敗
238  /// @attention なし
239  ///
240  virtual bool OutputLineFormat( wchar_t const* pszFormat, ... ) noexcept;
241 
242  //---------------------------------------------------------------------
243  /// 引数リスト文字列行出力関数
244  ///
245  /// 引数リスト文字列行出力関数です。
246  ///
247  /// @param[in] pszFormat 書式設定文字列
248  /// @param[in] vaArgs 引数リスト
249  /// @return 実行結果
250  /// - true 成功
251  /// - false 失敗
252  /// @attention なし
253  ///
254  virtual bool OutputLineArgs( wchar_t const* pszFormat, va_list vaArgs ) noexcept;
255 
256  //---------------------------------------------------------------------
257  /// 拡張書式設定文字列行出力関数
258  ///
259  /// 拡張書式設定文字列行出力関数です。
260  ///
261  /// @param[in] bHeader 行ヘッダ出力フラグ
262  /// @param[in] bIndent インデント出力フラグ
263  /// @param[in] pszFormat 書式設定文字列
264  /// @param[in] ... 可変長引数リスト
265  /// @return 実行結果
266  /// - true 成功
267  /// - false 失敗
268  /// @attention なし
269  ///
270  virtual bool ExOutputLineFormat( bool bHeader, bool bIndent, wchar_t const* pszFormat, ... ) noexcept;
271 
272  //---------------------------------------------------------------------
273  /// 拡張引数リスト文字列行出力関数
274  ///
275  /// 拡張引数リスト文字列行出力関数です。
276  ///
277  /// @param[in] bHeader 行ヘッダ出力フラグ
278  /// @param[in] bIndent インデント出力フラグ
279  /// @param[in] pszFormat 書式設定文字列
280  /// @param[in] vaArgs 引数リスト
281  /// @return 実行結果
282  /// - true 成功
283  /// - false 失敗
284  /// @attention なし
285  ///
286  virtual bool ExOutputLineArgs( bool bHeader, bool bIndent, wchar_t const* pszFormat, va_list vaArgs ) noexcept;
287 
288  //=====================================================================
289  // 静的限定公開定数
290  protected:
291  static int const FORMAT_BUFFER_SIZE = ( 2048 - 1 ); ///< 書式設定文字列バッファサイズ
292 
293  //=====================================================================
294  // 限定公開変数
295  protected:
296  int m_nLine; ///< 行番号
297  int m_nIndent; ///< インデントカウント
298 
299  //=====================================================================
300  // 削除関数
301  private:
302  CStreamOut( CStreamOut const& ) = delete;
303  CStreamOut& operator=( CStreamOut const& ) = delete;
304  };
305 }
306 
307 #pragma managed( pop )
virtual bool UpdateLineNumber() noexcept
行番号更新関数
Definition: CStreamOut.h:150
int m_nIndent
インデントカウント
Definition: CStreamOut.h:297
int m_nLine
行番号
Definition: CStreamOut.h:296
共通ライブラリ定義ヘッダファイル
共通ライブラリ名前空間
Definition: CArray.h:23
virtual int GetLineNumber() noexcept
行番号取得関数
Definition: CStreamOut.h:161
ストリーム出力クラス
Definition: CStreamOut.h:30
#define LIB_COMMON_API
ダイナミックライブラリインポート宣言
Definition: LibCommonDef.h:44
virtual int GetIndentCount() noexcept
インデントカウント取得関数
Definition: CStreamOut.h:172