Solution46
CJsonValue.cpp
[詳解]
1 //=============================================================================
2 /// @file
3 /// JSONバリュークラス実装ファイル
4 ///
5 /// JSONバリュークラス実装ファイルです。
6 ///
7 /// $Id: CJsonValue.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 <CJsonValue.h>
18 #include <CJsonObject.h>
19 #include <CJsonArray.h>
20 #include <CJsonString.h>
21 #include <CJsonNumber.h>
22 #include <CJsonFixed.h>
23 
24 //=============================================================================
25 // インクルード実装ファイル
26 #include <CArray.hpp>
27 
28 //=============================================================================
29 // JSONライブラリ名前空間
30 namespace LibJson {
31  //=========================================================================
32  // JSONバリュークラス
33  //=========================================================================
34  // 構築子と解体子
35  //-------------------------------------------------------------------------
36  // コンストラクタ
37  CJsonValue::CJsonValue( CJson* pcParent ) noexcept
38  // 基底クラスコンストラクタ
39  : CJson( pcParent )
40  {}
41 
42  //=========================================================================
43  // 静的公開関数
44  //-------------------------------------------------------------------------
45  // JSONバリュー入力作成関数
46  CJsonValue* CJsonValue::CreateInputJson( CStream& rcStream, CJson* pcParent ) noexcept {
47  // 処理ブロック
48  CJsonValue* result = nullptr;
49  do {
50  // JSONオブジェクトを入力作成する
51  CJsonValue* pcJsonValue = CJsonObject::CreateInputJson( rcStream, pcParent );
52  if ( nullptr == pcJsonValue ) {
53  // JSON配列を入力作成する
54  pcJsonValue = CJsonArray::CreateInputJson( rcStream, pcParent );
55  if ( nullptr == pcJsonValue ) {
56  // JSON文字列を入力作成する
57  pcJsonValue = CJsonString::CreateInputJson( rcStream, pcParent );
58  if ( nullptr == pcJsonValue ) {
59  // JSON数値を入力作成する
60  pcJsonValue = CJsonNumber::CreateInputJson( rcStream, pcParent );
61  if ( nullptr == pcJsonValue ) {
62  // JSON固定値を入力作成する
63  pcJsonValue = CJsonFixed::CreateInputJson( rcStream, pcParent );
64  if ( nullptr == pcJsonValue ) {
65  // 失敗!
66  break;
67  }
68  }
69  }
70  }
71  }
72 
73  // 成功!
74  result = pcJsonValue;
75  } while ( false );
76 
77  // 実行結果を返す
78  return result;
79  }
80 }
81 
82 #pragma managed( pop )
static CJsonArray * CreateInputJson(CStream &rcStream, CJson *pcParent) noexcept
JSON配列入力作成関数
Definition: CJsonArray.cpp:41
JSON配列クラスヘッダファイル
CJsonValue(CJson *pcParent) noexcept
コンストラクタ
Definition: CJsonValue.cpp:37
JSONライブラリ名前空間
Definition: CJson.h:24
配列クラス実装ヘッダファイル
static CJsonObject * CreateInputJson(CStream &rcStream, CJson *pcParent) noexcept
JSONオブジェクト入力作成関数
JSON数値クラスヘッダファイル
JSONバリュークラス
Definition: CJsonValue.h:30
static CJsonFixed * CreateInputJson(CStream &rcStream, CJson *pcParent) noexcept
JSON固定値入力作成関数
Definition: CJsonFixed.cpp:88
ストリームクラス
Definition: CStream.h:31
JSONクラス
Definition: CJson.h:44
static CJsonString * CreateInputJson(CStream &rcStream, CJson *pcParent) noexcept
JSON文字列入力作成関数
JSONバリュークラスヘッダファイル
JSON固定値クラスヘッダファイル
static CJsonValue * CreateInputJson(CStream &rcStream, CJson *pcParent) noexcept
JSONバリュー入力作成関数
Definition: CJsonValue.cpp:46
static CJsonNumber * CreateInputJson(CStream &rcStream, CJson *pcParent) noexcept
JSON数値入力作成関数
Definition: CJsonNumber.cpp:88
JSONオブジェクトクラスヘッダファイル
JSON文字列クラスヘッダファイル