mirror of
https://github.com/qpdf/qpdf.git
synced 2024-05-29 00:10:54 +00:00
Tidy QPDFJob::doJSONObjects
This commit is contained in:
parent
9db2965f62
commit
50bc82b4e0
|
@ -1043,7 +1043,7 @@ QPDFJob::doJSONObjects(Pipeline* p, bool& first, QPDF& pdf)
|
||||||
bool first_object = true;
|
bool first_object = true;
|
||||||
JSON::writeDictionaryOpen(p, first_object, 1);
|
JSON::writeDictionaryOpen(p, first_object, 1);
|
||||||
bool all_objects = m->json_objects.empty();
|
bool all_objects = m->json_objects.empty();
|
||||||
std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
|
auto wanted_og = getWantedJSONObjects();
|
||||||
for (auto& obj: pdf.getAllObjects()) {
|
for (auto& obj: pdf.getAllObjects()) {
|
||||||
std::string key = obj.unparse();
|
std::string key = obj.unparse();
|
||||||
if (this->m->json_version > 1) {
|
if (this->m->json_version > 1) {
|
||||||
|
@ -1063,11 +1063,8 @@ QPDFJob::doJSONObjects(Pipeline* p, bool& first, QPDF& pdf)
|
||||||
if (this->m->json_objects.count("trailer")) {
|
if (this->m->json_objects.count("trailer")) {
|
||||||
json_objects.insert("trailer");
|
json_objects.insert("trailer");
|
||||||
}
|
}
|
||||||
auto wanted = getWantedJSONObjects();
|
for (auto og: getWantedJSONObjects()) {
|
||||||
for (auto const& og: wanted) {
|
json_objects.emplace("obj:" + og.unparse(' ') + " R");
|
||||||
std::ostringstream s;
|
|
||||||
s << "obj:" << og.unparse(' ') << " R";
|
|
||||||
json_objects.insert(s.str());
|
|
||||||
}
|
}
|
||||||
pdf.writeJSON(
|
pdf.writeJSON(
|
||||||
this->m->json_version,
|
this->m->json_version,
|
||||||
|
@ -1088,7 +1085,7 @@ QPDFJob::doJSONObjectinfo(Pipeline* p, bool& first, QPDF& pdf)
|
||||||
bool first_object = true;
|
bool first_object = true;
|
||||||
JSON::writeDictionaryOpen(p, first_object, 1);
|
JSON::writeDictionaryOpen(p, first_object, 1);
|
||||||
bool all_objects = m->json_objects.empty();
|
bool all_objects = m->json_objects.empty();
|
||||||
std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
|
auto wanted_og = getWantedJSONObjects();
|
||||||
for (auto& obj: pdf.getAllObjects()) {
|
for (auto& obj: pdf.getAllObjects()) {
|
||||||
if (all_objects || wanted_og.count(obj.getObjGen())) {
|
if (all_objects || wanted_og.count(obj.getObjGen())) {
|
||||||
auto j_details = JSON::makeDictionary();
|
auto j_details = JSON::makeDictionary();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user