mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-02 11:38:08 +00:00
update json sources
This commit is contained in:
@@ -290,8 +290,6 @@
|
||||
<ClCompile Include="src\TemplateCache.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\pd_json.h" />
|
||||
<ClInclude Include="include\pd_json_private.h" />
|
||||
<ClInclude Include="include\Poco\JSON\Array.h" />
|
||||
<ClInclude Include="include\Poco\JSON\Handler.h" />
|
||||
<ClInclude Include="include\Poco\JSON\JSON.h" />
|
||||
@@ -305,6 +303,8 @@
|
||||
<ClInclude Include="include\Poco\JSON\Stringifier.h" />
|
||||
<ClInclude Include="include\Poco\JSON\Template.h" />
|
||||
<ClInclude Include="include\Poco\JSON\TemplateCache.h" />
|
||||
<ClInclude Include="src\pd_json.h" />
|
||||
<ClInclude Include="src\pd_json_private.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
|
||||
@@ -89,10 +89,10 @@
|
||||
<ClInclude Include="include\Poco\JSON\ParserImpl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\pd_json.h">
|
||||
<ClInclude Include="src\pd_json.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\pd_json_private.h">
|
||||
<ClInclude Include="src\pd_json_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
1201
JSON/src/pd_json.c
1201
JSON/src/pd_json.c
File diff suppressed because it is too large
Load Diff
@@ -1,42 +1,53 @@
|
||||
#ifndef PDJSON_H
|
||||
#define PDJSON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
enum json_type {
|
||||
JSON_ERROR = 1, JSON_DONE,
|
||||
JSON_OBJECT, JSON_OBJECT_END, JSON_ARRAY, JSON_ARRAY_END,
|
||||
JSON_STRING, JSON_NUMBER, JSON_TRUE, JSON_FALSE, JSON_NULL
|
||||
};
|
||||
enum json_type {
|
||||
JSON_ERROR = 1, JSON_DONE,
|
||||
JSON_OBJECT, JSON_OBJECT_END, JSON_ARRAY, JSON_ARRAY_END,
|
||||
JSON_STRING, JSON_NUMBER, JSON_TRUE, JSON_FALSE, JSON_NULL
|
||||
};
|
||||
|
||||
struct json_allocator {
|
||||
void *(*malloc)(size_t);
|
||||
void *(*realloc)(void *, size_t);
|
||||
void (*free)(void *);
|
||||
};
|
||||
struct json_allocator {
|
||||
void *(*malloc)(size_t);
|
||||
void *(*realloc)(void *, size_t);
|
||||
void(*free)(void *);
|
||||
};
|
||||
|
||||
typedef int(*json_user_io) (void *user);
|
||||
|
||||
#include "pd_json_private.h"
|
||||
|
||||
typedef struct json_stream json_stream;
|
||||
typedef struct json_allocator json_allocator;
|
||||
typedef struct json_stream json_stream;
|
||||
typedef struct json_allocator json_allocator;
|
||||
|
||||
void json_open_buffer(json_stream *json, const void *buffer, size_t size);
|
||||
void json_open_string(json_stream *json, const char *string);
|
||||
void json_open_stream(json_stream *json, FILE *stream);
|
||||
void json_close(json_stream *json);
|
||||
void json_open_buffer(json_stream *json, const void *buffer, size_t size);
|
||||
void json_open_string(json_stream *json, const char *string);
|
||||
void json_open_stream(json_stream *json, FILE *stream);
|
||||
void json_open_user(json_stream *json, json_user_io get, json_user_io peek, void *user);
|
||||
void json_close(json_stream *json);
|
||||
|
||||
void json_set_allocator(json_stream *json, json_allocator *a);
|
||||
void json_set_streaming(json_stream *json, bool strict);
|
||||
void json_set_allocator(json_stream *json, json_allocator *a);
|
||||
void json_set_streaming(json_stream *json, bool strict);
|
||||
|
||||
enum json_type json_next(json_stream *json);
|
||||
enum json_type json_peek(json_stream *json);
|
||||
void json_reset(json_stream *json);
|
||||
const char *json_get_string(json_stream *json, size_t *length);
|
||||
double json_get_number(json_stream *json);
|
||||
enum json_type json_next(json_stream *json);
|
||||
enum json_type json_peek(json_stream *json);
|
||||
void json_reset(json_stream *json);
|
||||
const char *json_get_string(json_stream *json, size_t *length);
|
||||
double json_get_number(json_stream *json);
|
||||
|
||||
size_t json_get_lineno(json_stream *json);
|
||||
size_t json_get_position(json_stream *json);
|
||||
size_t json_get_depth(json_stream *json);
|
||||
const char *json_get_error(json_stream *json);
|
||||
size_t json_get_lineno(json_stream *json);
|
||||
size_t json_get_position(json_stream *json);
|
||||
size_t json_get_depth(json_stream *json);
|
||||
const char *json_get_error(json_stream *json);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,46 +5,51 @@
|
||||
#include <stdio.h>
|
||||
|
||||
struct json_source {
|
||||
int (*get) (struct json_source *);
|
||||
int (*peek) (struct json_source *);
|
||||
size_t position;
|
||||
union {
|
||||
struct {
|
||||
FILE *stream;
|
||||
} stream;
|
||||
struct {
|
||||
const char *buffer;
|
||||
size_t length;
|
||||
} buffer;
|
||||
} source;
|
||||
int(*get) (struct json_source *);
|
||||
int(*peek) (struct json_source *);
|
||||
size_t position;
|
||||
union {
|
||||
struct {
|
||||
FILE *stream;
|
||||
} stream;
|
||||
struct {
|
||||
const char *buffer;
|
||||
size_t length;
|
||||
} buffer;
|
||||
struct {
|
||||
void *ptr;
|
||||
json_user_io get;
|
||||
json_user_io peek;
|
||||
} user;
|
||||
} source;
|
||||
};
|
||||
|
||||
struct json_stack {
|
||||
enum json_type type;
|
||||
long count;
|
||||
enum json_type type;
|
||||
long count;
|
||||
};
|
||||
|
||||
struct json_stream {
|
||||
size_t lineno;
|
||||
size_t lineno;
|
||||
|
||||
struct json_stack *stack;
|
||||
size_t stack_top;
|
||||
size_t stack_size;
|
||||
enum json_type next;
|
||||
int error : 31;
|
||||
bool streaming : 1;
|
||||
struct json_stack *stack;
|
||||
size_t stack_top;
|
||||
size_t stack_size;
|
||||
enum json_type next;
|
||||
int error : 31;
|
||||
bool streaming : 1;
|
||||
|
||||
struct {
|
||||
char *string;
|
||||
size_t string_fill;
|
||||
size_t string_size;
|
||||
} data;
|
||||
struct {
|
||||
char *string;
|
||||
size_t string_fill;
|
||||
size_t string_size;
|
||||
} data;
|
||||
|
||||
size_t ntokens;
|
||||
size_t ntokens;
|
||||
|
||||
struct json_source source;
|
||||
struct json_allocator alloc;
|
||||
char errmsg[128];
|
||||
struct json_source source;
|
||||
struct json_allocator alloc;
|
||||
char errmsg[128];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user