31 #ifndef JSONENCODER_H_ 32 #define JSONENCODER_H_ 34 #include "../Exception.h" 35 #include "../Variable.h" 55 static void encode(
const std::shared_ptr<Variable> &variable, std::string &
json);
56 static void encode(
const std::shared_ptr<Variable> &variable, std::vector<char> &json);
57 static std::string
encode(
const std::shared_ptr<Variable> &variable);
58 static std::vector<char>
encodeBinary(
const std::shared_ptr<Variable> &variable);
59 void encodeRequest(std::string &methodName, std::shared_ptr<std::list<std::shared_ptr<Variable>>> ¶meters, std::vector<char> &encodedData);
60 std::vector<char>
encodeRequest(
const std::string &methodName,
const std::shared_ptr<Variable> ¶meters);
61 static void encodeResponse(
const std::shared_ptr<Variable> &variable, int32_t
id, std::vector<char> &json);
62 static void encodeMQTTResponse(
const std::string &methodName,
const std::shared_ptr<Variable> &variable, int32_t
id, std::vector<char> &json);
66 std::atomic<int32_t> _requestId{1};
68 static void encodeValue(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
69 static void encodeValue(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
70 static void encodeArray(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
71 static void encodeArray(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
72 static void encodeStruct(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
73 static void encodeStruct(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
74 static void encodeBoolean(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
75 static void encodeBoolean(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
76 static void encodeInteger(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
77 static void encodeInteger(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
78 static void encodeInteger64(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
79 static void encodeInteger64(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
80 static void encodeFloat(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
81 static void encodeFloat(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
82 static void encodeString(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
83 static void encodeString(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
84 static void encodeVoid(
const std::shared_ptr<Variable> &variable, std::ostringstream &s);
85 static void encodeVoid(
const std::shared_ptr<Variable> &variable, std::vector<char> &s);
This is the base library main class.
Definition: BaseLib.h:95
static void encodeMQTTResponse(const std::string &methodName, const std::shared_ptr< Variable > &variable, int32_t id, std::vector< char > &json)
Definition: JsonEncoder.cpp:82
Definition: BaseLib.cpp:34
virtual ~JsonEncoder()=default
static std::vector< char > encodeBinary(const std::shared_ptr< Variable > &variable)
Definition: JsonEncoder.cpp:143
static void encode(const std::shared_ptr< Variable > &variable, std::string &json)
Definition: JsonEncoder.cpp:95
static void encodeResponse(const std::shared_ptr< Variable > &variable, int32_t id, std::vector< char > &json)
Definition: JsonEncoder.cpp:69
static std::string encodeString(const std::string &s)
Definition: JsonEncoder.cpp:676
Definition: JsonEncoder.h:49
JsonEncoder(BaseLib::SharedObjects *dummy)
Definition: JsonEncoder.h:52
void encodeRequest(std::string &methodName, std::shared_ptr< std::list< std::shared_ptr< Variable >>> ¶meters, std::vector< char > &encodedData)
Definition: JsonEncoder.cpp:39