Refactor RestService interfaces.
This commit is contained in:
@@ -5,26 +5,8 @@
|
||||
#include "webcc/logger.h"
|
||||
#include "webcc/rest_async_client.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Write a JSON object to string.
|
||||
static std::string JsonToString(const Json::Value& json) {
|
||||
Json::StreamWriterBuilder builder;
|
||||
return Json::writeString(builder, json);
|
||||
}
|
||||
|
||||
static Json::Value StringToJson(const std::string& str) {
|
||||
Json::Value json;
|
||||
|
||||
Json::CharReaderBuilder builder;
|
||||
std::stringstream stream(str);
|
||||
std::string errs;
|
||||
if (!Json::parseFromStream(builder, stream, &json, &errs)) {
|
||||
std::cerr << errs << std::endl;
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
#include "example/common/book.h"
|
||||
#include "example/common/book_json.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user