rename cJSON_cJSON to pika_cjson

This commit is contained in:
pikastech 2022-06-06 09:50:15 +08:00
parent 9ad033123d
commit 590d55ba36
3 changed files with 5 additions and 6 deletions

View File

@ -5,4 +5,4 @@ class cJSON(TinyObj):
def print(self) -> str: ...
def parse(self, value: str): ...
def __del__(self): ...
def getObjectItem(self, string: str) -> any: ...
def getObjectItem(self, string: str) -> cJSON: ...

View File

@ -1,5 +1,5 @@
#include "pika_cjson_cJSON.h"
#include "cJSON.h"
#include "pika_cjson_cJSON.h"
void pika_cjson_cJSON_parse(PikaObj* self, char* value) {
cJSON* item = cJSON_Parse(value);
@ -22,17 +22,16 @@ void pika_cjson_cJSON___del__(PikaObj* self) {
}
}
Arg* pika_cjson_cJSON_getObjectItem(PikaObj* self, char* string) {
PikaObj* pika_cjson_cJSON_getObjectItem(PikaObj* self, char* string) {
cJSON* item = obj_getPtr(self, "item");
cJSON* subItem = cJSON_GetObjectItem(item, string);
/* create subCJSON */
Arg* subCJSON_arg = obj_newObjInPackage(New_pika_cjson_cJSON);
PikaObj* subCJSON = newNormalObj(New_pika_cjson_cJSON);
/* init the subCJSON */
PikaObj* subCJSON = arg_getPtr(subCJSON_arg);
obj_setPtr(subCJSON, "item", subItem);
obj_setInt(subCJSON, "needfree", 0);
return subCJSON_arg;
return subCJSON;
}