diff -r 68443f5be176 -r 44679e468ba9 src/basics.h --- a/src/basics.h Sat Oct 05 23:47:03 2019 +0300 +++ b/src/basics.h Sun Nov 03 12:17:41 2019 +0200 @@ -17,8 +17,10 @@ */ #pragma once +#include #include #include +#include #include #include #include @@ -42,7 +44,7 @@ enum Winding { NoWinding, - CounterClockwise, + Anticlockwise, Clockwise, }; @@ -64,51 +66,4 @@ return one; } -template -constexpr std::size_t countof(T(&)[N]) -{ - return N; -} - static constexpr long double pi = M_PIl; - -// http://stackoverflow.com/a/18204188/3629665 -template -inline auto rotl10(T x) - -> std::enable_if_t, T> -{ - return (x << 10) | ((x >> 22) & 0x000000ff); -} - -template -inline auto rotl20(T x) - -> std::enable_if_t, T> -{ - return (x << 20) | ((x >> 12) & 0x000000ff); -} - -template -QString format(const QString& format_string, T&& arg, Rest&&... rest) -{ - return format(format_string.arg(arg), std::forward(rest)...); -} - -template -QString format(const QString& format_string, T&& arg) -{ - return format_string.arg(arg); -} - -inline QString quoted(QString string) -{ - if (string.contains("'")) - { - string.replace("\"", "\\\""); - string = "\"" + string + "\""; - } - else - { - string = "'" + string + "'"; - } - return string; -}