diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-13 15:50:13 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-13 15:50:13 +0100 |
commit | 5e59c22f77073fdf49bf98697da6a68819eb5776 (patch) | |
tree | ed53c8306c93825e9a33d642ae976ec97eb94fb1 /src/crepe | |
parent | 7ec392eda3345606f0de75a432954b221cee82ce (diff) |
`make format`
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/Asset.cpp | 1 | ||||
-rw-r--r-- | src/crepe/Exception.cpp | 5 | ||||
-rw-r--r-- | src/crepe/Exception.h | 7 | ||||
-rw-r--r-- | src/crepe/Exception.hpp | 7 | ||||
-rw-r--r-- | src/crepe/api/Config.h | 1 | ||||
-rw-r--r-- | src/crepe/api/Script.hpp | 3 | ||||
-rw-r--r-- | src/crepe/util/Log.cpp | 1 | ||||
-rw-r--r-- | src/crepe/util/Log.h | 17 | ||||
-rw-r--r-- | src/crepe/util/Log.hpp | 12 |
9 files changed, 27 insertions, 27 deletions
diff --git a/src/crepe/Asset.cpp b/src/crepe/Asset.cpp index 4affd58..9c41ecb 100644 --- a/src/crepe/Asset.cpp +++ b/src/crepe/Asset.cpp @@ -14,4 +14,3 @@ Asset::Asset(const std::string & src) : src(src) { istream & Asset::get_stream() { return this->file; } const string & Asset::get_canonical() const { return this->src; } - diff --git a/src/crepe/Exception.cpp b/src/crepe/Exception.cpp index 3217169..5a24e7e 100644 --- a/src/crepe/Exception.cpp +++ b/src/crepe/Exception.cpp @@ -5,7 +5,4 @@ using namespace std; const char * Exception::what() const noexcept { return error.c_str(); } -Exception::Exception(const string & msg) { - this->error = msg; -} - +Exception::Exception(const string & msg) { this->error = msg; } diff --git a/src/crepe/Exception.h b/src/crepe/Exception.h index ed3ab15..580fc16 100644 --- a/src/crepe/Exception.h +++ b/src/crepe/Exception.h @@ -1,8 +1,8 @@ #pragma once #include <exception> -#include <string> #include <format> +#include <string> namespace crepe { @@ -13,8 +13,8 @@ public: Exception(const std::string & msg); //! Exception with \c std::format message - template<class... Args> - Exception(std::format_string<Args...> fmt, Args&&... args); + template <class... Args> + Exception(std::format_string<Args...> fmt, Args &&... args); //! Get formatted error message const char * what() const noexcept; @@ -29,4 +29,3 @@ protected: } // namespace crepe #include "Exception.hpp" - diff --git a/src/crepe/Exception.hpp b/src/crepe/Exception.hpp index d813879..7c462a3 100644 --- a/src/crepe/Exception.hpp +++ b/src/crepe/Exception.hpp @@ -4,10 +4,9 @@ namespace crepe { -template<class... Args> -Exception::Exception(std::format_string<Args...> fmt, Args&&... args) { +template <class... Args> +Exception::Exception(std::format_string<Args...> fmt, Args &&... args) { this->error = std::format(fmt, std::forward<Args>(args)...); } -} - +} // namespace crepe diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h index dad7e08..e3f86bf 100644 --- a/src/crepe/api/Config.h +++ b/src/crepe/api/Config.h @@ -7,6 +7,7 @@ namespace crepe { class Config { private: Config() = default; + public: ~Config() = default; diff --git a/src/crepe/api/Script.hpp b/src/crepe/api/Script.hpp index afe653f..d755fda 100644 --- a/src/crepe/api/Script.hpp +++ b/src/crepe/api/Script.hpp @@ -13,7 +13,8 @@ T & Script::get_component() const { std::vector<std::reference_wrapper<T>> all_components = this->get_components<T>(); if (all_components.size() < 1) - throw Exception("Script: no component found with type = %s", typeid(T).name()); + throw Exception("Script: no component found with type = %s", + typeid(T).name()); return all_components.back().get(); } diff --git a/src/crepe/util/Log.cpp b/src/crepe/util/Log.cpp index 346e08e..e583734 100644 --- a/src/crepe/util/Log.cpp +++ b/src/crepe/util/Log.cpp @@ -36,4 +36,3 @@ void Log::log(const Level & level, const string & msg) { fwrite(out.c_str(), 1, out.size(), stdout); fflush(stdout); } - diff --git a/src/crepe/util/Log.h b/src/crepe/util/Log.h index 4e32e9d..01452b2 100644 --- a/src/crepe/util/Log.h +++ b/src/crepe/util/Log.h @@ -8,7 +8,12 @@ #include "LogColor.h" // utility macros -#define _crepe_logf_here(level, fmt, ...) crepe::Log::logf(level, "{}" fmt, crepe::LogColor().fg_white(false).str(std::format("{} ({}:{})", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__)), __VA_ARGS__) +#define _crepe_logf_here(level, fmt, ...) \ + crepe::Log::logf( \ + level, "{}" fmt, \ + crepe::LogColor().fg_white(false).str(std::format( \ + "{} ({}:{})", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__)), \ + __VA_ARGS__) // very illegal global function-style macros // NOLINTBEGIN @@ -53,8 +58,9 @@ public: * \param fmt Message format * \param args Format arguments */ - template<class... Args> - static void logf(const Level & level, std::format_string<Args...> fmt, Args&&... args); + template <class... Args> + static void logf(const Level & level, std::format_string<Args...> fmt, + Args &&... args); /** * \brief Format a message and log it (with default severity \c INFO) @@ -62,8 +68,8 @@ public: * \param fmt Message format * \param args Format arguments */ - template<class... Args> - static void logf(std::format_string<Args...> fmt, Args&&... args); + template <class... Args> + static void logf(std::format_string<Args...> fmt, Args &&... args); private: /** @@ -77,4 +83,3 @@ private: } // namespace crepe #include "Log.hpp" - diff --git a/src/crepe/util/Log.hpp b/src/crepe/util/Log.hpp index 58ba475..651f076 100644 --- a/src/crepe/util/Log.hpp +++ b/src/crepe/util/Log.hpp @@ -4,15 +4,15 @@ namespace crepe { -template<class... Args> -void Log::logf(std::format_string<Args...> fmt, Args&&... args) { +template <class... Args> +void Log::logf(std::format_string<Args...> fmt, Args &&... args) { Log::logf(Level::INFO, fmt, std::forward<Args>(args)...); } -template<class... Args> -void Log::logf(const Level & level, std::format_string<Args...> fmt, Args&&... args) { +template <class... Args> +void Log::logf(const Level & level, std::format_string<Args...> fmt, + Args &&... args) { Log::log(level, std::format(fmt, std::forward<Args>(args)...)); } -} - +} // namespace crepe |