diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-01-30 15:44:17 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-01-31 11:56:59 +0100 |
commit | e4b3a9d4c74272d421492b4967c6190cf26f8a73 (patch) | |
tree | 9ea0fd22e7ab95dedb3b6bb47da0878c22df5b5b /source/pdf/pdf-object.c | |
parent | e0573b69bcfe1bcdf0151d59806e1ff67ab53f41 (diff) | |
download | mupdf-e4b3a9d4c74272d421492b4967c6190cf26f8a73.tar.xz |
Add convenience functions to set dict/array values by primitives.
Diffstat (limited to 'source/pdf/pdf-object.c')
-rw-r--r-- | source/pdf/pdf-object.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index b2ff3629..3d694d0c 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -2155,3 +2155,75 @@ int pdf_obj_refs(fz_context *ctx, pdf_obj *ref) { return (ref >= PDF_OBJ__LIMIT ? ref->refs : 0); } + +/* Convenience functions */ + +void pdf_dict_put_bool(fz_context *ctx, pdf_obj *dict, pdf_obj *key, int x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_bool(ctx, NULL, x)); +} + +void pdf_dict_put_int(fz_context *ctx, pdf_obj *dict, pdf_obj *key, int64_t x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_int(ctx, NULL, x)); +} + +void pdf_dict_put_real(fz_context *ctx, pdf_obj *dict, pdf_obj *key, double x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_real(ctx, NULL, x)); +} + +void pdf_dict_put_name(fz_context *ctx, pdf_obj *dict, pdf_obj *key, const char *x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_name(ctx, NULL, x)); +} + +void pdf_dict_put_string(fz_context *ctx, pdf_obj *dict, pdf_obj *key, const char *x, size_t n) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_string(ctx, NULL, x, n)); +} + +void pdf_dict_put_text_string(fz_context *ctx, pdf_obj *dict, pdf_obj *key, const char *x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_text_string(ctx, NULL, x)); +} + +void pdf_dict_put_rect(fz_context *ctx, pdf_obj *dict, pdf_obj *key, const fz_rect *x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_rect(ctx, NULL, x)); +} + +void pdf_dict_put_matrix(fz_context *ctx, pdf_obj *dict, pdf_obj *key, const fz_matrix *x) +{ + pdf_dict_put_drop(ctx, dict, key, pdf_new_matrix(ctx, NULL, x)); +} + +void pdf_array_push_bool(fz_context *ctx, pdf_obj *array, int x) +{ + pdf_array_push_drop(ctx, array, pdf_new_bool(ctx, NULL, x)); +} + +void pdf_array_push_int(fz_context *ctx, pdf_obj *array, int64_t x) +{ + pdf_array_push_drop(ctx, array, pdf_new_int(ctx, NULL, x)); +} + +void pdf_array_push_real(fz_context *ctx, pdf_obj *array, double x) +{ + pdf_array_push_drop(ctx, array, pdf_new_real(ctx, NULL, x)); +} + +void pdf_array_push_name(fz_context *ctx, pdf_obj *array, const char *x) +{ + pdf_array_push_drop(ctx, array, pdf_new_name(ctx, NULL, x)); +} + +void pdf_array_push_string(fz_context *ctx, pdf_obj *array, const char *x, size_t n) +{ + pdf_array_push_drop(ctx, array, pdf_new_string(ctx, NULL, x, n)); +} + +void pdf_array_push_text_string(fz_context *ctx, pdf_obj *array, const char *x) +{ + pdf_array_push_drop(ctx, array, pdf_new_text_string(ctx, NULL, x)); +} |