clang-format: update to latest from docs repo
This is from openbmc/docs/style/cpp/.clang-format
Other OpenBMC repos are doing the same.
Tested: Built and validator passed.
Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/http/app.h b/http/app.h
index 1e5f985..ca871dc 100644
--- a/http/app.h
+++ b/http/app.h
@@ -1,5 +1,12 @@
#pragma once
+#include "http_request.h"
+#include "http_server.h"
+#include "logging.h"
+#include "middleware_context.h"
+#include "routing.h"
+#include "utility.h"
+
#include "privileges.hpp"
#include <chrono>
@@ -10,13 +17,6 @@
#include <string>
#include <utility>
-#include "http_request.h"
-#include "http_server.h"
-#include "logging.h"
-#include "middleware_context.h"
-#include "routing.h"
-#include "utility.h"
-
#define BMCWEB_ROUTE(app, url) \
app.template route<crow::black_magic::get_parameter_tag(url)>(url)
@@ -25,7 +25,8 @@
#ifdef BMCWEB_ENABLE_SSL
using ssl_context_t = boost::asio::ssl::context;
#endif
-template <typename... Middlewares> class Crow
+template <typename... Middlewares>
+class Crow
{
public:
using self_t = Crow;
@@ -41,8 +42,7 @@
explicit Crow(std::shared_ptr<boost::asio::io_context> ioIn =
std::make_shared<boost::asio::io_context>()) :
io(std::move(ioIn))
- {
- }
+ {}
~Crow()
{
this->stop();
@@ -64,7 +64,8 @@
return router.newRuleDynamic(rule);
}
- template <uint64_t Tag> auto& route(std::string&& rule)
+ template <uint64_t Tag>
+ auto& route(std::string&& rule)
{
return router.newRuleTagged<Tag>(std::move(rule));
}
@@ -190,7 +191,8 @@
std::shared_ptr<ssl_context_t> sslContext = nullptr;
#else
- template <typename T, typename... Remain> self_t& ssl_file(T&&, Remain&&...)
+ template <typename T, typename... Remain>
+ self_t& ssl_file(T&&, Remain&&...)
{
// We can't call .ssl() member function unless BMCWEB_ENABLE_SSL is
// defined.
@@ -201,7 +203,8 @@
return *this;
}
- template <typename T> self_t& ssl(T&&)
+ template <typename T>
+ self_t& ssl(T&&)
{
// We can't call .ssl() member function unless BMCWEB_ENABLE_SSL is
// defined.
@@ -215,7 +218,8 @@
// middleware
using context_t = detail::Context<Middlewares...>;
- template <typename T> typename T::Context& getContext(const Request& req)
+ template <typename T>
+ typename T::Context& getContext(const Request& req)
{
static_assert(black_magic::Contains<T, Middlewares...>::value,
"App doesn't have the specified middleware type.");
@@ -223,12 +227,14 @@
return ctx.template get<T>();
}
- template <typename T> T& getMiddleware()
+ template <typename T>
+ T& getMiddleware()
{
return utility::getElementByType<T, Middlewares...>(middlewares);
}
- template <typename Duration, typename Func> self_t& tick(Duration d, Func f)
+ template <typename Duration, typename Func>
+ self_t& tick(Duration d, Func f)
{
tickInterval = std::chrono::duration_cast<std::chrono::milliseconds>(d);
tickFunction = f;
@@ -257,6 +263,7 @@
std::unique_ptr<server_t> server;
#endif
};
-template <typename... Middlewares> using App = Crow<Middlewares...>;
+template <typename... Middlewares>
+using App = Crow<Middlewares...>;
using SimpleApp = Crow<>;
} // namespace crow
diff --git a/http/common.h b/http/common.h
index 77c2074..47df7e6 100644
--- a/http/common.h
+++ b/http/common.h
@@ -1,13 +1,14 @@
#pragma once
+#include "utility.h"
+
#include <boost/beast/http/verb.hpp>
+
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
-#include "utility.h"
-
namespace crow
{
@@ -81,20 +82,24 @@
std::cerr << std::endl;
}
- template <typename T> T get(unsigned) const;
+ template <typename T>
+ T get(unsigned) const;
};
-template <> inline int64_t RoutingParams::get<int64_t>(unsigned index) const
+template <>
+inline int64_t RoutingParams::get<int64_t>(unsigned index) const
{
return intParams[index];
}
-template <> inline uint64_t RoutingParams::get<uint64_t>(unsigned index) const
+template <>
+inline uint64_t RoutingParams::get<uint64_t>(unsigned index) const
{
return uintParams[index];
}
-template <> inline double RoutingParams::get<double>(unsigned index) const
+template <>
+inline double RoutingParams::get<double>(unsigned index) const
{
return doubleParams[index];
}
diff --git a/http/http_client.hpp b/http/http_client.hpp
index caaaccb..8b1fb5c 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -18,6 +18,7 @@
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
+
#include <cstdlib>
#include <functional>
#include <iostream>
diff --git a/http/http_connection.h b/http/http_connection.h
index 6d28405..1a8f6cd 100644
--- a/http/http_connection.h
+++ b/http/http_connection.h
@@ -3,29 +3,32 @@
#include "http_utility.hpp"
-#include <atomic>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/beast/core/flat_static_buffer.hpp>
+
+#include <atomic>
#if BOOST_VERSION >= 107000
#include <boost/beast/ssl/ssl_stream.hpp>
#else
#include <boost/beast/experimental/core/ssl_stream.hpp>
#endif
-#include <boost/beast/http.hpp>
-#include <boost/beast/websocket.hpp>
-#include <chrono>
-#include <vector>
-
#include "http_response.h"
#include "logging.h"
#include "middleware_context.h"
#include "timer_queue.h"
#include "utility.h"
+#include <boost/beast/http.hpp>
+#include <boost/beast/websocket.hpp>
+#include <ssl_key_handler.hpp>
+
+#include <chrono>
+#include <vector>
+
namespace crow
{
@@ -64,45 +67,46 @@
namespace detail
{
-template <typename MW> struct CheckBeforeHandleArity3Const
+template <typename MW>
+struct CheckBeforeHandleArity3Const
{
template <typename T,
void (T::*)(Request&, Response&, typename MW::Context&) const =
&T::beforeHandle>
struct Get
- {
- };
+ {};
};
-template <typename MW> struct CheckBeforeHandleArity3
+template <typename MW>
+struct CheckBeforeHandleArity3
{
template <typename T, void (T::*)(Request&, Response&,
typename MW::Context&) = &T::beforeHandle>
struct Get
- {
- };
+ {};
};
-template <typename MW> struct CheckAfterHandleArity3Const
+template <typename MW>
+struct CheckAfterHandleArity3Const
{
template <typename T,
void (T::*)(Request&, Response&, typename MW::Context&) const =
&T::afterHandle>
struct Get
- {
- };
+ {};
};
-template <typename MW> struct CheckAfterHandleArity3
+template <typename MW>
+struct CheckAfterHandleArity3
{
template <typename T, void (T::*)(Request&, Response&,
typename MW::Context&) = &T::afterHandle>
struct Get
- {
- };
+ {};
};
-template <typename T> struct IsBeforeHandleArity3Impl
+template <typename T>
+struct IsBeforeHandleArity3Impl
{
template <typename C>
static std::true_type
@@ -112,13 +116,15 @@
static std::true_type
f(typename CheckBeforeHandleArity3<T>::template Get<C>*);
- template <typename C> static std::false_type f(...);
+ template <typename C>
+ static std::false_type f(...);
public:
static constexpr bool value = decltype(f<T>(nullptr))::value;
};
-template <typename T> struct IsAfterHandleArity3Impl
+template <typename T>
+struct IsAfterHandleArity3Impl
{
template <typename C>
static std::true_type
@@ -128,7 +134,8 @@
static std::true_type
f(typename CheckAfterHandleArity3<T>::template Get<C>*);
- template <typename C> static std::false_type f(...);
+ template <typename C>
+ static std::false_type f(...);
public:
static constexpr bool value = decltype(f<T>(nullptr))::value;
@@ -207,8 +214,7 @@
typename std::enable_if<(N < 0)>::type
afterHandlersCallHelper(Container& /*middlewares*/, Context& /*Context*/,
Request& /*req*/, Response& /*res*/)
-{
-}
+{}
template <size_t N, typename Context, typename Container>
typename std::enable_if<(N == 0)>::type
@@ -248,8 +254,9 @@
1024 * 1024 * BMCWEB_HTTP_REQ_BODY_LIMIT_MB;
template <typename Adaptor, typename Handler, typename... Middlewares>
-class Connection : public std::enable_shared_from_this<
- Connection<Adaptor, Handler, Middlewares...>>
+class Connection :
+ public std::enable_shared_from_this<
+ Connection<Adaptor, Handler, Middlewares...>>
{
public:
Connection(boost::asio::io_context& ioService, Handler* handlerIn,
diff --git a/http/http_request.h b/http/http_request.h
index 0dd7e35..67cc944 100644
--- a/http/http_request.h
+++ b/http/http_request.h
@@ -1,14 +1,14 @@
#pragma once
+#include "common.h"
+#include "query_string.h"
+
#include "sessions.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/websocket.hpp>
-#include "common.h"
-#include "query_string.h"
-
#if BOOST_VERSION >= 107000
#include <boost/beast/ssl/ssl_stream.hpp>
#else
@@ -45,8 +45,7 @@
boost::beast::http::request<boost::beast::http::string_body>& reqIn) :
req(reqIn),
fields(reqIn.base()), body(reqIn.body())
- {
- }
+ {}
boost::beast::http::verb method() const
{
diff --git a/http/http_response.h b/http/http_response.h
index 6d7ca26..d5d1e4b 100644
--- a/http/http_response.h
+++ b/http/http_response.h
@@ -1,11 +1,12 @@
#pragma once
+#include "http_request.h"
+#include "logging.h"
+
#include "nlohmann/json.hpp"
#include <boost/beast/http.hpp>
-#include <string>
-#include "http_request.h"
-#include "logging.h"
+#include <string>
namespace crow
{
@@ -35,8 +36,7 @@
}
Response() : stringResponse(response_type{})
- {
- }
+ {}
Response(Response&& r)
{
diff --git a/http/http_server.h b/http/http_server.h
index 6e63cbd..50e96c2 100644
--- a/http/http_server.h
+++ b/http/http_server.h
@@ -1,31 +1,33 @@
#pragma once
-#include <atomic>
#include <boost/asio/ip/address.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/asio/ssl/context.hpp>
#include <boost/asio/steady_timer.hpp>
+
+#include <atomic>
#if BOOST_VERSION >= 107000
#include <boost/beast/ssl/ssl_stream.hpp>
#else
#include <boost/beast/experimental/core/ssl_stream.hpp>
#endif
+#include "http_connection.h"
+#include "logging.h"
+#include "timer_queue.h"
+
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <ssl_key_handler.hpp>
+
#include <chrono>
#include <cstdint>
#include <filesystem>
#include <future>
#include <memory>
-#include <ssl_key_handler.hpp>
#include <utility>
#include <vector>
-#include "http_connection.h"
-#include "logging.h"
-#include "timer_queue.h"
-
namespace crow
{
using namespace boost;
@@ -46,8 +48,7 @@
signals(*ioService, SIGINT, SIGTERM, SIGHUP), tickTimer(*ioService),
timer(*ioService), handler(handler), middlewares(middlewares),
adaptorCtx(adaptor_ctx)
- {
- }
+ {}
Server(Handler* handler, const std::string& bindaddr, uint16_t port,
std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
@@ -59,8 +60,7 @@
*io, tcp::endpoint(boost::asio::ip::make_address(bindaddr),
port)),
adaptor_ctx, middlewares, io)
- {
- }
+ {}
Server(Handler* handler, int existing_socket,
std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
@@ -71,8 +71,7 @@
std::make_unique<tcp::acceptor>(*io, boost::asio::ip::tcp::v6(),
existing_socket),
adaptor_ctx, middlewares, io)
- {
- }
+ {}
void setTickFunction(std::chrono::milliseconds d, std::function<void()> f)
{
diff --git a/http/logging.h b/http/logging.h
index eb04cc1..fcac94d 100644
--- a/http/logging.h
+++ b/http/logging.h
@@ -62,7 +62,8 @@
}
//
- template <typename T> logger& operator<<(T const& value)
+ template <typename T>
+ logger& operator<<(T const& value)
{
if (level >= get_current_log_level())
{
diff --git a/http/middleware_context.h b/http/middleware_context.h
index fbe1d80..fa399d6 100644
--- a/http/middleware_context.h
+++ b/http/middleware_context.h
@@ -9,10 +9,10 @@
namespace detail
{
template <typename... Middlewares>
-struct PartialContext
- : public black_magic::PopBack<Middlewares...>::template rebind<
- PartialContext>,
- public black_magic::LastElementType<Middlewares...>::type::Context
+struct PartialContext :
+ public black_magic::PopBack<Middlewares...>::template rebind<
+ PartialContext>,
+ public black_magic::LastElementType<Middlewares...>::type::Context
{
using parent_context = typename black_magic::PopBack<
Middlewares...>::template rebind<::crow::detail::PartialContext>;
@@ -21,15 +21,18 @@
N == sizeof...(Middlewares) - 1, PartialContext,
typename parent_context::template partial<N>>::type;
- template <typename T> typename T::Context& get()
+ template <typename T>
+ typename T::Context& get()
{
return static_cast<typename T::Context&>(*this);
}
};
-template <> struct PartialContext<>
+template <>
+struct PartialContext<>
{
- template <size_t> using partial = PartialContext;
+ template <size_t>
+ using partial = PartialContext;
};
template <size_t N, typename Context, typename Container, typename CurrentMW,
@@ -55,7 +58,8 @@
friend bool middlewareCallHelper(Container& middlewares, Request& req,
Response& res, Context& ctx);
- template <typename T> typename T::Context& get()
+ template <typename T>
+ typename T::Context& get()
{
return static_cast<typename T::Context&>(*this);
}
diff --git a/http/routing.h b/http/routing.h
index cc5c75f..b2729ef 100644
--- a/http/routing.h
+++ b/http/routing.h
@@ -1,5 +1,12 @@
#pragma once
+#include "common.h"
+#include "http_request.h"
+#include "http_response.h"
+#include "logging.h"
+#include "utility.h"
+#include "websocket.h"
+
#include "error_messages.hpp"
#include "privileges.hpp"
#include "sessions.hpp"
@@ -8,6 +15,7 @@
#include <boost/container/flat_map.hpp>
#include <boost/container/small_vector.hpp>
#include <boost/lexical_cast.hpp>
+
#include <cerrno>
#include <cstdint>
#include <cstdlib>
@@ -17,13 +25,6 @@
#include <utility>
#include <vector>
-#include "common.h"
-#include "http_request.h"
-#include "http_response.h"
-#include "logging.h"
-#include "utility.h"
-#include "websocket.h"
-
namespace crow
{
@@ -34,8 +35,7 @@
{
public:
BaseRule(std::string thisRule) : rule(std::move(thisRule))
- {
- }
+ {}
virtual ~BaseRule() = default;
@@ -99,20 +99,23 @@
std::unique_ptr<BaseRule> ruleToUpgrade;
friend class Router;
- template <typename T> friend struct RuleParameterTraits;
+ template <typename T>
+ friend struct RuleParameterTraits;
};
namespace detail
{
namespace routing_handler_call_helper
{
-template <typename T, int Pos> struct CallPair
+template <typename T, int Pos>
+struct CallPair
{
using type = T;
static const int pos = Pos;
};
-template <typename H1> struct CallParams
+template <typename H1>
+struct CallParams
{
H1& handler;
const RoutingParams& params;
@@ -123,8 +126,7 @@
template <typename F, int NInt, int NUint, int NDouble, int NString,
typename S1, typename S2>
struct Call
-{
-};
+{};
template <typename F, int NInt, int NUint, int NDouble, int NString,
typename... Args1, typename... Args2>
@@ -195,7 +197,8 @@
}
};
-template <typename Func, typename... ArgsWrapped> struct Wrapped
+template <typename Func, typename... ArgsWrapped>
+struct Wrapped
{
template <typename... Args>
void set(
@@ -213,11 +216,11 @@
};
}
- template <typename Req, typename... Args> struct ReqHandlerWrapper
+ template <typename Req, typename... Args>
+ struct ReqHandlerWrapper
{
ReqHandlerWrapper(Func f) : f(std::move(f))
- {
- }
+ {}
void operator()(const Request& req, Response& res, Args... args)
{
@@ -264,7 +267,8 @@
handler = std::move(f);
}
- template <typename... Args> struct HandlerTypeHelper
+ template <typename... Args>
+ struct HandlerTypeHelper
{
using type =
std::function<void(const crow::Request&, crow::Response&, Args...)>;
@@ -312,12 +316,10 @@
public:
WebSocketRule(std::string rule) : BaseRule(std::move(rule))
- {
- }
+ {}
void validate() override
- {
- }
+ {}
void handle(const Request&, Response& res, const RoutingParams&) override
{
@@ -351,25 +353,29 @@
}
#endif
- template <typename Func> self_t& onopen(Func f)
+ template <typename Func>
+ self_t& onopen(Func f)
{
openHandler = f;
return *this;
}
- template <typename Func> self_t& onmessage(Func f)
+ template <typename Func>
+ self_t& onmessage(Func f)
{
messageHandler = f;
return *this;
}
- template <typename Func> self_t& onclose(Func f)
+ template <typename Func>
+ self_t& onclose(Func f)
{
closeHandler = f;
return *this;
}
- template <typename Func> self_t& onerror(Func f)
+ template <typename Func>
+ self_t& onerror(Func f)
{
errorHandler = f;
return *this;
@@ -386,7 +392,8 @@
std::function<void(crow::websocket::Connection&)> errorHandler;
};
-template <typename T> struct RuleParameterTraits
+template <typename T>
+struct RuleParameterTraits
{
using self_t = T;
WebSocketRule& websocket()
@@ -444,8 +451,7 @@
{
public:
DynamicRule(std::string rule) : BaseRule(std::move(rule))
- {
- }
+ {}
void validate() override
{
@@ -462,7 +468,8 @@
erasedHandler(req, res, params);
}
- template <typename Func> void operator()(Func f)
+ template <typename Func>
+ void operator()(Func f)
{
using function_t = utility::function_traits<Func>;
@@ -497,7 +504,8 @@
return ret;
}
- template <typename Func> void operator()(std::string name, Func&& f)
+ template <typename Func>
+ void operator()(std::string name, Func&& f)
{
nameStr = std::move(name);
(*this).template operator()<Func>(std::forward(f));
@@ -509,15 +517,15 @@
};
template <typename... Args>
-class TaggedRule : public BaseRule,
- public RuleParameterTraits<TaggedRule<Args...>>
+class TaggedRule :
+ public BaseRule,
+ public RuleParameterTraits<TaggedRule<Args...>>
{
public:
using self_t = TaggedRule<Args...>;
TaggedRule(std::string ruleIn) : BaseRule(std::move(ruleIn))
- {
- }
+ {}
void validate() override
{
@@ -606,7 +614,8 @@
handler = std::move(f);
}
- template <typename Func> void operator()(std::string name, Func&& f)
+ template <typename Func>
+ void operator()(std::string name, Func&& f)
{
nameStr = std::move(name);
(*this).template operator()<Func>(std::forward(f));
@@ -647,8 +656,7 @@
};
Trie() : nodes(1)
- {
- }
+ {}
private:
void optimizeNode(Node* node)
@@ -1406,8 +1414,7 @@
// rule index 0, 1 has special meaning; preallocate it to avoid
// duplication.
PerMethod() : rules(2)
- {
- }
+ {}
};
std::array<PerMethod, maxHttpVerbCount> perMethods;
std::vector<std::unique_ptr<BaseRule>> allRules;
diff --git a/http/timer_queue.h b/http/timer_queue.h
index b61c188..f2a933b 100644
--- a/http/timer_queue.h
+++ b/http/timer_queue.h
@@ -1,12 +1,13 @@
#pragma once
+#include "logging.h"
+
#include <boost/circular_buffer.hpp>
#include <boost/circular_buffer/space_optimized.hpp>
+
#include <chrono>
#include <functional>
-#include "logging.h"
-
namespace crow
{
namespace detail
diff --git a/http/utility.h b/http/utility.h
index c71187d..59abc8d 100644
--- a/http/utility.h
+++ b/http/utility.h
@@ -19,8 +19,7 @@
struct OutOfRange
{
OutOfRange(unsigned /*pos*/, unsigned /*length*/)
- {
- }
+ {}
};
constexpr unsigned requiresInRange(unsigned i, unsigned len)
{
@@ -124,7 +123,8 @@
return isEquN(s, i, "<path>", 0, 6);
}
-template <typename T> constexpr int getParameterTag()
+template <typename T>
+constexpr int getParameterTag()
{
if constexpr (std::is_same_v<int, T>)
{
@@ -177,9 +177,11 @@
return 0;
}
-template <typename... Args> struct compute_parameter_tag_from_args_list;
+template <typename... Args>
+struct compute_parameter_tag_from_args_list;
-template <> struct compute_parameter_tag_from_args_list<>
+template <>
+struct compute_parameter_tag_from_args_list<>
{
static constexpr int value = 0;
};
@@ -305,110 +307,132 @@
: get_parameter_tag(s, p + 1);
}
-template <typename... T> struct S
+template <typename... T>
+struct S
{
- template <typename U> using push = S<U, T...>;
- template <typename U> using push_back = S<T..., U>;
- template <template <typename... Args> class U> using rebind = U<T...>;
+ template <typename U>
+ using push = S<U, T...>;
+ template <typename U>
+ using push_back = S<T..., U>;
+ template <template <typename... Args> class U>
+ using rebind = U<T...>;
};
-template <typename F, typename Set> struct CallHelper;
-template <typename F, typename... Args> struct CallHelper<F, S<Args...>>
+template <typename F, typename Set>
+struct CallHelper;
+template <typename F, typename... Args>
+struct CallHelper<F, S<Args...>>
{
template <typename F1, typename... Args1,
typename = decltype(std::declval<F1>()(std::declval<Args1>()...))>
static char __test(int);
- template <typename...> static int __test(...);
+ template <typename...>
+ static int __test(...);
static constexpr bool value = sizeof(__test<F, Args...>(0)) == sizeof(char);
};
-template <uint64_t N> struct SingleTagToType
-{
-};
+template <uint64_t N>
+struct SingleTagToType
+{};
-template <> struct SingleTagToType<1>
+template <>
+struct SingleTagToType<1>
{
using type = int64_t;
};
-template <> struct SingleTagToType<2>
+template <>
+struct SingleTagToType<2>
{
using type = uint64_t;
};
-template <> struct SingleTagToType<3>
+template <>
+struct SingleTagToType<3>
{
using type = double;
};
-template <> struct SingleTagToType<4>
+template <>
+struct SingleTagToType<4>
{
using type = std::string;
};
-template <> struct SingleTagToType<5>
+template <>
+struct SingleTagToType<5>
{
using type = std::string;
};
-template <uint64_t Tag> struct Arguments
+template <uint64_t Tag>
+struct Arguments
{
using subarguments = typename Arguments<Tag / 6>::type;
using type = typename subarguments::template push<
typename SingleTagToType<Tag % 6>::type>;
};
-template <> struct Arguments<0>
+template <>
+struct Arguments<0>
{
using type = S<>;
};
-template <typename... T> struct LastElementType
+template <typename... T>
+struct LastElementType
{
using type =
typename std::tuple_element<sizeof...(T) - 1, std::tuple<T...>>::type;
};
-template <> struct LastElementType<>
-{
-};
+template <>
+struct LastElementType<>
+{};
// from
// http://stackoverflow.com/questions/13072359/c11-compile-time-array-with-logarithmic-evaluation-depth
-template <class T> using Invoke = typename T::type;
+template <class T>
+using Invoke = typename T::type;
-template <unsigned...> struct Seq
+template <unsigned...>
+struct Seq
{
using type = Seq;
};
-template <class S1, class S2> struct concat;
+template <class S1, class S2>
+struct concat;
template <unsigned... I1, unsigned... I2>
struct concat<Seq<I1...>, Seq<I2...>> : Seq<I1..., (sizeof...(I1) + I2)...>
-{
-};
+{};
-template <class S1, class S2> using Concat = Invoke<concat<S1, S2>>;
+template <class S1, class S2>
+using Concat = Invoke<concat<S1, S2>>;
-template <size_t N> struct gen_seq;
-template <size_t N> using GenSeq = Invoke<gen_seq<N>>;
+template <size_t N>
+struct gen_seq;
+template <size_t N>
+using GenSeq = Invoke<gen_seq<N>>;
-template <size_t N> struct gen_seq : Concat<GenSeq<N / 2>, GenSeq<N - N / 2>>
-{
-};
+template <size_t N>
+struct gen_seq : Concat<GenSeq<N / 2>, GenSeq<N - N / 2>>
+{};
-template <> struct gen_seq<0> : Seq<>
-{
-};
-template <> struct gen_seq<1> : Seq<0>
-{
-};
+template <>
+struct gen_seq<0> : Seq<>
+{};
+template <>
+struct gen_seq<1> : Seq<0>
+{};
-template <typename Seq, typename Tuple> struct PopBackHelper;
+template <typename Seq, typename Tuple>
+struct PopBackHelper;
-template <unsigned... N, typename Tuple> struct PopBackHelper<Seq<N...>, Tuple>
+template <unsigned... N, typename Tuple>
+struct PopBackHelper<Seq<N...>, Tuple>
{
template <template <typename... Args> class U>
using rebind = U<typename std::tuple_element<N, Tuple>::type...>;
@@ -424,39 +448,42 @@
std::tuple<T...>>::template rebind<U>;
};
-template <> struct PopBack<>
+template <>
+struct PopBack<>
{
- template <template <typename... Args> class U> using rebind = U<>;
+ template <template <typename... Args> class U>
+ using rebind = U<>;
};
// from
// http://stackoverflow.com/questions/2118541/check-if-c0x-parameter-pack-contains-a-type
-template <typename Tp, typename... List> struct Contains : std::true_type
-{
-};
+template <typename Tp, typename... List>
+struct Contains : std::true_type
+{};
template <typename Tp, typename Head, typename... Rest>
-struct Contains<Tp, Head, Rest...>
- : std::conditional<std::is_same<Tp, Head>::value, std::true_type,
- Contains<Tp, Rest...>>::type
-{
-};
+struct Contains<Tp, Head, Rest...> :
+ std::conditional<std::is_same<Tp, Head>::value, std::true_type,
+ Contains<Tp, Rest...>>::type
+{};
-template <typename Tp> struct Contains<Tp> : std::false_type
-{
-};
+template <typename Tp>
+struct Contains<Tp> : std::false_type
+{};
-template <typename T> struct EmptyContext
-{
-};
+template <typename T>
+struct EmptyContext
+{};
-template <typename T> struct promote
+template <typename T>
+struct promote
{
using type = T;
};
#define BMCWEB_INTERNAL_PROMOTE_TYPE(t1, t2) \
- template <> struct promote<t1> \
+ template <> \
+ struct promote<t1> \
{ \
using type = t2; \
}
@@ -474,7 +501,8 @@
BMCWEB_INTERNAL_PROMOTE_TYPE(float, double);
#undef BMCWEB_INTERNAL_PROMOTE_TYPE
-template <typename T> using promote_t = typename promote<T>::type;
+template <typename T>
+using promote_t = typename promote<T>::type;
} // namespace black_magic
@@ -504,13 +532,15 @@
namespace utility
{
-template <class T, class... Args> T& getElementByType(std::tuple<Args...>& t)
+template <class T, class... Args>
+T& getElementByType(std::tuple<Args...>& t)
{
return std::get<
detail::GetIndexOfElementFromTupleByTypeImpl<T, 0, Args...>::value>(t);
}
-template <typename T> struct function_traits;
+template <typename T>
+struct function_traits;
template <typename T>
struct function_traits : public function_traits<decltype(&T::operator())>
@@ -518,7 +548,8 @@
using parent_t = function_traits<decltype(&T::operator())>;
static const size_t arity = parent_t::arity;
using result_type = typename parent_t::result_type;
- template <size_t i> using arg = typename parent_t::template arg<i>;
+ template <size_t i>
+ using arg = typename parent_t::template arg<i>;
};
template <typename ClassType, typename r, typename... Args>
diff --git a/http/websocket.h b/http/websocket.h
index ad090e0..b89a74b 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -1,12 +1,13 @@
#pragma once
-#include <array>
+#include "http_request.h"
+
#include <async_resp.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/beast/websocket.hpp>
-#include <functional>
-#include "http_request.h"
+#include <array>
+#include <functional>
#ifdef BMCWEB_ENABLE_SSL
#include <boost/beast/websocket/ssl.hpp>
@@ -56,7 +57,8 @@
void* userdataPtr;
};
-template <typename Adaptor> class ConnectionImpl : public Connection
+template <typename Adaptor>
+class ConnectionImpl : public Connection
{
public:
ConnectionImpl(