mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-02-05 17:28:23 +08:00
update to pika_cjson to package
This commit is contained in:
parent
349422afe3
commit
18c3c70d8b
@ -12,7 +12,6 @@ class cJSON(TinyObj):
|
|||||||
cJSON_Object: int
|
cJSON_Object: int
|
||||||
cJSON_Raw: int
|
cJSON_Raw: int
|
||||||
def print(self) -> str: ...
|
def print(self) -> str: ...
|
||||||
def parse(self, value: str): ...
|
|
||||||
def __del__(self): ...
|
def __del__(self): ...
|
||||||
def __init__(self): ...
|
def __init__(self): ...
|
||||||
def getObjectItem(self, string: str) -> cJSON: ...
|
def getObjectItem(self, string: str) -> cJSON: ...
|
||||||
@ -41,6 +40,10 @@ class cJSON(TinyObj):
|
|||||||
def addItemToObject(self, string: str, item: cJSON): ...
|
def addItemToObject(self, string: str, item: cJSON): ...
|
||||||
|
|
||||||
|
|
||||||
|
class Parse(cJSON):
|
||||||
|
def __init__(self, value: str): ...
|
||||||
|
|
||||||
|
|
||||||
class Null(cJSON):
|
class Null(cJSON):
|
||||||
def __init__(self): ...
|
def __init__(self): ...
|
||||||
|
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
#include "pika_cjson_cJSON.h"
|
#include "pika_cjson_cJSON.h"
|
||||||
#include "cJSON.h"
|
#include "cJSON.h"
|
||||||
|
|
||||||
void pika_cjson_cJSON_parse(PikaObj* self, char* value) {
|
|
||||||
cJSON* item = cJSON_Parse(value);
|
|
||||||
if (NULL == item) {
|
|
||||||
obj_setErrorCode(self, 3);
|
|
||||||
__platform_printf("Error: cJSON parse faild.\r\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
obj_setPtr(self, "item", item);
|
|
||||||
obj_setInt(self, "needfree", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* pika_cjson_cJSON_print(PikaObj* self) {
|
char* pika_cjson_cJSON_print(PikaObj* self) {
|
||||||
cJSON* item = obj_getPtr(self, "item");
|
cJSON* item = obj_getPtr(self, "item");
|
||||||
char* res = cJSON_Print(item);
|
char* res = cJSON_Print(item);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "pika_cjson_Number.h"
|
#include "pika_cjson_Number.h"
|
||||||
#include "pika_cjson_Object.h"
|
#include "pika_cjson_Object.h"
|
||||||
#include "pika_cjson_ObjectReference.h"
|
#include "pika_cjson_ObjectReference.h"
|
||||||
|
#include "pika_cjson_Parse.h"
|
||||||
#include "pika_cjson_Raw.h"
|
#include "pika_cjson_Raw.h"
|
||||||
#include "pika_cjson_String.h"
|
#include "pika_cjson_String.h"
|
||||||
#include "pika_cjson_StringReference.h"
|
#include "pika_cjson_StringReference.h"
|
||||||
@ -98,3 +99,14 @@ void pika_cjson_ArrayReference___init__(PikaObj* self, PikaObj* child) {
|
|||||||
obj_setPtr(self, "item", item);
|
obj_setPtr(self, "item", item);
|
||||||
obj_setInt(self, "needfree", 1);
|
obj_setInt(self, "needfree", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pika_cjson_Parse___init__(PikaObj* self, char* value) {
|
||||||
|
cJSON* item = cJSON_Parse(value);
|
||||||
|
if (NULL == item) {
|
||||||
|
obj_setErrorCode(self, 3);
|
||||||
|
__platform_printf("Error: cJSON parse faild.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obj_setPtr(self, "item", item);
|
||||||
|
obj_setInt(self, "needfree", 1);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user