2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-02 10:20:52 +00:00

Remove ObjUser::key

This commit is contained in:
m-holger 2023-06-23 11:05:37 +01:00
parent 86cab4ee59
commit a3acd57b18
2 changed files with 10 additions and 25 deletions

View File

@ -1299,12 +1299,10 @@ class QPDF
bool operator<(ObjUser const& rhs) const;
const user_e ou_type{ou_bad};
const int pageno{0}; // if ou_page or ou_thumb;
const std::string key{}; // if ou_trailer_key or ou_root_key
const int pageno{0};
private:
ObjUser(user_e type, int pageno);
ObjUser(user_e type, std::string const& key);
};
class PatternFinder: public InputSource::Finder

View File

@ -15,12 +15,6 @@ QPDF::ObjUser::ObjUser(user_e type, int pageno) :
{
}
QPDF::ObjUser::ObjUser(user_e type, std::string const& key) :
ou_type(type),
key(key)
{
}
QPDF::ObjUser
QPDF::ObjUser::page(int pageno)
{
@ -42,37 +36,30 @@ QPDF::ObjUser::root(std::string const& key)
static const std::set<std::string> open_document_keys{
"/ViewerPreferences", "/PageMode", "/Threads", "/OpenAction", "/AcroForm"};
if (key == "/Outlines") {
return {ou_outlines, key};
return {ou_outlines, 0};
}
if (open_document_keys.count(key) > 0) {
return {ou_open_doc, key};
return {ou_open_doc, 0};
}
return {ou_other, key};
if (key == "/Pages") {
return {ou_other, 0};
}
return {ou_other, 1};
}
QPDF::ObjUser
QPDF::ObjUser::trailer(std::string const& key)
{
if (key == "/Encrypt") {
return {ou_open_doc, key};
return {ou_open_doc, 0};
}
return {ou_other, key};
return {ou_other, 2};
}
bool
QPDF::ObjUser::operator<(ObjUser const& rhs) const
{
if (this->ou_type < rhs.ou_type) {
return true;
} else if (this->ou_type == rhs.ou_type) {
if (this->pageno < rhs.pageno) {
return true;
} else if (this->pageno == rhs.pageno) {
return (this->key < rhs.key);
}
}
return false;
return ou_type < rhs.ou_type || (ou_type == rhs.ou_type && pageno < rhs.pageno);
}
void