Reformat config.cpp with clang-format.
This commit is contained in:
parent
b512146115
commit
c0ac446be1
|
@ -30,17 +30,17 @@
|
||||||
|
|
||||||
namespace mastorss
|
namespace mastorss
|
||||||
{
|
{
|
||||||
using std::transform;
|
|
||||||
using std::back_inserter;
|
using std::back_inserter;
|
||||||
using std::stoul;
|
|
||||||
using std::getenv;
|
|
||||||
using std::ifstream;
|
|
||||||
using std::ofstream;
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::stringstream;
|
using std::getenv;
|
||||||
using std::getline;
|
using std::getline;
|
||||||
|
using std::ifstream;
|
||||||
using std::move;
|
using std::move;
|
||||||
|
using std::ofstream;
|
||||||
|
using std::stoul;
|
||||||
|
using std::stringstream;
|
||||||
|
using std::transform;
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const ProfileData &data)
|
std::ostream &operator<<(std::ostream &out, const ProfileData &data)
|
||||||
{
|
{
|
||||||
|
@ -84,8 +84,8 @@ std::ostream &operator <<(std::ostream &out, const ProfileData &data)
|
||||||
out << "replacements: [";
|
out << "replacements: [";
|
||||||
for (const auto &replacement : data.replacements)
|
for (const auto &replacement : data.replacements)
|
||||||
{
|
{
|
||||||
out << '"' << replacement.first << "\": \""
|
out << '"' << replacement.first << "\": \"" << replacement.second
|
||||||
<< replacement.second << '"';
|
<< '"';
|
||||||
if (replacement != *data.replacements.rbegin())
|
if (replacement != *data.replacements.rbegin())
|
||||||
{
|
{
|
||||||
out << ", ";
|
out << ", ";
|
||||||
|
@ -251,8 +251,8 @@ void Config::parse()
|
||||||
profiledata.titles_only = _json[profile]["titles_only"].asBool();
|
profiledata.titles_only = _json[profile]["titles_only"].asBool();
|
||||||
for (const auto &search : _json[profile]["replacements"].getMemberNames())
|
for (const auto &search : _json[profile]["replacements"].getMemberNames())
|
||||||
{
|
{
|
||||||
profiledata.replacements.push_back({search,
|
profiledata.replacements.push_back(
|
||||||
_json[profile]["replacements"][search].asString()});
|
{search, _json[profile]["replacements"][search].asString()});
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Read config: " << profiledata;
|
BOOST_LOG_TRIVIAL(debug) << "Read config: " << profiledata;
|
||||||
|
@ -268,8 +268,8 @@ void Config::write()
|
||||||
_json[profile]["instance"] = profiledata.instance;
|
_json[profile]["instance"] = profiledata.instance;
|
||||||
_json[profile]["interval"] = profiledata.interval;
|
_json[profile]["interval"] = profiledata.interval;
|
||||||
_json[profile]["keep_looking"] = profiledata.keep_looking;
|
_json[profile]["keep_looking"] = profiledata.keep_looking;
|
||||||
_json[profile]["max_size"]
|
_json[profile]["max_size"] =
|
||||||
= static_cast<Json::Value::UInt64>(profiledata.max_size);
|
static_cast<Json::Value::UInt64>(profiledata.max_size);
|
||||||
_json[profile]["skip"] = stringlist_to_jsonarray(profiledata.skip);
|
_json[profile]["skip"] = stringlist_to_jsonarray(profiledata.skip);
|
||||||
_json[profile]["titles_as_cw"] = profiledata.titles_as_cw;
|
_json[profile]["titles_as_cw"] = profiledata.titles_as_cw;
|
||||||
_json[profile]["titles_only"] = profiledata.titles_only;
|
_json[profile]["titles_only"] = profiledata.titles_only;
|
||||||
|
@ -291,14 +291,14 @@ list<string> Config::jsonarray_to_stringlist(const Json::Value &jsonarray) const
|
||||||
{
|
{
|
||||||
list<string> stringlist;
|
list<string> stringlist;
|
||||||
std::transform(jsonarray.begin(), jsonarray.end(),
|
std::transform(jsonarray.begin(), jsonarray.end(),
|
||||||
back_inserter(stringlist), [](const Json::Value &value)
|
back_inserter(stringlist),
|
||||||
{ return value.asString(); });
|
[](const Json::Value &value) { return value.asString(); });
|
||||||
|
|
||||||
return stringlist;
|
return stringlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value Config::stringlist_to_jsonarray(const list<string> &stringlist)
|
Json::Value
|
||||||
const
|
Config::stringlist_to_jsonarray(const list<string> &stringlist) const
|
||||||
{
|
{
|
||||||
Json::Value jsonarray;
|
Json::Value jsonarray;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user