aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDF.hh29
1 files changed, 21 insertions, 8 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 5cba93a8..61efa4ed 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -115,22 +115,18 @@ class QPDF
// complete representation of a PDF. See "QPDF JSON Format" in the
// manual for details.
QPDF_DLL
- void
- createFromJSON(std::string const& json_file);
+ void createFromJSON(std::string const& json_file);
QPDF_DLL
- void
- createFromJSON(std::shared_ptr<InputSource>);
+ void createFromJSON(std::shared_ptr<InputSource>);
// Update a PDF from an input source that contains JSON in the
// same format as is written by qpdf --json (version 2 or higher).
// Objects in the PDF and not in the JSON are not modified. See
// "QPDF JSON Format" in the manual for details.
QPDF_DLL
- void
- updateFromJSON(std::string const& json_file);
+ void updateFromJSON(std::string const& json_file);
QPDF_DLL
- void
- updateFromJSON(std::shared_ptr<InputSource>);
+ void updateFromJSON(std::shared_ptr<InputSource>);
// Close or otherwise release the input source. Once this has been
// called, no other methods of qpdf can be called safely except
@@ -999,6 +995,20 @@ class QPDF
};
friend class ResolveRecorder;
+ class JSONReactor: public JSON::Reactor
+ {
+ public:
+ virtual ~JSONReactor() = default;
+ virtual void dictionaryStart() override;
+ virtual void arrayStart() override;
+ virtual void containerEnd(JSON const& value) override;
+ virtual void topLevelScalar() override;
+ virtual bool
+ dictionaryItem(std::string const& key, JSON const& value) override;
+ virtual bool arrayItem(JSON const& value) override;
+ };
+ friend class JSONReactor;
+
void parse(char const* password);
void inParse(bool);
void setTrailer(QPDFObjectHandle obj);
@@ -1508,6 +1518,9 @@ class QPDF
int depth);
void filterCompressedObjects(std::map<int, int> const& object_stream_data);
+ // JSON import
+ void importJSON(std::shared_ptr<InputSource>, bool must_be_complete);
+
// Type conversion helper methods
template <typename T>
static qpdf_offset_t