添加注释

This commit is contained in:
gb 2023-01-19 15:45:13 +08:00
parent a0a2e95ccf
commit 9be3ce881d
1 changed files with 6 additions and 1 deletions

View File

@ -89,25 +89,30 @@ protected:
~json(); ~json();
public: public:
// parse/un-parse ...
bool attach_text(char* json_txt); bool attach_text(char* json_txt);
void clear(bool as_array = false); void clear(bool as_array = false);
std::string to_string(void); std::string to_string(void);
// attributes ...
std::string& key(void); std::string& key(void);
bool is_array(void); bool is_array(void);
bool is_leaf_node(void); // whether this object is a leaf node contains final value 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, bool& val);
bool get_value(const char* key, int& val); bool get_value(const char* key, int& val);
bool get_value(const char* key, double& val); bool get_value(const char* key, double& val);
bool get_value(const char* key, std::string& val); bool get_value(const char* key, std::string& val);
bool get_value(const char* key, json*& 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 size_t children(void); // return children count if was object or array, or else -1 returned
json* child(size_t ind); json* child(size_t ind);
json* first_child(void); json* first_child(void);
json* next_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, bool val);
bool set_value(const char* key, int val); bool set_value(const char* key, int val);
bool set_value(const char* key, double val); bool set_value(const char* key, double val);