Solution46
LibJson::CJsonConfig クラス

JSON構成情報クラス [詳解]

#include "CJsonConfig.h"

LibJson::CJsonConfig の継承関係図
Inheritance graph
LibJson::CJsonConfig 連携図
Collaboration graph

公開メンバ関数

 CJsonConfig () noexcept
 コンストラクタ [詳解]
 
virtual ~CJsonConfig () noexcept
 デストラクタ [詳解]
 
virtual bool Load (wchar_t const *pszPath) noexcept
 構成ファイルロード関数 [詳解]
 
virtual bool Save (wchar_t const *pszPath) noexcept
 構成ファイルセーブ関数 [詳解]
 
virtual bool GetPath (CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSONパス取得関数 [詳解]
 
virtual bool Delete (wchar_t const *pszKey, int nIndex=-1) noexcept
 キー設定値削除関数 [詳解]
 
virtual bool Get (int &rnValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 整数型設定値取得関数 [詳解]
 
virtual bool Set (int nValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 整数型設定値設定関数 [詳解]
 
virtual bool Get (std::initializer_list< int * > const &rpnValueList, wchar_t const *pszKey=nullptr) noexcept
 整数型設定値取得関数 [詳解]
 
virtual bool Set (std::initializer_list< int > const &rnValueList, wchar_t const *pszKey=nullptr) noexcept
 整数型設定値設定関数 [詳解]
 
virtual bool Get (double &rfValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSON設定値浮動小数取得関数 [詳解]
 
virtual bool Set (double fValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSON設定値浮動小数設定関数 [詳解]
 
virtual bool Get (bool &rbValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSON設定値真理値取得関数 [詳解]
 
virtual bool Set (bool bValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSON設定値真理値設定関数 [詳解]
 
virtual bool Get (CString &rcValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSON設定値文字列取得関数 [詳解]
 
virtual bool Set (wchar_t const *pszValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
 JSON設定値文字列設定関数 [詳解]
 
virtual bool ResumeWindowPosition (HWND hWnd, wchar_t const *pszKey=KEY_WINDOW_POS) noexcept
 ウィンドウ表示位置復元関数 [詳解]
 
virtual bool SaveWindowPosition (HWND hWnd, wchar_t const *pszKey=KEY_WINDOW_POS) noexcept
 ウィンドウ表示位置保存関数 [詳解]
 
virtual bool ResumeShowWindow (HWND hWnd, wchar_t const *pszKey=KEY_SHOW_WINDOW) noexcept
 ウィンドウ表示状態復元関数 [詳解]
 
virtual bool SaveShowWindow (HWND hWnd, wchar_t const *pszKey=KEY_SHOW_WINDOW) noexcept
 ウィンドウ表示状態保存関数 [詳解]
 
virtual bool GetShowWindow (HWND hWnd, bool &rbVisible, int &rnShow, wchar_t const *pszKey=KEY_SHOW_WINDOW) noexcept
 ウィンドウ表示状態取得関数 [詳解]
 
virtual bool SetShowWindow (HWND hWnd, bool bVisible, int nShow, wchar_t const *pszKey=KEY_SHOW_WINDOW) noexcept
 ウィンドウ表示状態設定関数 [詳解]
 
- 基底クラス LibJson::CJsonDocument に属する継承公開メンバ関数
 CJsonDocument (CJson *pcJson=nullptr) noexcept
 コンストラクタ [詳解]
 
virtual ~CJsonDocument () noexcept
 デストラクタ [詳解]
 
virtual bool IsEmpty () noexcept
 空状態取得関数 [詳解]
 
virtual CJsonGetRootJson () noexcept
 ルートJSONクラス取得関数 [詳解]
 
virtual bool SetRootJson (CJson *pcJson) noexcept
 ルートJSONクラス設定関数 [詳解]
 
virtual CJsonGetCurrentJson () noexcept
 カレントJSONクラス取得関数 [詳解]
 
virtual bool SetCurrentJson (CJson *pcJson) noexcept
 カレントJSONクラス設定関数 [詳解]
 
virtual void ClearDocument () noexcept
 クリア関数 [詳解]
 
virtual bool CompactDocument () noexcept
 コンパクト化関数 [詳解]
 
virtual bool InputDocument (CStream &rcStream) noexcept
 JSONドキュメント入力関数 [詳解]
 
virtual bool OutputDocument (CStreamOut &rcStreamOut) noexcept
 JSONドキュメント出力関数 [詳解]
 
virtual bool DeleteCurrentJson () noexcept
 カレントJSONクラス削除関数 [詳解]
 
virtual bool GetCurrentPath (CString &rcPath) noexcept
 カレントパス取得関数 [詳解]
 
virtual bool SetCurrentPath (wchar_t const *pszPath) noexcept
 カレントパス設定関数 [詳解]
 
virtual bool GetCurrentSetValue (CString &rcValue, bool bClassName=false, bool bQuotes=true) noexcept
 カレント設定値文字列取得関数 [詳解]
 
virtual bool SetCurrentSetValue (wchar_t const *pszValue) noexcept
 カレント設定値文字列設定関数 [詳解]
 
virtual bool CreatePath (wchar_t const *pszPath) noexcept
 JSONパス作成関数 [詳解]
 

静的公開変数類

static wchar_t const *const KEY_WINDOW_POS = L"ウィンドウ表示位置"
 ウィンドウ表示位置キー文字列 [詳解]
 
static wchar_t const *const KEY_SHOW_WINDOW = L"ウィンドウ表示状態"
 ウィンドウ表示状態キー文字列 [詳解]
 

非公開メンバ関数

 CJsonConfig (CJsonConfig const &)=delete
 
CJsonConfigoperator= (CJsonConfig const &)=delete
 

その他の継承メンバ

- 基底クラス LibJson::CJsonDocument に属する継承静的公開メンバ関数
static bool GetJsonPath (CString &rcPath, CJson *pcJson) noexcept
 JSONパス取得関数 [詳解]
 
static CJsonFindJsonPath (wchar_t const *pszPath, CJson *pcJson) noexcept
 JSONパス検索関数 [詳解]
 
static bool GetJsonSetValue (CString &rcValue, CJson *pcJson, bool bClassName=false, bool bQuotes=true) noexcept
 JSON設定値文字列取得関数 [詳解]
 
static bool SetJsonSetValue (wchar_t const *pszValue, CJson *&rpcJson) noexcept
 JSON設定値設定関数 [詳解]
 
static bool SetJsonSetValueByStream (CStream &rcStream, CJson *&rpcJson) noexcept
 JSON設定値ストリーム設定関数 [詳解]
 
static bool DeleteJson (CJson *&rpcJson) noexcept
 JSONクラス削除関数 [詳解]
 
static bool CreateJsonPath (wchar_t const *pszPath, CJson *&rpcJson) noexcept
 JSONパス作成関数 [詳解]
 
static bool GetJsonPathList (CString &rcPathList, CJson *pcJson) noexcept
 JSONパスリスト取得関数 [詳解]
 
- 基底クラス LibJson::CJsonDocument に属する継承限定公開型
enum  EJsonPathToken {
  EJsonPathToken::Invalid, EJsonPathToken::Separator, EJsonPathToken::Dot, EJsonPathToken::DotDot,
  EJsonPathToken::Name, EJsonPathToken::Index, EJsonPathToken::Equal, EJsonPathToken::Size
}
 JSONパストークン種別列挙体 [詳解]
 
- 基底クラス LibJson::CJsonDocument に属する継承静的限定公開メンバ関数
static EJsonPathToken InputPathToken (CStream &rcStream, CString &rcString, bool bEqual=false) noexcept
 JSONパストークン入力関数 [詳解]
 
static bool DeleteQuotes (CString &rcString) noexcept
 JSON文字列二重引用符削除関数 [詳解]
 
- 基底クラス LibJson::CJsonDocument に属する継承限定公開変数類
CJsonm_pcJsonRoot
 ルートJSONクラスポインタ [詳解]
 
CJsonm_pcJsonCurrent
 カレントJSONクラスポインタ [詳解]
 

詳解

JSON構成情報クラス

JSON構成情報クラスです。

注意
なし

CJsonConfig.h31 行目に定義があります。

構築子と解体子

LibJson::CJsonConfig::CJsonConfig ( )
explicitnoexcept

コンストラクタ

コンストラクタです。

引数
なし
戻り値
なし
注意
なし

CJsonConfig.cpp32 行目に定義があります。

34  : CJsonDocument()
35  {}
CJsonDocument(CJson *pcJson=nullptr) noexcept
コンストラクタ
virtual LibJson::CJsonConfig::~CJsonConfig ( )
inlinevirtualnoexcept

デストラクタ

デストラクタです。

引数
なし
戻り値
なし
注意
なし

CJsonConfig.h55 行目に定義があります。

55 {}
LibJson::CJsonConfig::CJsonConfig ( CJsonConfig const &  )
privatedelete

関数詳解

bool LibJson::CJsonConfig::Load ( wchar_t const *  pszPath)
virtualnoexcept

構成ファイルロード関数

構成ファイルロード関数です。

引数
[in]pszPathファイルパス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp41 行目に定義があります。

参照先 LibJson::CJsonDocument::InputDocument(), LogOutFooter, LogOutHeader, NewDelLogOut, LibCommon::CFile::Open().

41  {
42  LogOutHeader();
43  // NewDelLogOut() = true;
44 
45  // 処理ブロック
46  bool result = false;
47  do {
48  // ファイルをオープンする
49  CFileStream cFile;
50  if ( !cFile.Open( pszPath ) ) {
51  // 失敗!
52  break;
53  }
54  // JSONドキュメントを入力する
55  else if ( !InputDocument( cFile ) ) {
56  // 失敗!
57  break;
58  }
59 
60  // 成功!
61  result = true;
62  } while ( false );
63 
64  NewDelLogOut() = false;
65  LogOutFooter();
66 
67  // 実行結果を返す
68  return result;
69  }
#define LogOutHeader()
関数ヘッダマクロ
Definition: LibLogOut.h:47
#define LogOutFooter()
関数フッタマクロ
Definition: LibLogOut.h:50
#define NewDelLogOut()
ログ出力許可フラグ取得マクロ
Definition: LibNewDel.h:26
virtual bool InputDocument(CStream &rcStream) noexcept
JSONドキュメント入力関数

呼び出し関係図:

bool LibJson::CJsonConfig::Save ( wchar_t const *  pszPath)
virtualnoexcept

構成ファイルセーブ関数

構成ファイルセーブ関数です。

引数
[in]pszPathファイルパス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp73 行目に定義があります。

参照先 LibCommon::CFile::Create(), LogOutFooter, LogOutHeader, NewDelLogOut, LibJson::CJsonDocument::OutputDocument().

参照元 AppTest::CAppTest::~CAppTest().

73  {
74  LogOutHeader();
75  // NewDelLogOut() = true;
76 
77  // 処理ブロック
78  bool result = false;
79  do {
80  // ファイルを作成する
81  CFileStream cFile;
82  if ( !cFile.Create( pszPath ) ) {
83  // 失敗!
84  break;
85  }
86  // JSONドキュメントを出力する
87  else if ( !OutputDocument( cFile ) ) {
88  // 失敗!
89  break;
90  }
91 
92  // 成功!
93  result = true;
94  } while ( false );
95 
96  NewDelLogOut() = false;
97  LogOutFooter();
98 
99  // 実行結果を返す
100  return result;
101  }
#define LogOutHeader()
関数ヘッダマクロ
Definition: LibLogOut.h:47
#define LogOutFooter()
関数フッタマクロ
Definition: LibLogOut.h:50
virtual bool OutputDocument(CStreamOut &rcStreamOut) noexcept
JSONドキュメント出力関数
#define NewDelLogOut()
ログ出力許可フラグ取得マクロ
Definition: LibNewDel.h:26

呼び出し関係図:

被呼び出し関係図:

bool LibJson::CJsonConfig::GetPath ( CString rcPath,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSONパス取得関数

JSONパス取得関数です。

引数
[out]rcPath文字列参照
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp105 行目に定義があります。

参照先 LibCommon::CString::Format().

参照元 Delete(), Get(), Set().

105  {
106  // 処理ブロック
107  bool result = false;
108  do {
109  // キー文字列ポインタを調べる
110  rcPath = L"";
111  if ( nullptr != pszKey ) {
112  // キー文字列を追加する
113  rcPath += pszKey;
114  }
115 
116  // インデックスを調べる
117  if ( 0 <= nIndex ) {
118  // 配列添字文字列を追加する
119  rcPath += CString().Format( L"[%d]", nIndex );
120  }
121 
122  // 成功!
123  result = true;
124  } while ( false );
125 
126  // 実行結果を返す
127  return result;
128  }

呼び出し関係図:

被呼び出し関係図:

bool LibJson::CJsonConfig::Delete ( wchar_t const *  pszKey,
int  nIndex = -1 
)
virtualnoexcept

キー設定値削除関数

キー設定値削除関数です。

引数
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp132 行目に定義があります。

参照先 LibJson::CJsonDocument::DeleteJson(), LibJson::CJsonDocument::FindJsonPath(), GetPath(), LibJson::CJsonDocument::m_pcJsonCurrent.

参照元 AppTest::CAppTest::~CAppTest().

132  {
133  // 処理ブロック
134  bool result = false;
135  do {
136  // JSONパスを取得する
137  CString cPath;
138  if ( !GetPath( cPath, pszKey, nIndex ) ) {
139  // 失敗!
140  break;
141  }
142 
143  // JSONパスを検索する
144  CJson* pcJson = FindJsonPath( cPath, m_pcJsonCurrent );
145  if ( nullptr == pcJson ) {
146  // 失敗!
147  break;
148  }
149  // JSONクラスを削除する
150  else if ( !DeleteJson( pcJson ) ) {
151  // 失敗!
152  break;
153  }
154 
155  // 成功!
156  result = true;
157  } while ( false );
158 
159  // 実行結果を返す
160  return result;
161  }
static CJson * FindJsonPath(wchar_t const *pszPath, CJson *pcJson) noexcept
JSONパス検索関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数
CJson * m_pcJsonCurrent
カレントJSONクラスポインタ
static bool DeleteJson(CJson *&rpcJson) noexcept
JSONクラス削除関数

呼び出し関係図:

被呼び出し関係図:

bool LibJson::CJsonConfig::Get ( int &  rnValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

整数型設定値取得関数

整数型設定値取得関数です。

引数
[out]rnValue整数型参照
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp165 行目に定義があります。

参照先 LibJson::CJsonDocument::FindJsonPath(), LibJson::CJsonDocument::GetJsonSetValue(), GetPath(), LibJson::CJson::IsJsonNumber(), LibJson::CJsonDocument::m_pcJsonCurrent.

参照元 GetShowWindow(), LibWindow::CWndList::InitElementListConfig(), ResumeWindowPosition().

165  {
166  // 処理ブロック
167  bool result = false;
168  do {
169  // JSONパスを取得する
170  CString cPath;
171  if ( !GetPath( cPath, pszKey, nIndex ) ) {
172  // 失敗!
173  break;
174  }
175 
176  // JSONパスを検索する
177  CJson* pcJson = FindJsonPath( cPath, m_pcJsonCurrent );
178  if ( nullptr == pcJson ) {
179  // 失敗!
180  break;
181  }
182  // JSONクラス種別を調べる
183  else if ( !pcJson->IsJsonNumber() ) {
184  // 失敗!
185  break;
186  }
187 
188  // JSON設定値文字列を取得する
189  CString cValue;
190  if ( !GetJsonSetValue( cValue, pcJson, false, false ) ) {
191  // 失敗!
192  break;
193  }
194 
195  // 整数を取得する
196  rnValue = ::wcstol( cValue, nullptr, 10 );
197 
198  // 成功!
199  result = true;
200  } while ( false );
201 
202  // 実行結果を返す
203  return result;
204  }
static bool GetJsonSetValue(CString &rcValue, CJson *pcJson, bool bClassName=false, bool bQuotes=true) noexcept
JSON設定値文字列取得関数
static CJson * FindJsonPath(wchar_t const *pszPath, CJson *pcJson) noexcept
JSONパス検索関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数
CJson * m_pcJsonCurrent
カレントJSONクラスポインタ

呼び出し関係図:

被呼び出し関係図:

bool LibJson::CJsonConfig::Set ( int  nValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

整数型設定値設定関数

整数型設定値設定関数です。

引数
[in]nValue整数型設定値
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp208 行目に定義があります。

参照先 LibJson::CJsonDocument::CreatePath(), LibCommon::CString::Format(), GetPath().

参照元 LibWindow::CWndList::SaveElementListConfig(), SaveWindowPosition(), SetShowWindow(), AppTest::CAppTest::~CAppTest().

208  {
209  // 処理ブロック
210  bool result = false;
211  do {
212  // JSONパスを取得する
213  CString cPath;
214  if ( !GetPath( cPath, pszKey, nIndex ) ) {
215  // 失敗!
216  break;
217  }
218 
219  // 整数型設定値を追加する
220  cPath += L" = ";
221  cPath += CString().Format( L"%d", nValue );
222 
223  // JSONパスを作成する
224  if ( !CreatePath( cPath ) ) {
225  // 失敗!
226  break;
227  }
228 
229  // 成功!
230  result = true;
231  } while ( false );
232 
233  // 実行結果を返す
234  return result;
235  }
virtual bool CreatePath(wchar_t const *pszPath) noexcept
JSONパス作成関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数

呼び出し関係図:

被呼び出し関係図:

bool LibJson::CJsonConfig::Get ( std::initializer_list< int * > const &  rpnValueList,
wchar_t const *  pszKey = nullptr 
)
virtualnoexcept

整数型設定値取得関数

整数型設定値取得関数です。

引数
[in]rpnValueList整数型ポインタリスト参照
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp239 行目に定義があります。

参照先 LibJson::CJsonDocument::FindJsonPath(), LibJson::CJsonDocument::GetJsonSetValue(), GetPath(), LibJson::CJson::IsJsonNumber(), LibJson::CJsonDocument::m_pcJsonCurrent.

239  {
240  // 処理ブロック
241  bool result = false;
242  do {
243  // 巡回する
244  int nIndex = 0;
245  for ( auto pcIter = rpnValueList.begin();; ++pcIter, ++nIndex ) {
246  // イテレータを調べる
247  if ( rpnValueList.end() == pcIter ) {
248  // 成功!
249  result = true;
250  break;
251  }
252 
253  // JSONパスを取得する
254  CString cPath;
255  if ( !GetPath( cPath, pszKey, nIndex ) ) {
256  // 失敗!
257  break;
258  }
259 
260  // JSONパスを検索する
261  CJson* pcJson = FindJsonPath( cPath, m_pcJsonCurrent );
262  if ( nullptr == pcJson ) {
263  // 失敗!
264  break;
265  }
266  // JSONクラス種別を調べる
267  else if ( !pcJson->IsJsonNumber() ) {
268  // 失敗!
269  break;
270  }
271 
272  // JSON設定値文字列を取得する
273  CString cValue;
274  if ( !GetJsonSetValue( cValue, pcJson, false, false ) ) {
275  // 失敗!
276  break;
277  }
278 
279  // 整数を取得する
280  if ( nullptr != *pcIter ) {
281  **pcIter = ::wcstol( cValue, nullptr, 10 );
282  }
283  }
284  } while ( false );
285 
286  // 実行結果を返す
287  return result;
288  }
static bool GetJsonSetValue(CString &rcValue, CJson *pcJson, bool bClassName=false, bool bQuotes=true) noexcept
JSON設定値文字列取得関数
static CJson * FindJsonPath(wchar_t const *pszPath, CJson *pcJson) noexcept
JSONパス検索関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数
CJson * m_pcJsonCurrent
カレントJSONクラスポインタ

呼び出し関係図:

bool LibJson::CJsonConfig::Set ( std::initializer_list< int > const &  rnValueList,
wchar_t const *  pszKey = nullptr 
)
virtualnoexcept

整数型設定値設定関数

整数型設定値設定関数です。

引数
[in]rnValueList整数型設定値リスト参照
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp292 行目に定義があります。

参照先 LibJson::CJsonDocument::CreatePath(), LibCommon::CString::Format(), GetPath().

292  {
293  // 処理ブロック
294  bool result = false;
295  do {
296  // JSONパスを取得する
297  CString cPath;
298  if ( !GetPath( cPath, pszKey ) ) {
299  // 失敗!
300  break;
301  }
302 
303  // 巡回する
304  cPath += L" = [";
305  for ( auto pcIter = rnValueList.begin();; ++pcIter ) {
306  // イテレータを調べる
307  if ( rnValueList.end() == pcIter ) {
308  // JSONパスを作成する
309  cPath += L"]";
310  if ( !CreatePath( cPath ) ) {
311  // 失敗!
312  break;
313  }
314 
315  // 成功!
316  result = true;
317  break;
318  }
319  // イテレータを調べる
320  else if ( rnValueList.begin() != pcIter ) {
321  // コンマを追加する
322  cPath += L",";
323  }
324 
325  // 設定値を追加する
326  cPath += CString().Format( L"%d", *pcIter );
327  }
328  } while ( false );
329 
330  // 実行結果を返す
331  return result;
332  }
virtual bool CreatePath(wchar_t const *pszPath) noexcept
JSONパス作成関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数

呼び出し関係図:

bool LibJson::CJsonConfig::Get ( double &  rfValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSON設定値浮動小数取得関数

JSON設定値浮動小数取得関数です。

引数
[out]rfValue浮動小数参照
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp336 行目に定義があります。

参照先 LibJson::CJsonDocument::FindJsonPath(), LibJson::CJsonDocument::GetJsonSetValue(), GetPath(), LibJson::CJson::IsJsonNumber(), LibJson::CJsonDocument::m_pcJsonCurrent.

336  {
337  // 処理ブロック
338  bool result = false;
339  do {
340  // JSONパスを取得する
341  CString cPath;
342  if ( !GetPath( cPath, pszKey, nIndex ) ) {
343  // 失敗!
344  break;
345  }
346 
347  // JSONパスを検索する
348  CJson* pcJson = FindJsonPath( cPath, m_pcJsonCurrent );
349  if ( nullptr == pcJson ) {
350  // 失敗!
351  break;
352  }
353  // JSONクラス種別を調べる
354  else if ( !pcJson->IsJsonNumber() ) {
355  // 失敗!
356  break;
357  }
358 
359  // JSON設定値文字列を取得する
360  CString cValue;
361  if ( !GetJsonSetValue( cValue, pcJson, false, false ) ) {
362  // 失敗!
363  break;
364  }
365 
366  // 浮動小数を取得する
367  rfValue = ::wcstof( cValue, nullptr );
368 
369  // 成功!
370  result = true;
371  } while ( false );
372 
373  // 実行結果を返す
374  return result;
375  }
static bool GetJsonSetValue(CString &rcValue, CJson *pcJson, bool bClassName=false, bool bQuotes=true) noexcept
JSON設定値文字列取得関数
static CJson * FindJsonPath(wchar_t const *pszPath, CJson *pcJson) noexcept
JSONパス検索関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数
CJson * m_pcJsonCurrent
カレントJSONクラスポインタ

呼び出し関係図:

bool LibJson::CJsonConfig::Set ( double  fValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSON設定値浮動小数設定関数

JSON設定値浮動小数設定関数です。

引数
[in]fValue設定値浮動小数
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp379 行目に定義があります。

参照先 LibJson::CJsonDocument::CreatePath(), LibCommon::CString::Format(), GetPath().

379  {
380  // 処理ブロック
381  bool result = false;
382  do {
383  // JSONパスを取得する
384  CString cPath;
385  if ( !GetPath( cPath, pszKey, nIndex ) ) {
386  // 失敗!
387  break;
388  }
389 
390  // 設定値浮動小数を追加する
391  cPath += L" = ";
392  cPath += CString().Format( L"%lG", fValue );
393 
394  // JSONパスを作成する
395  if ( !CreatePath( cPath ) ) {
396  // 失敗!
397  break;
398  }
399 
400  // 成功!
401  result = true;
402  } while ( false );
403 
404  // 実行結果を返す
405  return result;
406  }
virtual bool CreatePath(wchar_t const *pszPath) noexcept
JSONパス作成関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数

呼び出し関係図:

bool LibJson::CJsonConfig::Get ( bool &  rbValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSON設定値真理値取得関数

JSON設定値真理値取得関数です。

引数
[out]rbValue真理値参照
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp410 行目に定義があります。

参照先 LibJson::CJsonDocument::FindJsonPath(), LibJson::CJsonDocument::GetJsonSetValue(), GetPath(), LibJson::CJson::IsJsonFixed(), LibJson::CJsonDocument::m_pcJsonCurrent.

410  {
411  // 処理ブロック
412  bool result = false;
413  do {
414  // JSONパスを取得する
415  CString cPath;
416  if ( !GetPath( cPath, pszKey, nIndex ) ) {
417  // 失敗!
418  break;
419  }
420 
421  // JSONパスを検索する
422  CJson* pcJson = FindJsonPath( cPath, m_pcJsonCurrent );
423  if ( nullptr == pcJson ) {
424  // 失敗!
425  break;
426  }
427  // JSONクラス種別を調べる
428  else if ( !pcJson->IsJsonFixed() ) {
429  // 失敗!
430  break;
431  }
432 
433  // JSON設定値文字列を取得する
434  CString cValue;
435  if ( !GetJsonSetValue( cValue, pcJson, false, false ) ) {
436  // 失敗!
437  break;
438  }
439 
440  // 真理値を取得する
441  rbValue = ( 0 == ::wcscmp( L"true", cValue ) );
442 
443  // 成功!
444  result = true;
445  } while ( false );
446 
447  // 実行結果を返す
448  return result;
449  }
static bool GetJsonSetValue(CString &rcValue, CJson *pcJson, bool bClassName=false, bool bQuotes=true) noexcept
JSON設定値文字列取得関数
static CJson * FindJsonPath(wchar_t const *pszPath, CJson *pcJson) noexcept
JSONパス検索関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数
CJson * m_pcJsonCurrent
カレントJSONクラスポインタ

呼び出し関係図:

bool LibJson::CJsonConfig::Set ( bool  bValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSON設定値真理値設定関数

JSON設定値真理値設定関数です。

引数
[in]bValue設定値真理値
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp453 行目に定義があります。

参照先 LibJson::CJsonDocument::CreatePath(), GetPath().

453  {
454  // 処理ブロック
455  bool result = false;
456  do {
457  // JSONパスを取得する
458  CString cPath;
459  if ( !GetPath( cPath, pszKey, nIndex ) ) {
460  // 失敗!
461  break;
462  }
463 
464  // 設定値真理値を追加する
465  cPath += L" = ";
466  cPath += ( bValue? L"true": L"false" );
467 
468  // JSONパスを作成する
469  if ( !CreatePath( cPath ) ) {
470  // 失敗!
471  break;
472  }
473 
474  // 成功!
475  result = true;
476  } while ( false );
477 
478  // 実行結果を返す
479  return result;
480  }
virtual bool CreatePath(wchar_t const *pszPath) noexcept
JSONパス作成関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数

呼び出し関係図:

bool LibJson::CJsonConfig::Get ( CString rcValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSON設定値文字列取得関数

JSON設定値文字列取得関数です。

引数
[out]rcValue文字列参照
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp484 行目に定義があります。

参照先 LibJson::CJsonDocument::FindJsonPath(), LibJson::CJsonDocument::GetJsonSetValue(), GetPath(), LibJson::CJsonDocument::m_pcJsonCurrent.

484  {
485  // 処理ブロック
486  bool result = false;
487  do {
488  // JSONパスを取得する
489  CString cPath;
490  if ( !GetPath( cPath, pszKey, nIndex ) ) {
491  // 失敗!
492  break;
493  }
494 
495  // JSONパスを検索する
496  CJson* pcJson = FindJsonPath( cPath, m_pcJsonCurrent );
497  if ( nullptr == pcJson ) {
498  // 失敗!
499  break;
500  }
501  // JSON設定値文字列を取得する
502  else if ( !GetJsonSetValue( rcValue, pcJson, false, false ) ) {
503  // 失敗!
504  break;
505  }
506 
507  // 成功!
508  result = true;
509  } while ( false );
510 
511  // 実行結果を返す
512  return result;
513  }
static bool GetJsonSetValue(CString &rcValue, CJson *pcJson, bool bClassName=false, bool bQuotes=true) noexcept
JSON設定値文字列取得関数
static CJson * FindJsonPath(wchar_t const *pszPath, CJson *pcJson) noexcept
JSONパス検索関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数
CJson * m_pcJsonCurrent
カレントJSONクラスポインタ

呼び出し関係図:

bool LibJson::CJsonConfig::Set ( wchar_t const *  pszValue,
wchar_t const *  pszKey = nullptr,
int  nIndex = -1 
)
virtualnoexcept

JSON設定値文字列設定関数

JSON設定値文字列設定関数です。

引数
[in]pszValue設定値文字列
[in]pszKeyキー文字列
[in]nIndexインデックス
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp517 行目に定義があります。

参照先 LibJson::CJsonDocument::CreatePath(), GetPath().

517  {
518  // 処理ブロック
519  bool result = false;
520  do {
521  // JSONパスを取得する
522  CString cPath;
523  if ( !GetPath( cPath, pszKey, nIndex ) ) {
524  // 失敗!
525  break;
526  }
527 
528  // 設定値文字列を追加する
529  cPath += L" = ";
530  cPath += L"\"";
531  cPath += pszValue;
532  cPath += L"\"";
533 
534  // JSONパスを作成する
535  if ( !CreatePath( cPath ) ) {
536  // 失敗!
537  break;
538  }
539 
540  // 成功!
541  result = true;
542  } while ( false );
543 
544  // 実行結果を返す
545  return result;
546  }
virtual bool CreatePath(wchar_t const *pszPath) noexcept
JSONパス作成関数
virtual bool GetPath(CString &rcPath, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
JSONパス取得関数

呼び出し関係図:

bool LibJson::CJsonConfig::ResumeWindowPosition ( HWND  hWnd,
wchar_t const *  pszKey = KEY_WINDOW_POS 
)
virtualnoexcept

ウィンドウ表示位置復元関数

ウィンドウ表示位置復元関数です。

引数
[in]hWndウィンドウハンドル
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp550 行目に定義があります。

参照先 Get().

550  {
551  // 処理ブロック
552  bool result = false;
553  do {
554  // ウィンドウ表示位置設定値を取得する
555  int nLeft;
556  int nTop;
557  int nWidth;
558  int nHeight;
559  if ( !Get( { &nLeft, &nTop, &nWidth, &nHeight }, pszKey ) ) {
560  // 失敗!
561  break;
562  }
563 
564  // ウィンドウ表示位置を設定する
565  ::SetWindowPos( hWnd, HWND_TOP, nLeft, nTop, nWidth, nHeight, ( SWP_NOACTIVATE | SWP_SHOWWINDOW ) );
566  ::UpdateWindow( hWnd );
567 
568  // 成功!
569  result = true;
570  } while ( false );
571 
572  // 実行結果を返す
573  return result;
574  }
virtual bool Get(int &rnValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
整数型設定値取得関数

呼び出し関係図:

bool LibJson::CJsonConfig::SaveWindowPosition ( HWND  hWnd,
wchar_t const *  pszKey = KEY_WINDOW_POS 
)
virtualnoexcept

ウィンドウ表示位置保存関数

ウィンドウ表示位置保存関数です。

引数
[in]hWndウィンドウハンドル
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp578 行目に定義があります。

参照先 Set().

578  {
579  // 処理ブロック
580  bool result = false;
581  do {
582  // ウィンドウ表示状態を取得する
583  WINDOWPLACEMENT sWndPlace = { sizeof( WINDOWPLACEMENT ) };
584  if ( 0 == ::GetWindowPlacement( hWnd, &sWndPlace ) ) {
585  // 失敗!
586  break;
587  }
588 
589  // ウィンドウ表示位置を保存する
590  int nLeft = sWndPlace.rcNormalPosition.left;
591  int nTop = sWndPlace.rcNormalPosition.top;
592  int nWidth = ( sWndPlace.rcNormalPosition.right - sWndPlace.rcNormalPosition.left );
593  int nHeight = ( sWndPlace.rcNormalPosition.bottom - sWndPlace.rcNormalPosition.top );
594  if ( !Set( { nLeft, nTop, nWidth, nHeight }, pszKey ) ) {
595  // 失敗!
596  break;
597  }
598 
599  // 成功!
600  result = true;
601  } while ( false );
602 
603  // 実行結果を返す
604  return result;
605  }
virtual bool Set(int nValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
整数型設定値設定関数

呼び出し関係図:

bool LibJson::CJsonConfig::ResumeShowWindow ( HWND  hWnd,
wchar_t const *  pszKey = KEY_SHOW_WINDOW 
)
virtualnoexcept

ウィンドウ表示状態復元関数

ウィンドウ表示状態復元関数です。

引数
[in]hWndウィンドウハンドル
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp609 行目に定義があります。

参照先 GetShowWindow().

609  {
610  // 処理ブロック
611  bool result = false;
612  do {
613  // ウィンドウ表示状態設定値を取得する
614  bool bVisible;
615  int nShow;
616  if ( !GetShowWindow( hWnd, bVisible, nShow, pszKey ) ) {
617  // 失敗!
618  break;
619  }
620 
621  // アクティブウィンドウを取得する
622  HWND hActive = ::GetActiveWindow();
623 
624  // ウィンドウ表示状態を調べる
625  switch ( nShow ) {
626  case SW_SHOWNORMAL:
627  // アクティブにしないでウィンドウ表示状態を設定する
628  ::ShowWindow( hWnd, SW_SHOWNOACTIVATE );
629  break;
630  case SW_SHOW:
631  // アクティブにしないでウィンドウ表示状態を設定する
632  ::ShowWindow( hWnd, SW_SHOWNA );
633  break;
634  case SW_SHOWMINIMIZED:
635  // アクティブにしないでウィンドウ表示状態を設定する
636  ::ShowWindow( hWnd, SW_SHOWMINNOACTIVE );
637  break;
638  default:
639  {
640  // ウィンドウ表示状態を設定する
641  ::ShowWindow( hWnd, nShow );
642 
643  // アクティブウィンドウを復元する
644  if ( hActive != ::GetActiveWindow() ) {
645  ::SetActiveWindow( hActive );
646  }
647  }
648  break;
649  }
650 
651  // WS_VISIBLEスタイルフラグを調べる
652  if ( !bVisible ) {
653  // ウィンドウを隠す
654  ::ShowWindow( hWnd, SW_HIDE );
655  }
656 
657  // 成功!
658  result = true;
659  } while ( false );
660 
661  // 実行結果を返す
662  return result;
663  }
virtual bool GetShowWindow(HWND hWnd, bool &rbVisible, int &rnShow, wchar_t const *pszKey=KEY_SHOW_WINDOW) noexcept
ウィンドウ表示状態取得関数

呼び出し関係図:

bool LibJson::CJsonConfig::SaveShowWindow ( HWND  hWnd,
wchar_t const *  pszKey = KEY_SHOW_WINDOW 
)
virtualnoexcept

ウィンドウ表示状態保存関数

ウィンドウ表示状態保存関数です。

引数
[in]hWndウィンドウハンドル
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp667 行目に定義があります。

参照先 SetShowWindow().

667  {
668  // 処理ブロック
669  bool result = false;
670  do {
671  // WS_VISIBLEスタイルフラグを取得する
672  bool bVisible = ( 0 != ::IsWindowVisible( hWnd ) );
673 
674  // ウィンドウ表示状態を取得する
675  WINDOWPLACEMENT sWndPlace = { sizeof( WINDOWPLACEMENT ) };
676  if ( 0 == ::GetWindowPlacement( hWnd, &sWndPlace ) ) {
677  // 失敗!
678  break;
679  }
680 
681  // ウィンドウ表示状態を設定する
682  int nShow = sWndPlace.showCmd;
683  if ( !SetShowWindow( hWnd, bVisible, nShow, pszKey ) ) {
684  // 失敗!
685  break;
686  }
687 
688  // 成功!
689  result = true;
690  } while ( false );
691 
692  // 実行結果を返す
693  return result;
694  }
virtual bool SetShowWindow(HWND hWnd, bool bVisible, int nShow, wchar_t const *pszKey=KEY_SHOW_WINDOW) noexcept
ウィンドウ表示状態設定関数

呼び出し関係図:

bool LibJson::CJsonConfig::GetShowWindow ( HWND  hWnd,
bool &  rbVisible,
int &  rnShow,
wchar_t const *  pszKey = KEY_SHOW_WINDOW 
)
virtualnoexcept

ウィンドウ表示状態取得関数

ウィンドウ表示状態取得関数です。

引数
[in]hWndウィンドウハンドル
[out]rbVisibleWS_VISIBLEスタイルフラグ参照
[out]rnShow表示状態参照
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp698 行目に定義があります。

参照先 Get().

参照元 ResumeShowWindow().

698  {
699  // 処理ブロック
700  bool result = false;
701  do {
702  // ウィンドウ表示状態設定値を取得する
703  int nVisible;
704  if ( !Get( { &nVisible, &rnShow }, pszKey ) ) {
705  // 失敗!
706  break;
707  }
708 
709  // WS_VISIBLEスタイルフラグを設定する
710  rbVisible = ( 0 != nVisible );
711 
712  // 成功!
713  result = true;
714  } while ( false );
715 
716  // 実行結果を返す
717  return result;
718  }
virtual bool Get(int &rnValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
整数型設定値取得関数

呼び出し関係図:

被呼び出し関係図:

bool LibJson::CJsonConfig::SetShowWindow ( HWND  hWnd,
bool  bVisible,
int  nShow,
wchar_t const *  pszKey = KEY_SHOW_WINDOW 
)
virtualnoexcept

ウィンドウ表示状態設定関数

ウィンドウ表示状態設定関数です。

引数
[in]hWndウィンドウハンドル
[in]bVisibleWS_VISIBLEスタイルフラグ
[in]nShow表示状態
[in]pszKeyキー文字列
戻り値
実行結果
  • true 成功
  • false 失敗
注意
なし

CJsonConfig.cpp722 行目に定義があります。

参照先 KEY_SHOW_WINDOW, KEY_WINDOW_POS, Set().

参照元 SaveShowWindow().

722  {
723  // 処理ブロック
724  bool result = false;
725  do {
726  // ウィンドウ表示状態を保存する
727  if ( !Set( { bVisible, nShow }, pszKey ) ) {
728  // 失敗!
729  break;
730  }
731 
732  // 成功!
733  result = true;
734  } while ( false );
735 
736  // 実行結果を返す
737  return result;
738  }
virtual bool Set(int nValue, wchar_t const *pszKey=nullptr, int nIndex=-1) noexcept
整数型設定値設定関数

呼び出し関係図:

被呼び出し関係図:

CJsonConfig& LibJson::CJsonConfig::operator= ( CJsonConfig const &  )
privatedelete

メンバ詳解

wchar_t const *const LibJson::CJsonConfig::KEY_WINDOW_POS = L"ウィンドウ表示位置"
static

ウィンドウ表示位置キー文字列

CJsonConfig.h354 行目に定義があります。

参照元 SetShowWindow().

wchar_t const *const LibJson::CJsonConfig::KEY_SHOW_WINDOW = L"ウィンドウ表示状態"
static

ウィンドウ表示状態キー文字列

CJsonConfig.h355 行目に定義があります。

参照元 SetShowWindow().


このクラス詳解は次のファイルから抽出されました: