Boost.Redis 1.84.0 A redis client library

Loading...
Searching...
No Matches
node.hpp
1/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com)
2 *
3 * Distributed under the Boost Software License, Version 1.0. (See
4 * accompanying file LICENSE.txt)
5 */
6
7#ifndef BOOST_REDIS_RESP3_NODE_HPP
8#define BOOST_REDIS_RESP3_NODE_HPP
9
10#include <boost/redis/resp3/type.hpp>
11
12 namespace boost::redis::resp3 {
13
27 template <class String>
28 struct basic_node {
30 type data_type = type::invalid;
31
33 std::size_t aggregate_size{};
34
36 std::size_t depth{};
37
39 String value{};
40};
41
48 template <class String>
49 auto operator==(basic_node<String> const& a, basic_node<String> const& b)
50{
51 return a.aggregate_size == b.aggregate_size
52 && a.depth == b.depth
53 && a.data_type == b.data_type
54 && a.value == b.value;
55};
56
60 using node = basic_node<std::string>;
61
62} // boost::redis::resp3
63
64#endif // BOOST_REDIS_RESP3_NODE_HPP
boost::redis::resp3::type
type
RESP3 data types.
Definition: type.hpp:23
boost::redis::resp3::type::invalid
@ invalid
Invalid.
boost::redis::resp3::basic_node
A node in the response tree.
Definition: node.hpp:28
boost::redis::resp3::basic_node::depth
std::size_t depth
The depth of this node in the response tree.
Definition: node.hpp:36
boost::redis::resp3::basic_node::aggregate_size
std::size_t aggregate_size
The number of elements of an aggregate.
Definition: node.hpp:33
boost::redis::resp3::basic_node::data_type
type data_type
The RESP3 type of the data in this node.
Definition: node.hpp:30
boost::redis::resp3::basic_node::value
String value
The actual data. For aggregate types this is usually empty.
Definition: node.hpp:39
boost::redis::resp3::basic_node::operator==
auto operator==(basic_node< String > const &a, basic_node< String > const &b)
Compares a node for equality.
Definition: node.hpp:49