MCPcopy Create free account
hub / github.com/activeloopai/deeplake / const_json

Class const_json

cpp/icm/const_json.hpp:29–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace icm {
28
29class const_json
30{
31private:
32 using rapid_const_iter = rapidjson::Value::ConstMemberIterator;
33 using rapid_array_const_iterator = rapidjson::Value::ConstValueIterator;
34
35 struct processor
36 {
37 std::shared_ptr<rapidjson::Document> doc_;
38 explicit processor(std::shared_ptr<rapidjson::Document> doc)
39 : doc_(std::move(doc))
40 {
41 }
42
43 std::pair<std::string_view, const_json> operator()(const rapid_const_iter::value_type& value) const
44 {
45 return {
46 std::string_view(value.name.GetString(), value.name.GetStringLength()),
47 const_json(value.value, doc_)
48 };
49 }
50
51 const_json operator()(const rapidjson::Value& value) const
52 {
53 return const_json(value, doc_);
54 }
55 };
56
57 auto make_iterator(const rapid_const_iter& it) const
58 {
59 return boost::make_transform_iterator(it, processor(doc_));
60 }
61
62 auto make_iterator(const rapid_array_const_iterator& it) const
63 {
64 return boost::make_transform_iterator(it, processor(doc_));
65 }
66
67public:
68 using const_iterator = boost::transform_iterator<
69 processor,
70 rapid_const_iter,
71 std::pair<std::string_view, const_json>
72 >;
73
74 using array_const_iterator = boost::transform_iterator<
75 processor,
76 rapid_array_const_iterator,
77 const_json
78 >;
79
80 /// @name Constructors
81 /// @{
82public:
83 const_json()
84 : doc_(std::make_shared<rapidjson::Document>())
85 , val_(&*doc_)
86 {

Callers 5

operator()Method · 0.70
operator[]Method · 0.70
getMethod · 0.70
operator<=>Method · 0.70
operator==Method · 0.70

Calls 2

getMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected