mirror of https://github.com/qpdf/qpdf.git
QDPFJob: incorporate change to JSONHandler for array start function
This commit is contained in:
parent
3b60224bae
commit
fa9676557e
|
@ -562,8 +562,21 @@ class Main:
|
|||
if isinstance(v[0], dict):
|
||||
is_dict = True
|
||||
schema_value = [{}]
|
||||
subpath = f'{path}.{schema_key}'
|
||||
identifier = self.to_identifier(subpath, '', False)
|
||||
self.json_decls.append(
|
||||
f'void begin{identifier}Array(JSON);')
|
||||
self.json_decls.append(
|
||||
f'void end{identifier}Array();')
|
||||
self.json_init.append(
|
||||
f'beginArray("{flag}",'
|
||||
f' bindJSON(&Handlers::begin{identifier}Array),'
|
||||
f' bindBare(&Handlers::end{identifier}Array));'
|
||||
f' // {subpath}[]')
|
||||
build_schema(v[0], schema_value[0],
|
||||
schema_key, f'{path}.{schema_key}')
|
||||
schema_key, subpath)
|
||||
self.json_init.append(
|
||||
f'endContainer(); // {subpath}[]')
|
||||
elif schema_value is None:
|
||||
raise Exception(f'unknown schema value for {k}')
|
||||
s[schema_key] = schema_value
|
||||
|
@ -573,7 +586,7 @@ class Main:
|
|||
else:
|
||||
self.handle_json_manual(schema_key, path)
|
||||
if flag:
|
||||
self.json_init.append(f'endDict(); // {path}')
|
||||
self.json_init.append(f'endContainer(); // {path}')
|
||||
|
||||
build_schema(data['json'], self.schema, '', '')
|
||||
if options_seen != set(expected.keys()):
|
||||
|
|
6
job.sums
6
job.sums
|
@ -1,5 +1,5 @@
|
|||
# Generated by generate_auto_job
|
||||
generate_auto_job e4a071599697cc0f4d985367735ac6ed6110575e2cbfa01406d048780466d546
|
||||
generate_auto_job 68c39a9f6d1f10c1b9cf9af539036621589d6b0bbf3d05a2e1ddd1c9919d7383
|
||||
include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e
|
||||
include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee
|
||||
include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265
|
||||
|
@ -10,8 +10,8 @@ job.yml 6389b89c25f0f07fa54bfc3d9f24f814aac5566ace43666f81476781db616ea1
|
|||
libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6
|
||||
libqpdf/qpdf/auto_job_help.hh 23c79f1d2c02bda28f64aace17f69487205c797e7ae2234892cbbabab49d6d47
|
||||
libqpdf/qpdf/auto_job_init.hh 8e9e31b6099a662497339b27f6e2d7f779f35011e88a834bee8811c33405a0fe
|
||||
libqpdf/qpdf/auto_job_json_decl.hh 8a6e3b25e01969f1c8e2c9ec781f7f2e89b57e67e65d5dc7445ad9124b694b9a
|
||||
libqpdf/qpdf/auto_job_json_init.hh 48888c602de4cc13040cff26569e162d6ebb5aec6ab959164d432cfe1058eb23
|
||||
libqpdf/qpdf/auto_job_json_decl.hh f349b55cf85d07a28aeb4bef257bdbcbe16f76b8065d01154161897b1e0fa643
|
||||
libqpdf/qpdf/auto_job_json_init.hh 9ea198c4daa6badb30690e2814f3d6ab761c09973a0712341081dabcb2097006
|
||||
libqpdf/qpdf/auto_job_schema.hh 9e19fb0b8ddd6fe13da12f1f98c27f6d558fc4706a56a63697e529b3140a457c
|
||||
manual/_ext/qpdf.py e9ac9d6c70642a3d29281ee5ad92ae2422dee8be9306fb8a0bc9dba0ed5e28f3
|
||||
manual/cli.rst 79140e023faa0cb77afe0b1dc512dd120ee5617f4db82f842596e4f239f93882
|
||||
|
|
|
@ -37,7 +37,10 @@ namespace
|
|||
void beginDict(std::string const& key,
|
||||
json_handler_t start_fn,
|
||||
bare_handler_t end_fn);
|
||||
void endDict();
|
||||
void beginArray(std::string const& key,
|
||||
json_handler_t start_fn,
|
||||
bare_handler_t end_fn);
|
||||
void endContainer();
|
||||
|
||||
bare_handler_t bindBare(void (Handlers::*f)());
|
||||
json_handler_t bindJSON(void (Handlers::*f)(JSON));
|
||||
|
@ -194,7 +197,23 @@ Handlers::beginDict(std::string const& key,
|
|||
}
|
||||
|
||||
void
|
||||
Handlers::endDict()
|
||||
Handlers::beginArray(std::string const& key,
|
||||
json_handler_t start_fn,
|
||||
bare_handler_t end_fn)
|
||||
{
|
||||
auto new_jh = std::make_shared<JSONHandler>();
|
||||
auto item_jh = std::make_shared<JSONHandler>();
|
||||
new_jh->addArrayHandlers(
|
||||
[start_fn](std::string const&, JSON j){ start_fn(j); },
|
||||
[end_fn](std::string const&){ end_fn(); },
|
||||
item_jh);
|
||||
this->jh->addDictKeyHandler(key, new_jh);
|
||||
this->json_handlers.push_back(item_jh);
|
||||
this->jh = item_jh.get();
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::endContainer()
|
||||
{
|
||||
this->json_handlers.pop_back();
|
||||
this->jh = this->json_handlers.back().get();
|
||||
|
@ -404,6 +423,18 @@ Handlers::endInspect()
|
|||
// nothing needed
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::beginOptionsAddAttachmentArray(JSON)
|
||||
{
|
||||
// QXXXQ
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::endOptionsAddAttachmentArray()
|
||||
{
|
||||
// QXXXQ
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::beginOptionsAddAttachment(JSON)
|
||||
{
|
||||
|
@ -425,6 +456,18 @@ Handlers::setupOptionsAddAttachmentPath(std::string const& key)
|
|||
});
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::beginOptionsCopyAttachmentsFromArray(JSON)
|
||||
{
|
||||
// QXXXQ
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::endOptionsCopyAttachmentsFromArray()
|
||||
{
|
||||
// QXXXQ
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::beginOptionsCopyAttachmentsFrom(JSON)
|
||||
{
|
||||
|
@ -454,6 +497,18 @@ Handlers::setupOptionsCopyAttachmentsFromPassword(std::string const& key)
|
|||
});
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::beginOptionsPagesArray(JSON)
|
||||
{
|
||||
// QXXXQ
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::endOptionsPagesArray()
|
||||
{
|
||||
// QXXXQ
|
||||
}
|
||||
|
||||
void
|
||||
Handlers::beginOptionsPages(JSON)
|
||||
{
|
||||
|
|
|
@ -28,13 +28,19 @@ void beginInspect(JSON);
|
|||
void endInspect();
|
||||
void beginOptions(JSON);
|
||||
void endOptions();
|
||||
void beginOptionsAddAttachmentArray(JSON);
|
||||
void endOptionsAddAttachmentArray();
|
||||
void beginOptionsAddAttachment(JSON);
|
||||
void endOptionsAddAttachment();
|
||||
void setupOptionsAddAttachmentPath(std::string const&);
|
||||
void beginOptionsCopyAttachmentsFromArray(JSON);
|
||||
void endOptionsCopyAttachmentsFromArray();
|
||||
void beginOptionsCopyAttachmentsFrom(JSON);
|
||||
void endOptionsCopyAttachmentsFrom();
|
||||
void setupOptionsCopyAttachmentsFromPath(std::string const&);
|
||||
void setupOptionsCopyAttachmentsFromPassword(std::string const&);
|
||||
void beginOptionsPagesArray(JSON);
|
||||
void endOptionsPagesArray();
|
||||
void beginOptionsPages(JSON);
|
||||
void endOptionsPages();
|
||||
void setupOptionsPagesFile(std::string const&);
|
||||
|
|
|
@ -19,7 +19,7 @@ doSetup("filename", bindSetup(&Handlers::setupInputFilename));
|
|||
doSetup("password", bindSetup(&Handlers::setupInputPassword));
|
||||
addParameter("passwordFile", [this](char const* p) { c_main->passwordFile(p); });
|
||||
doSetup("empty", bindSetup(&Handlers::setupInputEmpty));
|
||||
endDict(); // .input
|
||||
endContainer(); // .input
|
||||
beginDict("output", bindJSON(&Handlers::beginOutput), bindBare(&Handlers::endOutput)); // .output
|
||||
doSetup("filename", bindSetup(&Handlers::setupOutputFilename));
|
||||
doSetup("replaceInput", bindSetup(&Handlers::setupOutputReplaceInput));
|
||||
|
@ -53,7 +53,7 @@ addChoices("annotate", yn_choices, [this](char const* p) { c_enc->annotate(p); }
|
|||
addChoices("extract", yn_choices, [this](char const* p) { c_enc->extract(p); });
|
||||
addChoices("modify", modify128_choices, [this](char const* p) { c_enc->modify(p); });
|
||||
addChoices("print", print128_choices, [this](char const* p) { c_enc->print(p); });
|
||||
endDict(); // .output.options.encrypt.40bit
|
||||
endContainer(); // .output.options.encrypt.40bit
|
||||
beginDict("128bit", bindJSON(&Handlers::beginOutputOptionsEncrypt128bit), bindBare(&Handlers::endOutputOptionsEncrypt128bit)); // .output.options.encrypt.128bit
|
||||
addChoices("accessibility", yn_choices, [this](char const* p) { c_enc->accessibility(p); });
|
||||
addChoices("annotate", yn_choices, [this](char const* p) { c_enc->annotate(p); });
|
||||
|
@ -66,7 +66,7 @@ addChoices("modify", modify128_choices, [this](char const* p) { c_enc->modify(p)
|
|||
addChoices("print", print128_choices, [this](char const* p) { c_enc->print(p); });
|
||||
addBare("forceV4", [this]() { c_enc->forceV4(); });
|
||||
addChoices("useAes", yn_choices, [this](char const* p) { c_enc->useAes(p); });
|
||||
endDict(); // .output.options.encrypt.128bit
|
||||
endContainer(); // .output.options.encrypt.128bit
|
||||
beginDict("256bit", bindJSON(&Handlers::beginOutputOptionsEncrypt256bit), bindBare(&Handlers::endOutputOptionsEncrypt256bit)); // .output.options.encrypt.256bit
|
||||
addChoices("accessibility", yn_choices, [this](char const* p) { c_enc->accessibility(p); });
|
||||
addChoices("annotate", yn_choices, [this](char const* p) { c_enc->annotate(p); });
|
||||
|
@ -79,10 +79,10 @@ addChoices("modify", modify128_choices, [this](char const* p) { c_enc->modify(p)
|
|||
addChoices("print", print128_choices, [this](char const* p) { c_enc->print(p); });
|
||||
addBare("allowInsecure", [this]() { c_enc->allowInsecure(); });
|
||||
addBare("forceR5", [this]() { c_enc->forceR5(); });
|
||||
endDict(); // .output.options.encrypt.256bit
|
||||
endDict(); // .output.options.encrypt
|
||||
endDict(); // .output.options
|
||||
endDict(); // .output
|
||||
endContainer(); // .output.options.encrypt.256bit
|
||||
endContainer(); // .output.options.encrypt
|
||||
endContainer(); // .output.options
|
||||
endContainer(); // .output
|
||||
beginDict("inspect", bindJSON(&Handlers::beginInspect), bindBare(&Handlers::endInspect)); // .inspect
|
||||
addBare("check", [this]() { c_main->check(); });
|
||||
addBare("checkLinearization", [this]() { c_main->checkLinearization(); });
|
||||
|
@ -103,7 +103,7 @@ addParameter("showAttachment", [this](char const* p) { c_main->showAttachment(p)
|
|||
addBare("json", [this]() { c_main->json(); });
|
||||
addChoices("jsonKey", json_key_choices, [this](char const* p) { c_main->jsonKey(p); });
|
||||
addParameter("jsonObject", [this](char const* p) { c_main->jsonObject(p); });
|
||||
endDict(); // .inspect
|
||||
endContainer(); // .inspect
|
||||
beginDict("options", bindJSON(&Handlers::beginOptions), bindBare(&Handlers::endOptions)); // .options
|
||||
addBare("allowWeakCrypto", [this]() { c_main->allowWeakCrypto(); });
|
||||
addBare("deterministicId", [this]() { c_main->deterministicId(); });
|
||||
|
@ -122,6 +122,7 @@ addParameter("compressionLevel", [this](char const* p) { c_main->compressionLeve
|
|||
addBare("externalizeInlineImages", [this]() { c_main->externalizeInlineImages(); });
|
||||
addParameter("iiMinBytes", [this](char const* p) { c_main->iiMinBytes(p); });
|
||||
addChoices("removeUnreferencedResources", remove_unref_choices, [this](char const* p) { c_main->removeUnreferencedResources(p); });
|
||||
beginArray("options", bindJSON(&Handlers::beginOptionsAddAttachmentArray), bindBare(&Handlers::endOptionsAddAttachmentArray)); // .options.addAttachment[]
|
||||
beginDict("addAttachment", bindJSON(&Handlers::beginOptionsAddAttachment), bindBare(&Handlers::endOptionsAddAttachment)); // .options.addAttachment
|
||||
doSetup("path", bindSetup(&Handlers::setupOptionsAddAttachmentPath));
|
||||
addParameter("creationdate", [this](char const* p) { c_att->creationdate(p); });
|
||||
|
@ -131,13 +132,16 @@ addParameter("key", [this](char const* p) { c_att->key(p); });
|
|||
addParameter("mimetype", [this](char const* p) { c_att->mimetype(p); });
|
||||
addParameter("moddate", [this](char const* p) { c_att->moddate(p); });
|
||||
addBare("replace", [this]() { c_att->replace(); });
|
||||
endDict(); // .options.addAttachment
|
||||
endContainer(); // .options.addAttachment
|
||||
endContainer(); // .options.addAttachment[]
|
||||
addParameter("removeAttachment", [this](char const* p) { c_main->removeAttachment(p); });
|
||||
beginArray("options", bindJSON(&Handlers::beginOptionsCopyAttachmentsFromArray), bindBare(&Handlers::endOptionsCopyAttachmentsFromArray)); // .options.copyAttachmentsFrom[]
|
||||
beginDict("copyAttachmentsFrom", bindJSON(&Handlers::beginOptionsCopyAttachmentsFrom), bindBare(&Handlers::endOptionsCopyAttachmentsFrom)); // .options.copyAttachmentsFrom
|
||||
doSetup("path", bindSetup(&Handlers::setupOptionsCopyAttachmentsFromPath));
|
||||
doSetup("password", bindSetup(&Handlers::setupOptionsCopyAttachmentsFromPassword));
|
||||
addParameter("prefix", [this](char const* p) { c_copy_att->prefix(p); });
|
||||
endDict(); // .options.copyAttachmentsFrom
|
||||
endContainer(); // .options.copyAttachmentsFrom
|
||||
endContainer(); // .options.copyAttachmentsFrom[]
|
||||
addParameter("collate", [this](char const* p) { c_main->collate(p); });
|
||||
addChoices("flattenAnnotations", flatten_choices, [this](char const* p) { c_main->flattenAnnotations(p); });
|
||||
addBare("flattenRotation", [this]() { c_main->flattenRotation(); });
|
||||
|
@ -147,11 +151,13 @@ addParameter("oiMinArea", [this](char const* p) { c_main->oiMinArea(p); });
|
|||
addParameter("oiMinHeight", [this](char const* p) { c_main->oiMinHeight(p); });
|
||||
addParameter("oiMinWidth", [this](char const* p) { c_main->oiMinWidth(p); });
|
||||
addBare("optimizeImages", [this]() { c_main->optimizeImages(); });
|
||||
beginArray("options", bindJSON(&Handlers::beginOptionsPagesArray), bindBare(&Handlers::endOptionsPagesArray)); // .options.pages[]
|
||||
beginDict("pages", bindJSON(&Handlers::beginOptionsPages), bindBare(&Handlers::endOptionsPages)); // .options.pages
|
||||
doSetup("file", bindSetup(&Handlers::setupOptionsPagesFile));
|
||||
doSetup("password", bindSetup(&Handlers::setupOptionsPagesPassword));
|
||||
doSetup("range", bindSetup(&Handlers::setupOptionsPagesRange));
|
||||
endDict(); // .options.pages
|
||||
endContainer(); // .options.pages
|
||||
endContainer(); // .options.pages[]
|
||||
addBare("removePageLabels", [this]() { c_main->removePageLabels(); });
|
||||
addParameter("rotate", [this](char const* p) { c_main->rotate(p); });
|
||||
beginDict("overlay", bindJSON(&Handlers::beginOptionsOverlay), bindBare(&Handlers::endOptionsOverlay)); // .options.overlay
|
||||
|
@ -160,12 +166,12 @@ doSetup("password", bindSetup(&Handlers::setupOptionsOverlayPassword));
|
|||
addParameter("from", [this](char const* p) { c_uo->from(p); });
|
||||
addParameter("repeat", [this](char const* p) { c_uo->repeat(p); });
|
||||
addParameter("to", [this](char const* p) { c_uo->to(p); });
|
||||
endDict(); // .options.overlay
|
||||
endContainer(); // .options.overlay
|
||||
beginDict("underlay", bindJSON(&Handlers::beginOptionsUnderlay), bindBare(&Handlers::endOptionsUnderlay)); // .options.underlay
|
||||
doSetup("file", bindSetup(&Handlers::setupOptionsUnderlayFile));
|
||||
doSetup("password", bindSetup(&Handlers::setupOptionsUnderlayPassword));
|
||||
addParameter("from", [this](char const* p) { c_uo->from(p); });
|
||||
addParameter("repeat", [this](char const* p) { c_uo->repeat(p); });
|
||||
addParameter("to", [this](char const* p) { c_uo->to(p); });
|
||||
endDict(); // .options.underlay
|
||||
endDict(); // .options
|
||||
endContainer(); // .options.underlay
|
||||
endContainer(); // .options
|
||||
|
|
Loading…
Reference in New Issue