diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-16 19:21:57 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-16 19:35:27 +0200 |
commit | 75fe4f60c3f59af30cb1d8f2b5902d866c05550a (patch) | |
tree | 81106c6129626417cb9f71ab31393b31f9c27078 /libqpdf/QPDFNameTreeObjectHelper.cc | |
parent | 38edca820eac0a79fd860895b46dd03005e3c96b (diff) | |
download | qpdf-75fe4f60c3f59af30cb1d8f2b5902d866c05550a.tar.zst |
Use anonymous namespaces for file-private classes
Diffstat (limited to 'libqpdf/QPDFNameTreeObjectHelper.cc')
-rw-r--r-- | libqpdf/QPDFNameTreeObjectHelper.cc | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/libqpdf/QPDFNameTreeObjectHelper.cc b/libqpdf/QPDFNameTreeObjectHelper.cc index e079c844..f1adca0a 100644 --- a/libqpdf/QPDFNameTreeObjectHelper.cc +++ b/libqpdf/QPDFNameTreeObjectHelper.cc @@ -2,32 +2,35 @@ #include <qpdf/NNTree.hh> -class NameTreeDetails: public NNTreeDetails +namespace { - public: - virtual std::string const& - itemsKey() const override + class NameTreeDetails: public NNTreeDetails { - static std::string k("/Names"); - return k; - } - virtual bool - keyValid(QPDFObjectHandle oh) const override - { - return oh.isString(); - } - virtual int - compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override - { - if (!(keyValid(a) && keyValid(b))) { - // We don't call this without calling keyValid first - throw std::logic_error("comparing invalid keys"); + public: + virtual std::string const& + itemsKey() const override + { + static std::string k("/Names"); + return k; } - auto as = a.getUTF8Value(); - auto bs = b.getUTF8Value(); - return ((as < bs) ? -1 : (as > bs) ? 1 : 0); - } -}; + virtual bool + keyValid(QPDFObjectHandle oh) const override + { + return oh.isString(); + } + virtual int + compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override + { + if (!(keyValid(a) && keyValid(b))) { + // We don't call this without calling keyValid first + throw std::logic_error("comparing invalid keys"); + } + auto as = a.getUTF8Value(); + auto bs = b.getUTF8Value(); + return ((as < bs) ? -1 : (as > bs) ? 1 : 0); + } + }; +} // namespace static NameTreeDetails name_tree_details; |