payload.h
Go to the documentation of this file.
1 #ifndef CPR_PAYLOAD_H
2 #define CPR_PAYLOAD_H
3 
4 #include <cstdint>
5 #include <initializer_list>
6 #include <memory>
7 #include <string>
8 
9 #include "cpr/defines.h"
10 
11 namespace cpr {
12 
13 struct Pair {
14  template <typename KeyType, typename ValueType,
15  typename std::enable_if<!std::is_integral<ValueType>::value, bool>::type = true>
16  Pair(KeyType&& p_key, ValueType&& p_value)
17  : key{CPR_FWD(p_key)}, value{CPR_FWD(p_value)} {}
18  template <typename KeyType>
19  Pair(KeyType&& p_key, const std::int32_t& p_value)
20  : key{CPR_FWD(p_key)}, value{std::to_string(p_value)} {}
21 
24 };
25 
26 class Payload {
27  public:
28  template <class It>
29  Payload(const It begin, const It end) {
30  for (It pair = begin; pair != end; ++pair) {
31  AddPair(*pair);
32  }
33  }
34  Payload(const std::initializer_list<Pair>& pairs);
35 
36  void AddPair(const Pair& pair);
37 
39 };
40 
41 } // namespace cpr
42 
43 #endif
::std::string string
Definition: gtest-port.h:1129
Payload(const It begin, const It end)
Definition: payload.h:29
std::string content
Definition: payload.h:38
std::string value
Definition: payload.h:23
#define CPR_FWD(...)
Definition: defines.h:6
const struct dotdot pairs[]
Definition: unit1395.c:47
Pair(KeyType &&p_key, ValueType &&p_value)
Definition: payload.h:16
Pair(KeyType &&p_key, const std::int32_t &p_value)
Definition: payload.h:19
Definition: auth.cpp:3
UNITTEST_START int * value
Definition: unit1602.c:51
std::string key
Definition: payload.h:22


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:16