Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/include/mupdf/fitz/json.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 // Copyright (C) 2004-2025 Artifex Software, Inc. | |
| 2 // | |
| 3 // This file is part of MuPDF. | |
| 4 // | |
| 5 // MuPDF is free software: you can redistribute it and/or modify it under the | |
| 6 // terms of the GNU Affero General Public License as published by the Free | |
| 7 // Software Foundation, either version 3 of the License, or (at your option) | |
| 8 // any later version. | |
| 9 // | |
| 10 // MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 12 // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | |
| 13 // details. | |
| 14 // | |
| 15 // You should have received a copy of the GNU Affero General Public License | |
| 16 // along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html> | |
| 17 // | |
| 18 // Alternative licensing terms are available from the licensor. | |
| 19 // For commercial licensing, see <https://www.artifex.com/> or contact | |
| 20 // Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, | |
| 21 // CA 94129, USA, for further information. | |
| 22 | |
| 23 #ifndef MUPDF_FITZ_JSON_H | |
| 24 #define MUPDF_FITZ_JSON_H | |
| 25 | |
| 26 #include "mupdf/fitz/system.h" | |
| 27 #include "mupdf/fitz/context.h" | |
| 28 #include "mupdf/fitz/pool.h" | |
| 29 #include "mupdf/fitz/buffer.h" | |
| 30 | |
| 31 /* JSON parser */ | |
| 32 | |
| 33 enum { | |
| 34 FZ_JSON_NULL, | |
| 35 FZ_JSON_TRUE, | |
| 36 FZ_JSON_FALSE, | |
| 37 FZ_JSON_NUMBER, | |
| 38 FZ_JSON_STRING, | |
| 39 FZ_JSON_ARRAY, | |
| 40 FZ_JSON_OBJECT | |
| 41 }; | |
| 42 | |
| 43 typedef struct fz_json fz_json; | |
| 44 typedef struct fz_json_array fz_json_array; | |
| 45 typedef struct fz_json_object fz_json_object; | |
| 46 | |
| 47 struct fz_json | |
| 48 { | |
| 49 int type; | |
| 50 union { | |
| 51 double number; | |
| 52 const char *string; | |
| 53 fz_json_array *array; | |
| 54 fz_json_object *object; | |
| 55 } u; | |
| 56 }; | |
| 57 | |
| 58 struct fz_json_array | |
| 59 { | |
| 60 fz_json *value; | |
| 61 fz_json_array *next; | |
| 62 }; | |
| 63 | |
| 64 struct fz_json_object | |
| 65 { | |
| 66 const char *key; | |
| 67 fz_json *value; | |
| 68 fz_json_object *next; | |
| 69 }; | |
| 70 | |
| 71 fz_json *fz_parse_json(fz_context *ctx, fz_pool *pool, const char *s); | |
| 72 | |
| 73 void fz_append_json(fz_context *ctx, fz_buffer *buf, fz_json *value); | |
| 74 void fz_write_json(fz_context *ctx, fz_output *out, fz_json *value); | |
| 75 | |
| 76 fz_json *fz_json_new_null(fz_context *ctx, fz_pool *pool); | |
| 77 fz_json *fz_json_new_boolean(fz_context *ctx, fz_pool *pool, int x); | |
| 78 fz_json *fz_json_new_number(fz_context *ctx, fz_pool *pool, double number); | |
| 79 fz_json *fz_json_new_string(fz_context *ctx, fz_pool *pool, const char *string); | |
| 80 fz_json *fz_json_new_array(fz_context *ctx, fz_pool *pool); | |
| 81 fz_json *fz_json_new_object(fz_context *ctx, fz_pool *pool); | |
| 82 void fz_json_array_push(fz_context *ctx, fz_pool *pool, fz_json *array, fz_json *item); | |
| 83 void fz_json_object_set(fz_context *ctx, fz_pool *pool, fz_json *object, const char *key, fz_json *item); | |
| 84 | |
| 85 int fz_json_is_null(fz_context *ctx, fz_json *json); | |
| 86 int fz_json_is_boolean(fz_context *ctx, fz_json *json); | |
| 87 int fz_json_is_number(fz_context *ctx, fz_json *json); | |
| 88 int fz_json_is_string(fz_context *ctx, fz_json *json); | |
| 89 int fz_json_is_array(fz_context *ctx, fz_json *json); | |
| 90 int fz_json_is_object(fz_context *ctx, fz_json *json); | |
| 91 int fz_json_to_boolean(fz_context *ctx, fz_json *json); | |
| 92 double fz_json_to_number(fz_context *ctx, fz_json *json); | |
| 93 const char *fz_json_to_string(fz_context *ctx, fz_json *json); | |
| 94 int fz_json_array_length(fz_context *ctx, fz_json *array); | |
| 95 fz_json *fz_json_array_get(fz_context *ctx, fz_json *array, int ix); | |
| 96 fz_json *fz_json_object_get(fz_context *ctx, fz_json *object, const char *key); | |
| 97 | |
| 98 #endif |
