aboutsummaryrefslogtreecommitdiffstats
path: root/include/qpdf/JSON.hh
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-04 22:28:12 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-07 01:14:52 +0200
commit0500d4347a6d31ef05fd860559e380c2e488c194 (patch)
tree26a22f65b7400d7fd26df5720fe2bbabd7b6de09 /include/qpdf/JSON.hh
parent05fda4afa289ef248804865d7648c9ac3ae75fbd (diff)
downloadqpdf-0500d4347a6d31ef05fd860559e380c2e488c194.tar.zst
JSON: add blob type that generates base64-encoded binary data
Diffstat (limited to 'include/qpdf/JSON.hh')
-rw-r--r--include/qpdf/JSON.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/qpdf/JSON.hh b/include/qpdf/JSON.hh
index 435c2362..4f4162fc 100644
--- a/include/qpdf/JSON.hh
+++ b/include/qpdf/JSON.hh
@@ -122,6 +122,13 @@ class JSON
QPDF_DLL
static JSON makeNull();
+ // A blob serializes as a string. The function will be called by
+ // JSON with a pipeline and should write binary data to the
+ // pipeline but not call finish(). JSON will call finish() at the
+ // right time.
+ QPDF_DLL
+ static JSON makeBlob(std::function<void(Pipeline*)>);
+
QPDF_DLL
bool isArray() const;
@@ -323,6 +330,13 @@ class JSON
virtual ~JSON_null() = default;
virtual void write(Pipeline*, size_t depth) const;
};
+ struct JSON_blob: public JSON_value
+ {
+ JSON_blob(std::function<void(Pipeline*)> fn);
+ virtual ~JSON_blob() = default;
+ virtual void write(Pipeline*, size_t depth) const;
+ std::function<void(Pipeline*)> fn;
+ };
JSON(std::shared_ptr<JSON_value>);