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