| 30 | |
| 31 | template <typename NodeType> |
| 32 | class SchemaHandler { |
| 33 | public: |
| 34 | using Allocator = typename NodeType::AllocatorType; |
| 35 | using MemberType = typename NodeType::MemberNode; |
| 36 | |
| 37 | SchemaHandler() = default; |
| 38 | SchemaHandler(NodeType *root, Allocator &alloc) |
| 39 | : parent_node_(root), cur_node_(root), alloc_(&alloc) {} |
| 40 | |
| 41 | SchemaHandler(const SchemaHandler &) = delete; |
| 42 | SchemaHandler &operator=(const SchemaHandler &rhs) = delete; |
| 43 | SchemaHandler(SchemaHandler &&rhs) |
| 44 | : st_(rhs.st_), |
| 45 | parent_node_(rhs.parent_node_), |
| 46 | cur_node_(rhs.cur_node_), |
| 47 | np_(rhs.np_), |
| 48 | cap_(rhs.cap_), |
| 49 | parent_(rhs.parent_), |
| 50 | found_node_count_(rhs.found_node_count_), |
| 51 | alloc_(rhs.alloc_) { |
| 52 | rhs.st_ = nullptr; |
| 53 | rhs.parent_node_ = nullptr; |
| 54 | rhs.cur_node_ = nullptr; |
| 55 | rhs.cap_ = 0; |
| 56 | rhs.np_ = 0; |
| 57 | rhs.alloc_ = nullptr; |
| 58 | rhs.found_node_count_ = 0; |
| 59 | parent_st_ = std::move(rhs.parent_st_); |
| 60 | found_count_st_ = std::move(rhs.found_count_st_); |
| 61 | } |
| 62 | |
| 63 | SchemaHandler &operator=(SchemaHandler &&rhs) { |
| 64 | TearDown(); |
| 65 | st_ = rhs.st_; |
| 66 | parent_node_ = rhs.parent_node_; |
| 67 | cur_node_ = rhs.cur_node_; |
| 68 | np_ = rhs.np_; |
| 69 | cap_ = rhs.cap_; |
| 70 | parent_ = rhs.parent_; |
| 71 | found_node_count_ = rhs.found_node_count_; |
| 72 | alloc_ = rhs.alloc_; |
| 73 | |
| 74 | rhs.st_ = nullptr; |
| 75 | rhs.parent_node_ = nullptr; |
| 76 | rhs.cur_node_ = nullptr; |
| 77 | rhs.np_ = 0; |
| 78 | rhs.cap_ = 0; |
| 79 | rhs.parent_ = 0; |
| 80 | rhs.alloc_ = nullptr; |
| 81 | rhs.found_node_count_ = 0; |
| 82 | parent_st_ = std::move(rhs.parent_st_); |
| 83 | found_count_st_ = std::move(rhs.found_count_st_); |
| 84 | return *this; |
| 85 | } |
| 86 | |
| 87 | ~SchemaHandler() { TearDown(); } |
| 88 | |
| 89 | sonic_force_inline bool SetUp(StringView json) { |
nothing calls this directly
no outgoing calls
no test coverage detected