-
Notifications
You must be signed in to change notification settings - Fork 0
/
RESP.hpp
47 lines (34 loc) · 1.16 KB
/
RESP.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2018 Stephan Menzel. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include "MRedisConfig.hpp"
#include "MRedisResult.hpp"
#include "MRedisTypes.hpp"
#include <boost/variant.hpp>
#include <boost/cstdint.hpp>
#include <boost/asio/streambuf.hpp>
#include <iostream>
#include <string>
#include <chrono>
namespace moose {
namespace mredis {
/*! Raw protocol implementation
*/
// debug
MREDIS_API bool parse(const std::string &n_input, RedisMessage &n_response);
MREDIS_API RedisMessage parse_one(std::istream &n_is);
/*! Parse one message from the stream.
@return false on cannot parse any
*/
MREDIS_API bool parse_from_stream(std::istream &n_is, RedisMessage &n_response) noexcept;
/*! Parse one message from the streambuf and consume if successful.
@return false on cannot parse any
*/
MREDIS_API bool parse_from_streambuf(boost::asio::streambuf &n_streambuf, RedisMessage &n_response) noexcept;
/*! Generate to stream
Mostly for testing
*/
MREDIS_API void generate_to_stream(std::ostream &n_os, const RedisMessage &n_message);
}
}