json-gen-c  0.1.5
json-gen-c generate C code for json manipulation
json_context.h
Go to the documentation of this file.
1
6#ifndef JSON_CONTEXT_H
7#define JSON_CONTEXT_H
8
9#include <stdint.h>
10#include <pthread.h>
11
16 int offset;
17 int type_size;
18 int field_type;
19 char* field_type_name;
20 char* field_name;
21 char* struct_name;
22 int is_array;
23};
24
36
41struct json_context* json_context_new(void);
42
47void json_context_free(struct json_context* ctx);
48
58int json_context_init(struct json_context* ctx,
59 struct json_field_offset_item* field_items,
60 int item_count,
61 int* hash_table,
62 int hash_size);
63
72 struct json_context* ctx,
73 const char* struct_name,
74 const char* field_name);
75
76#endif /* JSON_CONTEXT_H */
int json_context_init(struct json_context *ctx, struct json_field_offset_item *field_items, int item_count, int *hash_table, int hash_size)
Initialize context with field offset data.
Definition json_context.c:41
struct json_field_offset_item * json_context_find_field(struct json_context *ctx, const char *struct_name, const char *field_name)
Find field offset item in thread-safe manner.
Definition json_context.c:89
struct json_context * json_context_new(void)
Create a new JSON parsing context.
Definition json_context.c:11
void json_context_free(struct json_context *ctx)
Free a JSON parsing context.
Definition json_context.c:28
Thread-safe JSON parsing context This structure replaces global variables to ensure thread safety.
Definition json_context.h:29
struct json_field_offset_item * field_offset_items
Definition json_context.h:30
pthread_mutex_t mutex
Definition json_context.h:34
int entry_hash_size
Definition json_context.h:32
int item_count
Definition json_context.h:33
int * entry_hash
Definition json_context.h:31
Field offset item structure for JSON parsing.
Definition json_context.h:15