Coverage Report

Created: 2025-08-24 06:56

/src/jsoncons/include/jsoncons_ext/ubjson/ubjson_options.hpp
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2013-2025 Daniel Parker
2
// Distributed under the Boost license, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5
// See https://github.com/danielaparker/jsoncons for latest version
6
7
#ifndef JSONCONS_EXT_UBJSON_UBJSON_OPTIONS_HPP
8
#define JSONCONS_EXT_UBJSON_UBJSON_OPTIONS_HPP
9
10
#include <cwchar>
11
12
namespace jsoncons { 
13
namespace ubjson {
14
15
class ubjson_options;
16
17
class ubjson_options_common
18
{
19
    friend class ubjson_options;
20
21
    int max_nesting_depth_;
22
protected:
23
1.84k
    virtual ~ubjson_options_common() = default;
24
25
    ubjson_options_common()
26
922
        : max_nesting_depth_(1024)
27
922
    {
28
922
    }
29
30
922
    ubjson_options_common(const ubjson_options_common&) = default;
31
    ubjson_options_common& operator=(const ubjson_options_common&) = default;
32
    ubjson_options_common(ubjson_options_common&&) = default;
33
    ubjson_options_common& operator=(ubjson_options_common&&) = default;
34
public:
35
    int max_nesting_depth() const 
36
16.5M
    {
37
16.5M
        return max_nesting_depth_;
38
16.5M
    }
39
};
40
41
class ubjson_decode_options : public virtual ubjson_options_common
42
{
43
    friend class ubjson_options;
44
    std::size_t max_items_{1 << 24};
45
public:
46
    ubjson_decode_options()
47
684
    {
48
684
    }
49
    
50
1.36k
    ~ubjson_decode_options() = default;
51
52
    std::size_t max_items() const
53
20.9M
    {
54
20.9M
        return max_items_;
55
20.9M
    }
56
};
57
58
class ubjson_encode_options : public virtual ubjson_options_common
59
{
60
    friend class ubjson_options;
61
public:
62
    ubjson_encode_options()
63
238
    {
64
238
    }
Unexecuted instantiation: jsoncons::ubjson::ubjson_encode_options::ubjson_encode_options()
jsoncons::ubjson::ubjson_encode_options::ubjson_encode_options()
Line
Count
Source
63
238
    {
64
238
    }
65
};
66
67
class ubjson_options final : public ubjson_decode_options, public ubjson_encode_options
68
{
69
public:
70
    using ubjson_options_common::max_nesting_depth;
71
72
    ubjson_options& max_nesting_depth(int value)
73
0
    {
74
0
        this->max_nesting_depth_ = value;
75
0
        return *this;
76
0
    }
77
78
    ubjson_options& max_items(std::size_t value)
79
0
    {
80
0
        this->max_items_ = value;
81
0
        return *this;
82
0
    }
83
};
84
85
} // namespace ubjson
86
} // namespace jsoncons
87
88
#endif // JSONCONS_EXT_UBJSON_UBJSON_OPTIONS_HPP