From 84fcb3d157cef003d65b2925cdee28bf2d93e742 Mon Sep 17 00:00:00 2001 From: Jojo-1000 <33495614+Jojo-1000@users.noreply.github.com> Date: Tue, 7 Apr 2020 20:22:06 +0200 Subject: [PATCH] Reformat files. --- hueplusplus/CMakeLists.txt | 4 ++-- hueplusplus/HueLight.cpp | 22 +++++++++++----------- hueplusplus/include/BaseHttpHandler.h | 1 - hueplusplus/include/HueLight.h | 24 ++++++++++++------------ hueplusplus/include/UPnP.h | 6 +++--- hueplusplus/include/Utils.h | 8 ++++---- 6 files changed, 32 insertions(+), 33 deletions(-) diff --git a/hueplusplus/CMakeLists.txt b/hueplusplus/CMakeLists.txt index 10d6829..f4b003d 100755 --- a/hueplusplus/CMakeLists.txt +++ b/hueplusplus/CMakeLists.txt @@ -1,11 +1,11 @@ file(GLOB hueplusplus_HEADERS include/*.h include/*.hpp) set(hueplusplus_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/BaseHttpHandler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ExtendedColorHueStrategy.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ExtendedColorHueStrategy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ExtendedColorTemperatureStrategy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Hue.cpp ${CMAKE_CURRENT_SOURCE_DIR}/HueCommandAPI.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/HueException.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/HueException.cpp ${CMAKE_CURRENT_SOURCE_DIR}/HueLight.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SimpleBrightnessStrategy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SimpleColorHueStrategy.cpp diff --git a/hueplusplus/HueLight.cpp b/hueplusplus/HueLight.cpp index 9f45536..0091ef1 100644 --- a/hueplusplus/HueLight.cpp +++ b/hueplusplus/HueLight.cpp @@ -26,9 +26,9 @@ #include #include +#include "include/HueExceptionMacro.h" #include "include/Utils.h" #include "include/json/json.hpp" -#include "include/HueExceptionMacro.h" bool HueLight::On(uint8_t transition) { @@ -167,10 +167,10 @@ HueLight::HueLight(int id, const HueCommandAPI& commands, std::shared_ptr colorTempStrategy, std::shared_ptr colorHueStrategy) : id(id), - brightnessStrategy(std::move(brightnessStrategy)), - colorTemperatureStrategy(std::move(colorTempStrategy)), - colorHueStrategy(std::move(colorHueStrategy)), - commands(commands) + brightnessStrategy(std::move(brightnessStrategy)), + colorTemperatureStrategy(std::move(colorTempStrategy)), + colorHueStrategy(std::move(colorHueStrategy)), + commands(commands) { refreshState(); @@ -224,10 +224,9 @@ bool HueLight::OffNoRefresh(uint8_t transition) return utils::validateReplyForLight(request, reply, id); } -nlohmann::json HueLight::SendPutRequest(const nlohmann::json &request, const std::string &subPath, FileInfo fileInfo) +nlohmann::json HueLight::SendPutRequest(const nlohmann::json& request, const std::string& subPath, FileInfo fileInfo) { - return commands.PUTRequest("/lights/" + std::to_string(id) + subPath, - request, std::move(fileInfo)); + return commands.PUTRequest("/lights/" + std::to_string(id) + subPath, request, std::move(fileInfo)); } void HueLight::refreshState() @@ -235,7 +234,8 @@ void HueLight::refreshState() // std::chrono::steady_clock::time_point start = // std::chrono::steady_clock::now(); std::cout << "\tRefreshing lampstate of // lamp with id: " << id << ", ip: " << ip << "\n"; - nlohmann::json answer = commands.GETRequest("/lights/" + std::to_string(id), nlohmann::json::object(), CURRENT_FILE_INFO); + nlohmann::json answer + = commands.GETRequest("/lights/" + std::to_string(id), nlohmann::json::object(), CURRENT_FILE_INFO); if (answer.count("state")) { state = answer; @@ -243,8 +243,8 @@ void HueLight::refreshState() else { std::cout << "Answer in HueLight::refreshState of " - "http_handler->GETJson(...) is not expected!\nAnswer:\n\t" - << answer.dump() << std::endl; + "http_handler->GETJson(...) is not expected!\nAnswer:\n\t" + << answer.dump() << std::endl; } // std::cout << "\tRefresh state took: " << // std::chrono::duration_cast(std::chrono::steady_clock::now() diff --git a/hueplusplus/include/BaseHttpHandler.h b/hueplusplus/include/BaseHttpHandler.h index 305a853..22d29c6 100644 --- a/hueplusplus/include/BaseHttpHandler.h +++ b/hueplusplus/include/BaseHttpHandler.h @@ -32,7 +32,6 @@ #include "json/json.hpp" - //! Base class for classes that handle http requests and multicast requests class BaseHttpHandler : public IHttpHandler { diff --git a/hueplusplus/include/HueLight.h b/hueplusplus/include/HueLight.h index 8c144c9..addac44 100644 --- a/hueplusplus/include/HueLight.h +++ b/hueplusplus/include/HueLight.h @@ -541,7 +541,7 @@ public: //! ranging from 0 to 255. \param r uint8_t that specifies the red color value //! \param g uint8_t that specifies the green color value //! \param b uint8_t that specifies the blue color value - //! \param transition Optional parameter to set the transition from current state to new, standard is 4 = 400ms + //! \param transition Optional parameter to set the transition from current state to new, standard is 4 = 400ms //! \return Bool that is true on success //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body @@ -570,8 +570,8 @@ public: //! color temperature. //! //! \note The breath cylce will only be performed if the light has a reference - //! to a specific \ref ColorTemperatureStrategy. - //! \param mired Color temperature in mired + //! to a specific \ref ColorTemperatureStrategy. + //! \param mired Color temperature in mired //! \return Bool that is true on success //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body @@ -590,9 +590,9 @@ public: //! color. //! //! \note The breath cylce will only be performed if the light has a reference - //! to a specific \ref ColorHueStrategy. - //! \param hue uint16_t that specifies the hue - //! \param sat uint8_t that specifies the saturation + //! to a specific \ref ColorHueStrategy. + //! \param hue uint16_t that specifies the hue + //! \param sat uint8_t that specifies the saturation //! \return Bool that is true on success //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body @@ -612,9 +612,9 @@ public: //! //! \note The breath cylce will only be performed if the light has a reference //! to a specific \ref ColorHueStrategy. The values of x and y are ranging - //! from 0 to 1. + //! from 0 to 1. //! \param x float that specifies the x coordinate in CIE - //! \param y float that specifies the y coordinate in CIE + //! \param y float that specifies the y coordinate in CIE //! \return Bool that is true on success //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body @@ -634,7 +634,7 @@ public: //! //! \note The breath cylce will only be performed if the light has a reference //! to a specific \ref ColorHueStrategy. The values of red, green and blue are - //! ranging from 0 to 255. + //! ranging from 0 to 255. //! \param r uint8_t that specifies the red color value //! \param g uint8_t that specifies the green color value //! \param b uint8_t that specifies the blue color value @@ -738,7 +738,7 @@ protected: //! \brief Function that turns the light on without refreshing its state. //! - //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms + //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms //! \return Bool that is true on success //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body @@ -748,7 +748,7 @@ protected: //! \brief Function that turns the light off without refreshing its state. //! - //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms + //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms //! \return Bool that is true on success //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body @@ -760,7 +760,7 @@ protected: //! //! \throws nlohmann::json::parse_error if the reply could not be parsed //! \param request A nlohmann::json aka the request to send - //! \param subPath A path that is appended to the uri, note it should always start with a slash ("/") + //! \param subPath A path that is appended to the uri, note it should always start with a slash ("/") //! \return The parsed reply //! \throws std::system_error when system or socket operations fail //! \throws HueException when response contained no body diff --git a/hueplusplus/include/UPnP.h b/hueplusplus/include/UPnP.h index 5c2bdf1..01e75a9 100755 --- a/hueplusplus/include/UPnP.h +++ b/hueplusplus/include/UPnP.h @@ -35,9 +35,9 @@ class UPnP public: //! \brief Searches for UPnP devices and returns all found ones. //! - //! It does it by sending an m-search packet and waits for all responses. - //! Since responses can be received multiple times this function conveniently removes all duplicates. - //! \param handler HttpHandler for communication + //! It does it by sending an m-search packet and waits for all responses. + //! Since responses can be received multiple times this function conveniently removes all duplicates. + //! \param handler HttpHandler for communication //! \return A vector containing pairs of address and name of all found devices //! \throws std::system_error when system or socket operations fail std::vector> getDevices(std::shared_ptr handler); diff --git a/hueplusplus/include/Utils.h b/hueplusplus/include/Utils.h index 49e7794..96cff7c 100644 --- a/hueplusplus/include/Utils.h +++ b/hueplusplus/include/Utils.h @@ -37,7 +37,7 @@ namespace utils template >::value>* = nullptr> - nlohmann::json safeGetMemberHelper(const nlohmann::json& json, KeyT&& key, Paths&&... otherPaths) + nlohmann::json safeGetMemberHelper(const nlohmann::json& json, KeyT&& key, Paths&&... otherPaths) { auto memberIt = json.find(std::forward(key)); if (memberIt == json.end()) @@ -57,7 +57,7 @@ namespace utils } return safeGetMemberHelper(json[index], std::forward(otherPaths)...); } - } + } // namespace detail //! \brief Function for validating that a request was executed correctly //! @@ -68,11 +68,11 @@ namespace utils bool validateReplyForLight(const nlohmann::json& request, const nlohmann::json& reply, int lightId); //! \brief Returns the object/array member or null if it does not exist - //! + //! //! \param json The base json value //! \param paths Any number of child accesses (e.g. 0, "key" would access json[0]["key"]) //! \returns The specified member or null if any intermediate object does not contain the specified child. - template + template nlohmann::json safeGetMember(const nlohmann::json& json, Paths&&... paths) { return detail::safeGetMemberHelper(json, std::forward(paths)...); -- libgit2 0.21.4