From 9be3ce881d64ad27fa3b2a53461613f8262f6105 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Thu, 19 Jan 2023 15:45:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/json/json.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/json/json.h b/common/json/json.h index 8b63b3b..3adff81 100644 --- a/common/json/json.h +++ b/common/json/json.h @@ -89,25 +89,30 @@ protected: ~json(); public: + // parse/un-parse ... bool attach_text(char* json_txt); void clear(bool as_array = false); std::string to_string(void); + // attributes ... std::string& key(void); bool is_array(void); bool is_leaf_node(void); // whether this object is a leaf node contains final value + + // value access ... bool get_value(const char* key, bool& val); bool get_value(const char* key, int& val); bool get_value(const char* key, double& val); bool get_value(const char* key, std::string& val); bool get_value(const char* key, json*& val); + // enumeration ... size_t children(void); // return children count if was object or array, or else -1 returned json* child(size_t ind); json* first_child(void); json* next_child(void); - // change the item matched 'key', or else add a new item + // change the item matching 'key', otherwise add a new item bool set_value(const char* key, bool val); bool set_value(const char* key, int val); bool set_value(const char* key, double val);