Add getNumberValue function

* Add GetNumberValue function and testcase

Co-authored-by: Alan Wang <wp_scut@163.com>
This commit is contained in:
Sang-Heon Jeon
2020-04-02 18:06:56 +09:00
committed by Alanscut
parent 983bb2b4d6
commit 97cf1d84e4
3 changed files with 31 additions and 4 deletions

View File

@@ -180,8 +180,9 @@ CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *st
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
/* Check if the item is a string and return its valuestring */
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
/* Check item type and return its value */
CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
CJSON_PUBLIC(double) cJSON_GetNumberValue(cJSON *item);
/* These functions check the type of an item */
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);