Jsonオブジェクト. [詳細]
#include "necbaas/nb_json_object.h"
 
  
 | Public メソッド | |
| NbJsonObject () | |
| コンストラクタ.  [詳細] | |
| NbJsonObject (const std::string &json_string) | |
| コンストラクタ.  [詳細] | |
| NbJsonObject (const std::vector< char > &json_char) | |
| コンストラクタ.  [詳細] | |
| virtual | ~NbJsonObject () | 
| デストラクタ.  [詳細] | |
| bool | PutAll (const std::string &json) | 
| 全データセット.  [詳細] | |
| std::vector< std::string > | GetKeySet () const | 
| キーセット取得.  [詳細] | |
| int | GetInt (const std::string &key, int default_value=0) const | 
| 整数値取得.  [詳細] | |
| int64_t | GetInt64 (const std::string &key, int64_t default_value=0) const | 
| 64bit整数値取得.  [詳細] | |
| double | GetDouble (const std::string &key, double default_value=0.0) const | 
| 浮動小数点値取得.  [詳細] | |
| bool | GetBoolean (const std::string &key, bool default_value=false) const | 
| 真偽値取得.  [詳細] | |
| std::string | GetString (const std::string &key, const std::string default_value="") const | 
| 文字列取得.  [詳細] | |
| NbJsonObject | GetJsonObject (const std::string &key) const | 
| Jsonオブジェクト取得.  [詳細] | |
| NbJsonArray | GetJsonArray (const std::string &key) const | 
| Json配列取得.  [詳細] | |
| const Json::Value & | GetSubstitutableValue () const | 
| [内部処理用]  [詳細] | |
| Json::Value & | operator[] (const std::string &key) | 
| Value設定用添え字演算子.  [詳細] | |
| const Json::Value & | operator[] (const std::string &key) const | 
| Value参照用添え字演算子.  [詳細] | |
| void | PutJsonObject (const std::string &key, const NbJsonObject &json_object) | 
| Jsonオブジェクト設定.  [詳細] | |
| void | PutJsonArray (const std::string &key, const NbJsonArray &json_array) | 
| Json配列設定.  [詳細] | |
| void | PutNull (const std::string &key) | 
| null設定.  [詳細] | |
| unsigned int | GetSize () const | 
| サイズ取得.  [詳細] | |
| bool | IsEmpty () const | 
| オブジェクト空確認.  [詳細] | |
| bool | IsMember (const std::string &key) const | 
| Key存在確認.  [詳細] | |
| NbJsonType | GetType (const std::string &key) const | 
| Jsonタイプ取得.  [詳細] | |
| void | Remove (const std::string &key) | 
| Key削除.  [詳細] | |
| void | Clear () | 
| 全データ削除.  [詳細] | |
| std::string | ToJsonString () const | 
| Json文字列変換.  [詳細] | |
| void | Replace (const Json::Value &value) | 
| [内部処理用]  [詳細] | |
| bool | operator== (const NbJsonObject &other) const | 
| ==演算子.  [詳細] | |
| Protected 変数 | |
| Json::Value | value_ | 
Jsonオブジェクト.
Json形式のKey-Valueストアを提供する。
 データの取得は、Valueの型に対応したGetメソッドを使用する。
 データの設定は、添え字演算子[]かValueの型に対応したPutメソッドを使用する。
本クラスのインスタンスはスレッドセーフではない
| necbaas::NbJsonObject::NbJsonObject | ( | ) | 
コンストラクタ.
| 
 | explicit | 
コンストラクタ.
Json文字列をParseしてNbJsonObjectを生成する。
 Json Parseに失敗した場合は、空のJsonオブジェクトが生成される。 
| [in] | json_string | Json文字列 | 
| 
 | explicit | 
コンストラクタ.
Json文字列をParseしてNbJsonObjectを生成する。
 Json Parseに失敗した場合は、空のJsonオブジェクトが生成される。 
| [in] | json_char | Json文字列 | 
| 
 | virtual | 
デストラクタ.
| void necbaas::NbJsonObject::Clear | ( | ) | 
全データ削除.
全てのKey-Valueセットを削除する。
| bool necbaas::NbJsonObject::GetBoolean | ( | const std::string & | key, | 
| bool | default_value = false | ||
| ) | const | 
真偽値取得.
Keyに対応するValueをbool型で取得する。
 以下の場合は、default_valueを返却する。
| [in] | key | Key | 
| [in] | default_value | 取得できなかったときに返す値 | 
| double necbaas::NbJsonObject::GetDouble | ( | const std::string & | key, | 
| double | default_value = 0.0 | ||
| ) | const | 
浮動小数点値取得.
Keyに対応するValueをdouble型で取得する。
 以下の場合は、default_valueを返却する。
| [in] | key | Key | 
| [in] | default_value | 取得できなかったときに返す値 | 
| int necbaas::NbJsonObject::GetInt | ( | const std::string & | key, | 
| int | default_value = 0 | ||
| ) | const | 
整数値取得.
Keyに対応するValueをint型で取得する。
 浮動小数点は丸められる。
 以下の場合は、default_valueを返却する。
