cpp_redis: includes/cpp_redis/core/reply.hpp Source File

1 

2 

3 

4 

5 

6 

7 

8 

9 

10 

11 

12 

13 

14 

15 

16 

17 

18 

19 

20 

21 

22 

23 #pragma once

24 

25 #include <iostream>

26 #include <string>

27 #include <vector>

28 

29 #include <stdint.h>

30 

32 

38 public:

39 #define __CPP_REDIS_REPLY_ERR 0

40 #define __CPP_REDIS_REPLY_BULK 1

41 #define __CPP_REDIS_REPLY_SIMPLE 2

42 #define __CPP_REDIS_REPLY_NULL 3

43 #define __CPP_REDIS_REPLY_INT 4

44 #define __CPP_REDIS_REPLY_ARRAY 5

45 

50  error = __CPP_REDIS_REPLY_ERR,

51  bulk_string = __CPP_REDIS_REPLY_BULK,

52  simple_string = __CPP_REDIS_REPLY_SIMPLE,

53  null = __CPP_REDIS_REPLY_NULL,

54  integer = __CPP_REDIS_REPLY_INT,

55  array = __CPP_REDIS_REPLY_ARRAY

56  };

57 

62  error = __CPP_REDIS_REPLY_ERR,

63  bulk_string = __CPP_REDIS_REPLY_BULK,

64  simple_string = __CPP_REDIS_REPLY_SIMPLE

65  };

66 

67 public:

72 

80 

86  reply(int64_t value);

87 

94  reply(const std::vector<reply>& rows);

95 

97  ~reply(void) = default;

102 

103 public:

108 

113 

118 

123 

128 

133 

137  bool is_null(void) const;

138 

139 public:

143  bool ok(void) const;

144 

148  bool ko(void) const;

149 

153  operator bool(void) const;

154 

155 public:

159  const std::string& error(void) const;

160 

164  const std::vector<reply>& as_array(void) const;

165 

169  const std::string& as_string(void) const;

170 

175 

176 public:

180  void set(void);

181 

188  void set(const std::string& value, string_type reply_type);

189 

195  void set(int64_t value);

196 

202  void set(const std::vector<reply>& rows);

203 

211 

212 public:

217 

218 private:

220  std::vector<cpp_redis::reply> m_rows;

221  std::string m_strval;

222  int64_t m_intval;

223 };

224 

225 }

226 

reply & operator<<(const reply &reply)

int64_t as_integer(void) const

const std::vector< reply > & as_array(void) const

const std::string & as_string(void) const

bool is_simple_string(void) const

bool is_bulk_string(void) const

bool is_integer(void) const

bool is_array(void) const

bool is_string(void) const

bool is_error(void) const

type

Definition: reply.hpp:49

string_type

Definition: reply.hpp:61

reply & operator=(const reply &)=default

assignment operator

Definition: array_builder.hpp:29

type get_type(void) const