mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-23 03:18:59 +00:00
Refactor QPDF_Array::unparse
This commit is contained in:
parent
c2ab0441b5
commit
0b53b648ab
@ -128,25 +128,34 @@ QPDF_Array::disconnect()
|
|||||||
std::string
|
std::string
|
||||||
QPDF_Array::unparse()
|
QPDF_Array::unparse()
|
||||||
{
|
{
|
||||||
|
std::string result = "[ ";
|
||||||
if (sparse) {
|
if (sparse) {
|
||||||
std::string result = "[ ";
|
int next = 0;
|
||||||
for (int i = 0; i < sp_size; ++i) {
|
for (auto& item: sp_elements) {
|
||||||
result += at(i).unparse();
|
int key = item.first;
|
||||||
result += " ";
|
for (int j = next; j < key; ++j) {
|
||||||
|
result += "null ";
|
||||||
|
}
|
||||||
|
item.second->resolve();
|
||||||
|
auto og = item.second->getObjGen();
|
||||||
|
result += og.isIndirect() ? og.unparse(' ') + " R "
|
||||||
|
: item.second->unparse() + " ";
|
||||||
|
next = ++key;
|
||||||
|
}
|
||||||
|
for (int j = next; j < sp_size; ++j) {
|
||||||
|
result += "null ";
|
||||||
}
|
}
|
||||||
result += "]";
|
|
||||||
return result;
|
|
||||||
} else {
|
} else {
|
||||||
std::string result = "[ ";
|
for (auto const& item: elements) {
|
||||||
auto size = elements.size();
|
item->resolve();
|
||||||
for (int i = 0; i < int(size); ++i) {
|
auto og = item->getObjGen();
|
||||||
result += at(i).unparse();
|
result += og.isIndirect() ? og.unparse(' ') + " R "
|
||||||
result += " ";
|
: item->unparse() + " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result += "]";
|
result += "]";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
JSON
|
JSON
|
||||||
QPDF_Array::getJSON(int json_version)
|
QPDF_Array::getJSON(int json_version)
|
||||||
|
Loading…
Reference in New Issue
Block a user