/src/qpdf/libqpdf/qpdf/global_private.hh
Line | Count | Source |
1 | | |
2 | | #ifndef GLOBAL_PRIVATE_HH |
3 | | #define GLOBAL_PRIVATE_HH |
4 | | |
5 | | #include <qpdf/Constants.h> |
6 | | |
7 | | #include <cstdint> |
8 | | #include <limits> |
9 | | |
10 | | namespace qpdf |
11 | | { |
12 | | namespace global |
13 | | { |
14 | | class Limits |
15 | | { |
16 | | public: |
17 | | Limits(Limits const&) = delete; |
18 | | Limits(Limits&&) = delete; |
19 | | Limits& operator=(Limits const&) = delete; |
20 | | Limits& operator=(Limits&&) = delete; |
21 | | |
22 | | static uint32_t const& |
23 | | objects_max_nesting() |
24 | 2 | { |
25 | 2 | return l.objects_max_nesting_; |
26 | 2 | } |
27 | | |
28 | | static uint32_t const& |
29 | | objects_max_errors() |
30 | 19.2k | { |
31 | 19.2k | return l.objects_max_errors_; |
32 | 19.2k | } |
33 | | |
34 | | static uint32_t const& |
35 | | objects_max_container_size(bool damaged) |
36 | 0 | { |
37 | 0 | return damaged ? l.objects_max_container_size_damaged_ |
38 | 0 | : l.objects_max_container_size_; |
39 | 0 | } |
40 | | |
41 | | private: |
42 | | Limits() = default; |
43 | | ~Limits() = default; |
44 | | |
45 | | static Limits l; |
46 | | |
47 | | uint32_t objects_max_nesting_{499}; |
48 | | uint32_t objects_max_errors_{15}; |
49 | | uint32_t objects_max_container_size_{std::numeric_limits<uint32_t>::max()}; |
50 | | uint32_t objects_max_container_size_damaged_{5'000}; |
51 | | }; |
52 | | |
53 | | } // namespace global |
54 | | |
55 | | } // namespace qpdf |
56 | | |
57 | | #endif // GLOBAL_PRIVATE_HH |