Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/redis/resp3/impl/serialization.ipp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com)
0002  *
0003  * Distributed under the Boost Software License, Version 1.0. (See
0004  * accompanying file LICENSE.txt)
0005  */
0006 
0007 #include <boost/redis/resp3/serialization.hpp>
0008 #include <boost/redis/resp3/parser.hpp>
0009 
0010 namespace boost::redis::resp3 {
0011 
0012 void boost_redis_to_bulk(std::string& payload, std::string_view data)
0013 {
0014    auto const str = std::to_string(data.size());
0015 
0016    payload += to_code(type::blob_string);
0017    payload.append(std::cbegin(str), std::cend(str));
0018    payload += parser::sep;
0019    payload.append(std::cbegin(data), std::cend(data));
0020    payload += parser::sep;
0021 }
0022 
0023 void add_header(std::string& payload, type t, std::size_t size)
0024 {
0025    auto const str = std::to_string(size);
0026 
0027    payload += to_code(t);
0028    payload.append(std::cbegin(str), std::cend(str));
0029    payload += parser::sep;
0030 }
0031 
0032 void add_blob(std::string& payload, std::string_view blob)
0033 {
0034    payload.append(std::cbegin(blob), std::cend(blob));
0035    payload += parser::sep;
0036 }
0037 
0038 void add_separator(std::string& payload)
0039 {
0040    payload += parser::sep;
0041 }
0042 } // boost::redis::resp3