refactor: kill custom modules scripts en destroy

This commit is contained in:
Alex
2019-04-23 15:56:38 +02:00
parent cccf60c30e
commit 90d89fe974
11 changed files with 107 additions and 35 deletions

View File

@ -7,14 +7,13 @@ namespace waybar::util {
struct JsonParser {
JsonParser() : reader_(builder_.newCharReader()) {}
const Json::Value parse(const std::string& data, std::size_t size = 0) const {
const Json::Value parse(const std::string& data) const {
Json::Value root(Json::objectValue);
if (data.empty()) {
return root;
}
std::string err;
auto data_size = size > 0 ? size : data.size();
bool res = reader_->parse(data.c_str(), data.c_str() + data_size, &root, &err);
bool res = reader_->parse(data.c_str(), data.c_str() + data.size(), &root, &err);
if (!res) throw std::runtime_error(err);
return root;
}