mirror of
https://github.com/qpdf/qpdf.git
synced 2024-05-30 08:50:51 +00:00
Clean up some private functions
This commit is contained in:
parent
8d229e078f
commit
b776dcd2d3
3
TODO
3
TODO
|
@ -16,9 +16,6 @@ Do these things next time we have to break binary compatibility
|
|||
* Rename QUtil::strcasecmp since strcasecmp is a macro on some
|
||||
platforms. See #242.
|
||||
|
||||
* Collapse QPDF::pushInheritedAttributesToPageInternal* and
|
||||
QPDF::getAllPagesInternal* into QPDF::*Internal.
|
||||
|
||||
* Get rid of the version of QPDF::copyForeignObject with the bool
|
||||
unused parameter.
|
||||
|
||||
|
|
|
@ -898,14 +898,9 @@ class QPDF
|
|||
// methods to support page handling
|
||||
|
||||
void getAllPagesInternal(QPDFObjectHandle cur_pages,
|
||||
std::vector<QPDFObjectHandle>& result);
|
||||
void getAllPagesInternal2(QPDFObjectHandle cur_pages,
|
||||
std::vector<QPDFObjectHandle>& result,
|
||||
std::set<QPDFObjGen>& visited);
|
||||
void getAllPagesInternal3(QPDFObjectHandle cur_pages,
|
||||
std::vector<QPDFObjectHandle>& result,
|
||||
std::set<QPDFObjGen>& visited,
|
||||
std::set<QPDFObjGen>& seen);
|
||||
std::vector<QPDFObjectHandle>& result,
|
||||
std::set<QPDFObjGen>& visited,
|
||||
std::set<QPDFObjGen>& seen);
|
||||
void insertPage(QPDFObjectHandle newpage, int pos);
|
||||
int findPage(QPDFObjGen const& og);
|
||||
int findPage(QPDFObjectHandle& page);
|
||||
|
@ -1290,11 +1285,6 @@ class QPDF
|
|||
void pushInheritedAttributesToPage(bool allow_changes,
|
||||
bool warn_skipped_keys);
|
||||
void pushInheritedAttributesToPageInternal(
|
||||
QPDFObjectHandle,
|
||||
std::map<std::string, std::vector<QPDFObjectHandle> >&,
|
||||
std::vector<QPDFObjectHandle>& all_pages,
|
||||
bool allow_changes, bool warn_skipped_keys);
|
||||
void pushInheritedAttributesToPageInternal2(
|
||||
QPDFObjectHandle,
|
||||
std::map<std::string, std::vector<QPDFObjectHandle> >&,
|
||||
std::vector<QPDFObjectHandle>& all_pages,
|
||||
|
|
|
@ -163,9 +163,11 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
|
|||
// Pages nodes that contain values for them.
|
||||
std::map<std::string, std::vector<QPDFObjectHandle> > key_ancestors;
|
||||
this->m->all_pages.clear();
|
||||
std::set<QPDFObjGen> visited;
|
||||
pushInheritedAttributesToPageInternal(
|
||||
this->m->trailer.getKey("/Root").getKey("/Pages"),
|
||||
key_ancestors, this->m->all_pages, allow_changes, warn_skipped_keys);
|
||||
key_ancestors, this->m->all_pages, allow_changes, warn_skipped_keys,
|
||||
visited);
|
||||
if (! key_ancestors.empty())
|
||||
{
|
||||
throw std::logic_error(
|
||||
|
@ -177,19 +179,6 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
|
|||
|
||||
void
|
||||
QPDF::pushInheritedAttributesToPageInternal(
|
||||
QPDFObjectHandle cur_pages,
|
||||
std::map<std::string, std::vector<QPDFObjectHandle> >& key_ancestors,
|
||||
std::vector<QPDFObjectHandle>& pages,
|
||||
bool allow_changes, bool warn_skipped_keys)
|
||||
{
|
||||
std::set<QPDFObjGen> visited;
|
||||
pushInheritedAttributesToPageInternal2(
|
||||
cur_pages, key_ancestors, pages, allow_changes,
|
||||
warn_skipped_keys, visited);
|
||||
}
|
||||
|
||||
void
|
||||
QPDF::pushInheritedAttributesToPageInternal2(
|
||||
QPDFObjectHandle cur_pages,
|
||||
std::map<std::string, std::vector<QPDFObjectHandle> >& key_ancestors,
|
||||
std::vector<QPDFObjectHandle>& pages,
|
||||
|
@ -291,7 +280,7 @@ QPDF::pushInheritedAttributesToPageInternal2(
|
|||
int n = kids.getArrayNItems();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
pushInheritedAttributesToPageInternal2(
|
||||
pushInheritedAttributesToPageInternal(
|
||||
kids.getArrayItem(i), key_ancestors, pages,
|
||||
allow_changes, warn_skipped_keys, visited);
|
||||
}
|
||||
|
|
|
@ -47,33 +47,19 @@ QPDF::getAllPages()
|
|||
// initialize this->m->all_pages.
|
||||
if (this->m->all_pages.empty())
|
||||
{
|
||||
getAllPagesInternal(getRoot().getKey("/Pages"), this->m->all_pages);
|
||||
std::set<QPDFObjGen> visited;
|
||||
std::set<QPDFObjGen> seen;
|
||||
getAllPagesInternal(getRoot().getKey("/Pages"), this->m->all_pages,
|
||||
visited, seen);
|
||||
}
|
||||
return this->m->all_pages;
|
||||
}
|
||||
|
||||
void
|
||||
QPDF::getAllPagesInternal(QPDFObjectHandle cur_pages,
|
||||
std::vector<QPDFObjectHandle>& result)
|
||||
{
|
||||
std::set<QPDFObjGen> visited;
|
||||
getAllPagesInternal2(cur_pages, result, visited);
|
||||
}
|
||||
|
||||
void
|
||||
QPDF::getAllPagesInternal2(QPDFObjectHandle cur_pages,
|
||||
std::vector<QPDFObjectHandle>& result,
|
||||
std::set<QPDFObjGen>& visited)
|
||||
{
|
||||
std::set<QPDFObjGen> seen;
|
||||
getAllPagesInternal3(cur_pages, result, visited, seen);
|
||||
}
|
||||
|
||||
void
|
||||
QPDF::getAllPagesInternal3(QPDFObjectHandle cur_pages,
|
||||
std::vector<QPDFObjectHandle>& result,
|
||||
std::set<QPDFObjGen>& visited,
|
||||
std::set<QPDFObjGen>& seen)
|
||||
std::vector<QPDFObjectHandle>& result,
|
||||
std::set<QPDFObjGen>& visited,
|
||||
std::set<QPDFObjGen>& seen)
|
||||
{
|
||||
QPDFObjGen this_og = cur_pages.getObjGen();
|
||||
if (visited.count(this_og) > 0)
|
||||
|
@ -119,7 +105,7 @@ QPDF::getAllPagesInternal3(QPDFObjectHandle cur_pages,
|
|||
kid = makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
|
||||
kids.setArrayItem(i, kid);
|
||||
}
|
||||
getAllPagesInternal3(kid, result, visited, seen);
|
||||
getAllPagesInternal(kid, result, visited, seen);
|
||||
}
|
||||
}
|
||||
else if (type == "/Page")
|
||||
|
|
Loading…
Reference in New Issue
Block a user