Solution46
CJsonConfig.h
[詳解]
1 //=============================================================================
2 /// @file
3 /// JSON構成情報クラスヘッダファイル
4 ///
5 /// JSON構成情報クラスヘッダファイルです。
6 ///
7 /// $Id: CJsonConfig.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 <CJsonDocument.h>
19 #include <initializer_list>
20 
21 //=============================================================================
22 // JSONライブラリ名前空間
23 namespace LibJson {
24  //=========================================================================
25  /// JSON構成情報クラス
26  ///
27  /// JSON構成情報クラスです。
28  ///
29  /// @attention なし
30  ///
32  //=====================================================================
33  // 構築子と解体子
34  public:
35  //---------------------------------------------------------------------
36  /// コンストラクタ
37  ///
38  /// コンストラクタです。
39  ///
40  /// @param なし
41  /// @return なし
42  /// @attention なし
43  ///
44  explicit CJsonConfig() noexcept;
45 
46  //---------------------------------------------------------------------
47  /// デストラクタ
48  ///
49  /// デストラクタです。
50  ///
51  /// @param なし
52  /// @return なし
53  /// @attention なし
54  ///
55  virtual ~CJsonConfig() noexcept {}
56 
57  //=====================================================================
58  // 公開関数
59  public:
60  //---------------------------------------------------------------------
61  /// 構成ファイルロード関数
62  ///
63  /// 構成ファイルロード関数です。
64  ///
65  /// @param[in] pszPath ファイルパス
66  /// @return 実行結果
67  /// - true 成功
68  /// - false 失敗
69  /// @attention なし
70  ///
71  virtual bool Load( wchar_t const* pszPath ) noexcept;
72 
73  //---------------------------------------------------------------------
74  /// 構成ファイルセーブ関数
75  ///
76  /// 構成ファイルセーブ関数です。
77  ///
78  /// @param[in] pszPath ファイルパス
79  /// @return 実行結果
80  /// - true 成功
81  /// - false 失敗
82  /// @attention なし
83  ///
84  virtual bool Save( wchar_t const* pszPath ) noexcept;
85 
86  //---------------------------------------------------------------------
87  /// JSONパス取得関数
88  ///
89  /// JSONパス取得関数です。
90  ///
91  /// @param[out] rcPath 文字列参照
92  /// @param[in] pszKey キー文字列
93  /// @param[in] nIndex インデックス
94  /// @return 実行結果
95  /// - true 成功
96  /// - false 失敗
97  /// @attention なし
98  ///
99  virtual bool GetPath( CString& rcPath, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
100 
101  //---------------------------------------------------------------------
102  /// キー設定値削除関数
103  ///
104  /// キー設定値削除関数です。
105  ///
106  /// @param[in] pszKey キー文字列
107  /// @param[in] nIndex インデックス
108  /// @return 実行結果
109  /// - true 成功
110  /// - false 失敗
111  /// @attention なし
112  ///
113  virtual bool Delete( wchar_t const* pszKey, int nIndex = -1 ) noexcept;
114 
115  //---------------------------------------------------------------------
116  /// 整数型設定値取得関数
117  ///
118  /// 整数型設定値取得関数です。
119  ///
120  /// @param[out] rnValue 整数型参照
121  /// @param[in] pszKey キー文字列
122  /// @param[in] nIndex インデックス
123  /// @return 実行結果
124  /// - true 成功
125  /// - false 失敗
126  /// @attention なし
127  ///
128  virtual bool Get( int& rnValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
129 
130  //---------------------------------------------------------------------
131  /// 整数型設定値設定関数
132  ///
133  /// 整数型設定値設定関数です。
134  ///
135  /// @param[in] nValue 整数型設定値
136  /// @param[in] pszKey キー文字列
137  /// @param[in] nIndex インデックス
138  /// @return 実行結果
139  /// - true 成功
140  /// - false 失敗
141  /// @attention なし
142  ///
143  virtual bool Set( int nValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
144 
145  //---------------------------------------------------------------------
146  /// 整数型設定値取得関数
147  ///
148  /// 整数型設定値取得関数です。
149  ///
150  /// @param[in] rpnValueList 整数型ポインタリスト参照
151  /// @param[in] pszKey キー文字列
152  /// @return 実行結果
153  /// - true 成功
154  /// - false 失敗
155  /// @attention なし
156  ///
157  virtual bool Get( std::initializer_list< int* > const& rpnValueList, wchar_t const* pszKey = nullptr ) noexcept;
158 
159  //---------------------------------------------------------------------
160  /// 整数型設定値設定関数
161  ///
162  /// 整数型設定値設定関数です。
163  ///
164  /// @param[in] rnValueList 整数型設定値リスト参照
165  /// @param[in] pszKey キー文字列
166  /// @return 実行結果
167  /// - true 成功
168  /// - false 失敗
169  /// @attention なし
170  ///
171  virtual bool Set( std::initializer_list< int > const& rnValueList, wchar_t const* pszKey = nullptr ) noexcept;
172 
173  //---------------------------------------------------------------------
174  /// JSON設定値浮動小数取得関数
175  ///
176  /// JSON設定値浮動小数取得関数です。
177  ///
178  /// @param[out] rfValue 浮動小数参照
179  /// @param[in] pszKey キー文字列
180  /// @param[in] nIndex インデックス
181  /// @return 実行結果
182  /// - true 成功
183  /// - false 失敗
184  /// @attention なし
185  ///
186  virtual bool Get( double& rfValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
187 
188  //---------------------------------------------------------------------
189  /// JSON設定値浮動小数設定関数
190  ///
191  /// JSON設定値浮動小数設定関数です。
192  ///
193  /// @param[in] fValue 設定値浮動小数
194  /// @param[in] pszKey キー文字列
195  /// @param[in] nIndex インデックス
196  /// @return 実行結果
197  /// - true 成功
198  /// - false 失敗
199  /// @attention なし
200  ///
201  virtual bool Set( double fValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
202 
203  //---------------------------------------------------------------------
204  /// JSON設定値真理値取得関数
205  ///
206  /// JSON設定値真理値取得関数です。
207  ///
208  /// @param[out] rbValue 真理値参照
209  /// @param[in] pszKey キー文字列
210  /// @param[in] nIndex インデックス
211  /// @return 実行結果
212  /// - true 成功
213  /// - false 失敗
214  /// @attention なし
215  ///
216  virtual bool Get( bool& rbValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
217 
218  //---------------------------------------------------------------------
219  /// JSON設定値真理値設定関数
220  ///
221  /// JSON設定値真理値設定関数です。
222  ///
223  /// @param[in] bValue 設定値真理値
224  /// @param[in] pszKey キー文字列
225  /// @param[in] nIndex インデックス
226  /// @return 実行結果
227  /// - true 成功
228  /// - false 失敗
229  /// @attention なし
230  ///
231  virtual bool Set( bool bValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
232 
233  //---------------------------------------------------------------------
234  /// JSON設定値文字列取得関数
235  ///
236  /// JSON設定値文字列取得関数です。
237  ///
238  /// @param[out] rcValue 文字列参照
239  /// @param[in] pszKey キー文字列
240  /// @param[in] nIndex インデックス
241  /// @return 実行結果
242  /// - true 成功
243  /// - false 失敗
244  /// @attention なし
245  ///
246  virtual bool Get( CString& rcValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
247 
248  //---------------------------------------------------------------------
249  /// JSON設定値文字列設定関数
250  ///
251  /// JSON設定値文字列設定関数です。
252  ///
253  /// @param[in] pszValue 設定値文字列
254  /// @param[in] pszKey キー文字列
255  /// @param[in] nIndex インデックス
256  /// @return 実行結果
257  /// - true 成功
258  /// - false 失敗
259  /// @attention なし
260  ///
261  virtual bool Set( wchar_t const* pszValue, wchar_t const* pszKey = nullptr, int nIndex = -1 ) noexcept;
262 
263  //---------------------------------------------------------------------
264  /// ウィンドウ表示位置復元関数
265  ///
266  /// ウィンドウ表示位置復元関数です。
267  ///
268  /// @param[in] hWnd ウィンドウハンドル
269  /// @param[in] pszKey キー文字列
270  /// @return 実行結果
271  /// - true 成功
272  /// - false 失敗
273  /// @attention なし
274  ///
275  virtual bool ResumeWindowPosition( HWND hWnd, wchar_t const* pszKey = KEY_WINDOW_POS ) noexcept;
276 
277  //---------------------------------------------------------------------
278  /// ウィンドウ表示位置保存関数
279  ///
280  /// ウィンドウ表示位置保存関数です。
281  ///
282  /// @param[in] hWnd ウィンドウハンドル
283  /// @param[in] pszKey キー文字列
284  /// @return 実行結果
285  /// - true 成功
286  /// - false 失敗
287  /// @attention なし
288  ///
289  virtual bool SaveWindowPosition( HWND hWnd, wchar_t const* pszKey = KEY_WINDOW_POS ) noexcept;
290 
291  //---------------------------------------------------------------------
292  /// ウィンドウ表示状態復元関数
293  ///
294  /// ウィンドウ表示状態復元関数です。
295  ///
296  /// @param[in] hWnd ウィンドウハンドル
297  /// @param[in] pszKey キー文字列
298  /// @return 実行結果
299  /// - true 成功
300  /// - false 失敗
301  /// @attention なし
302  ///
303  virtual bool ResumeShowWindow( HWND hWnd, wchar_t const* pszKey = KEY_SHOW_WINDOW ) noexcept;
304 
305  //---------------------------------------------------------------------
306  /// ウィンドウ表示状態保存関数
307  ///
308  /// ウィンドウ表示状態保存関数です。
309  ///
310  /// @param[in] hWnd ウィンドウハンドル
311  /// @param[in] pszKey キー文字列
312  /// @return 実行結果
313  /// - true 成功
314  /// - false 失敗
315  /// @attention なし
316  ///
317  virtual bool SaveShowWindow( HWND hWnd, wchar_t const* pszKey = KEY_SHOW_WINDOW ) noexcept;
318 
319  //---------------------------------------------------------------------
320  /// ウィンドウ表示状態取得関数
321  ///
322  /// ウィンドウ表示状態取得関数です。
323  ///
324  /// @param[in] hWnd ウィンドウハンドル
325  /// @param[out] rbVisible WS_VISIBLEスタイルフラグ参照
326  /// @param[out] rnShow 表示状態参照
327  /// @param[in] pszKey キー文字列
328  /// @return 実行結果
329  /// - true 成功
330  /// - false 失敗
331  /// @attention なし
332  ///
333  virtual bool GetShowWindow( HWND hWnd, bool& rbVisible, int& rnShow, wchar_t const* pszKey = KEY_SHOW_WINDOW ) noexcept;
334 
335  //---------------------------------------------------------------------
336  /// ウィンドウ表示状態設定関数
337  ///
338  /// ウィンドウ表示状態設定関数です。
339  ///
340  /// @param[in] hWnd ウィンドウハンドル
341  /// @param[in] bVisible WS_VISIBLEスタイルフラグ
342  /// @param[in] nShow 表示状態
343  /// @param[in] pszKey キー文字列
344  /// @return 実行結果
345  /// - true 成功
346  /// - false 失敗
347  /// @attention なし
348  ///
349  virtual bool SetShowWindow( HWND hWnd, bool bVisible, int nShow, wchar_t const* pszKey = KEY_SHOW_WINDOW ) noexcept;
350 
351  //=====================================================================
352  // 静的公開文字列定数
353  public:
354  static wchar_t const* const KEY_WINDOW_POS; ///< ウィンドウ表示位置キー文字列
355  static wchar_t const* const KEY_SHOW_WINDOW; ///< ウィンドウ表示状態キー文字列
356 
357  //=====================================================================
358  // 削除関数
359  private:
360  CJsonConfig( CJsonConfig const& ) = delete;
361  CJsonConfig& operator=( CJsonConfig const& ) = delete;
362  };
363 }
364 
365 #pragma managed( pop )
JSONドキュメントクラス
Definition: CJsonDocument.h:32
JSONライブラリ名前空間
Definition: CJson.h:24
JSONドキュメントクラスヘッダファイル
JSON構成情報クラス
Definition: CJsonConfig.h:31
static wchar_t const *const KEY_WINDOW_POS
ウィンドウ表示位置キー文字列
Definition: CJsonConfig.h:354
virtual ~CJsonConfig() noexcept
デストラクタ
Definition: CJsonConfig.h:55
文字列クラス
Definition: CString.h:31
#define LIB_JSON_API
ダイナミックライブラリインポート宣言
Definition: LibJsonDef.h:29
static wchar_t const *const KEY_SHOW_WINDOW
ウィンドウ表示状態キー文字列
Definition: CJsonConfig.h:355