| [in] | key | Key | 
| [in] | default_value | 取得できなかったときに返す値 | 
| int64_t necbaas::NbJsonObject::GetInt64 | ( | const std::string & | key, | 
| int64_t | default_value = 0 | ||
| ) | const | 
64bit整数値取得.
Keyに対応するValueをint64_t型で取得する。
 浮動小数点は丸められる。
 以下の場合は、default_valueを返却する。
| [in] | key | Key | 
| [in] | default_value | 取得できなかったときに返す値 | 
| NbJsonArray necbaas::NbJsonObject::GetJsonArray | ( | const std::string & | key | ) | const | 
Json配列取得.
Keyに対応するValueをNbJsonArray型で取得する。
 以下の場合は、空のJson配列を返却する。
| [in] | key | Key | 
| NbJsonObject necbaas::NbJsonObject::GetJsonObject | ( | const std::string & | key | ) | const | 
Jsonオブジェクト取得.
Keyに対応するValueをNbJsonObject型で取得する。
 以下の場合は、空のJsonオブジェクトを返却する。
| [in] | key | Key | 
| std::vector<std::string> necbaas::NbJsonObject::GetKeySet | ( | ) | const | 
キーセット取得.
| unsigned int necbaas::NbJsonObject::GetSize | ( | ) | const | 
サイズ取得.
Jsonオブジェクトに存在するKey-Valueセットの数を取得する。
| std::string necbaas::NbJsonObject::GetString | ( | const std::string & | key, | 
| const std::string | default_value = "" | ||
| ) | const | 
文字列取得.
Keyに対応するValueをstd::string型で取得する。
 以下の場合は、default_valueを返却する。
| [in] | key | Key | 
| [in] | default_value | 取得できなかったときに返す値 | 
| const Json::Value& necbaas::NbJsonObject::GetSubstitutableValue | ( | ) | const | 
[内部処理用]
| NbJsonType necbaas::NbJsonObject::GetType | ( | const std::string & | key | ) | const | 
Jsonタイプ取得.
Keyに対応するJsonタイプを取得する。
 Keyが存在しない場合は、NULL型が返る。 
| [in] | key | Key | 
| bool necbaas::NbJsonObject::IsEmpty | ( | ) | const | 
オブジェクト空確認.
Jsonオブジェクトが空かどうかを確認する。
| true | 空 | 
| false | 1以上のKey-Valueセットが存在 | 
| bool necbaas::NbJsonObject::IsMember | ( | const std::string & | key | ) | const | 
Key存在確認.
keyがJsonオブジェクトに存在するか確認する。
| true | 存在する | 
| false | 存在しない | 
| bool necbaas::NbJsonObject::operator== | ( | const NbJsonObject & | other | ) | const | 
==演算子.
| Json::Value& necbaas::NbJsonObject::operator[] | ( | const std::string & | key | ) | 
Value設定用添え字演算子.
添え字演算子を使用してKeyに対応するValueを設定する。
 Keyが存在する場合は、Key-Valueセットが更新される。
 Keyが存在しない場合は、Key-Valueセットが作成される。
 設定可能なValueの型は以下
NbJsonObject, NbJsonArray の設定は、 PutJsonObject(), PutJsonArray() を使用すること。
| [in] | key | Key | 
| const Json::Value& necbaas::NbJsonObject::operator[] | ( | const std::string & | key | ) | const | 
Value参照用添え字演算子.
本演算子は未サポート。Valueの取得には、Getメソッドを使用してください。
| bool necbaas::NbJsonObject::PutAll | ( | const std::string & | json | ) | 
全データセット.
Json文字列をParseしてNbJsonObject内のデータを再構築する。元々存在していたデータは破棄される。
 Json Parseに失敗した場合は、空のJsonオブジェクトが生成される。 
| [in] | json | Json文字列 | 
| void necbaas::NbJsonObject::PutJsonArray | ( | const std::string & | key, | 
| const NbJsonArray & | json_array | ||
| ) | 
Json配列設定.
Keyに対応するValueをNbJsonArray型で設定する。
 Keyが空文字の場合は処理しない。 
| [in] | key | Key | 
| [in] | json_array | Value | 
| void necbaas::NbJsonObject::PutJsonObject | ( | const std::string & | key, | 
| const NbJsonObject & | json_object | ||
| ) | 
Jsonオブジェクト設定.
Keyに対応するValueをNbJsonObject型で設定する。
 Keyが空文字の場合は処理しない。 
| [in] | key | Key | 
| [in] | json_object | Value | 
| void necbaas::NbJsonObject::PutNull | ( | const std::string & | key | ) | 
null設定.
Keyに対応するValueにnullを設定する。
 Keyが空文字の場合は処理しない。 
| [in] | key | Key | 
| void necbaas::NbJsonObject::Remove | ( | const std::string & | key | ) | 
Key削除.
Keyに対応するKey-Valueセットを削除する
| [in] | key | Key | 
| void necbaas::NbJsonObject::Replace | ( | const Json::Value & | value | ) | 
[内部処理用]
| std::string necbaas::NbJsonObject::ToJsonString | ( | ) | const | 
Json文字列変換.
設定されているJsonオブジェクトをJson文字列に変換する。
| 
 | protected | 
Jsonデータ
 1.8.5
 1.8.5