aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-09-10 10:26:16 +0200
committerneodarz <neodarz@neodarz.net>2019-09-10 14:40:01 +0200
commitcc8c1ad450667c8f6f983ba4f0d640accdcb49cf (patch)
tree491e1f6ee0708ea379e3ead5f48246a36b88c0e9
parent15ae8733b8267ff7af9033a1ebe2de6ffad9c89a (diff)
downloadumosapicpp-cc8c1ad450667c8f6f983ba4f0d640accdcb49cf.tar.xz
umosapicpp-cc8c1ad450667c8f6f983ba4f0d640accdcb49cf.zip
Little refactorisationrestbed_rewrite
Diffstat (limited to '')
-rw-r--r--api/umosapi.cpp8
-rw-r--r--db/uobject.cpp4
2 files changed, 5 insertions, 7 deletions
diff --git a/api/umosapi.cpp b/api/umosapi.cpp
index 57716e9..f5d7003 100644
--- a/api/umosapi.cpp
+++ b/api/umosapi.cpp
@@ -146,9 +146,7 @@ void UmosapiService::Api::set_path(std::string route) {
void UmosapiService::Api::set_method_handler(std::string http_word, const std::function< void ( const std::shared_ptr< restbed::Session > ) >& callback) {
UmosapiService::Api::_resource->set_method_handler(http_word, callback);
std::locale loc;
- for (auto& c : http_word) {
- c = tolower(c);
- }
+ for (auto& c : http_word) { c = tolower(c); }
UmosapiService::Api::_path.words.push_back(HttpWord{http_word});
UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word]["description"] = "";
UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word]["operationId"] = "";
@@ -160,7 +158,7 @@ void UmosapiService::Api::set_error_handler(const std::function< void(int, const
}
void UmosapiService::Api::publish() {
- for (auto& http_word: UmosapiService::Api::_path.words) {
+ for (const auto& http_word: UmosapiService::Api::_path.words) {
auto responses = UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word.name]["responses"];
if (responses.find("200") == responses.end()) {
UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word.name]["responses"]["200"]["description"] = "All is fine.";
@@ -202,7 +200,7 @@ void UmosapiService::Api::parameter(std::string name, std::string description, s
parameter["in"] = "path";
} else {
parameter["in"] = "body";
- for (auto& def: UmosapiService::Api::_definitions.defs) {
+ for (const auto& def: UmosapiService::Api::_definitions.defs) {
if (def.name == schema ) {
std::string schema_path = "#/definitions/";
parameter["schema"]["$ref"] = schema_path.append(schema);
diff --git a/db/uobject.cpp b/db/uobject.cpp
index 38b472f..bb911bb 100644
--- a/db/uobject.cpp
+++ b/db/uobject.cpp
@@ -13,7 +13,7 @@ std::string UmosapiService::uobject::retrieveAll(std::string collection, struct
auto cursor = coll.find({});
- for (auto&& doc : cursor) {
+ for (const auto& doc : cursor) {
json_object_array_add(jsonObjects, json_tokener_parse(bsoncxx::to_json(doc).c_str()));
}
@@ -126,7 +126,7 @@ std::string UmosapiService::uobject::searchKeyValue(std::string collection, std:
auto cursor = coll.find(bsoncxx::from_json(json_string));
- for (auto&& doc : cursor) {
+ for (const auto& doc : cursor) {
json_object_array_add(jsonArray, json_tokener_parse(bsoncxx::to_json(doc).c_str()));
}