aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFNameTreeObjectHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-16 19:21:57 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-16 19:35:27 +0200
commit75fe4f60c3f59af30cb1d8f2b5902d866c05550a (patch)
tree81106c6129626417cb9f71ab31393b31f9c27078 /libqpdf/QPDFNameTreeObjectHelper.cc
parent38edca820eac0a79fd860895b46dd03005e3c96b (diff)
downloadqpdf-75fe4f60c3f59af30cb1d8f2b5902d866c05550a.tar.zst
Use anonymous namespaces for file-private classes
Diffstat (limited to 'libqpdf/QPDFNameTreeObjectHelper.cc')
-rw-r--r--libqpdf/QPDFNameTreeObjectHelper.cc49
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;