From 7ec392eda3345606f0de75a432954b221cee82ce Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 13 Nov 2024 15:40:01 +0100 Subject: add doxygen + check const correctness --- src/example/audio_internal.cpp | 4 ++-- src/example/components_internal.cpp | 2 +- src/example/db.cpp | 8 ++++---- src/example/proxy.cpp | 9 ++++----- src/example/rendering.cpp | 2 +- src/example/savemgr.cpp | 16 ++++++++-------- src/example/script.cpp | 6 +++--- 7 files changed, 23 insertions(+), 24 deletions(-) (limited to 'src/example') diff --git a/src/example/audio_internal.cpp b/src/example/audio_internal.cpp index 1ea839d..ff55a59 100644 --- a/src/example/audio_internal.cpp +++ b/src/example/audio_internal.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include @@ -18,7 +18,7 @@ using std::make_unique; int _ = []() { // Show dbg_trace() output auto & cfg = Config::get_instance(); - cfg.log.level = LogLevel::TRACE; + cfg.log.level = Log::Level::TRACE; return 0; // satisfy compiler }(); diff --git a/src/example/components_internal.cpp b/src/example/components_internal.cpp index ea1eaad..f7e395b 100644 --- a/src/example/components_internal.cpp +++ b/src/example/components_internal.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include using namespace crepe; using namespace std; diff --git a/src/example/db.cpp b/src/example/db.cpp index 8c06a84..ee4e8fc 100644 --- a/src/example/db.cpp +++ b/src/example/db.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include using namespace crepe; using namespace std; @@ -8,7 +8,7 @@ using namespace std; // run before main static auto _ = []() { auto & cfg = Config::get_instance(); - cfg.log.level = LogLevel::TRACE; + cfg.log.level = Log::Level::TRACE; return 0; }(); @@ -20,11 +20,11 @@ int main() { const char * test_key = "test-key"; string test_data = "Hello world!"; - dbg_logf("DB has key = %d", db.has(test_key)); + dbg_logf("DB has key = {}", db.has(test_key)); db.set(test_key, test_data); - dbg_logf("key = \"%s\"", db.get(test_key).c_str()); + dbg_logf("key = \"{}\"", db.get(test_key)); return 0; } diff --git a/src/example/proxy.cpp b/src/example/proxy.cpp index 0afff41..ca68d9a 100644 --- a/src/example/proxy.cpp +++ b/src/example/proxy.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include using namespace std; using namespace crepe; @@ -17,18 +17,17 @@ void test_ro_val(int val) {} int main() { auto & cfg = Config::get_instance(); - cfg.log.level = LogLevel::DEBUG; + cfg.log.level = Log::Level::DEBUG; int real_value = 0; ValueBroker broker{ [&real_value](const int & target) { - dbg_logf("set %s to %s", to_string(real_value).c_str(), - to_string(target).c_str()); + dbg_logf("set {} to {}", real_value, target); real_value = target; }, [&real_value]() -> const int & { - dbg_logf("get %s", to_string(real_value).c_str()); + dbg_logf("get {}", real_value); return real_value; }, }; diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp index d554a8a..cbd7de7 100644 --- a/src/example/rendering.cpp +++ b/src/example/rendering.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/example/savemgr.cpp b/src/example/savemgr.cpp index 436fb5a..5a415b7 100644 --- a/src/example/savemgr.cpp +++ b/src/example/savemgr.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include using namespace crepe; @@ -15,7 +15,7 @@ using namespace crepe; int _ = []() { // make sure all log messages get printed auto & cfg = Config::get_instance(); - cfg.log.level = LogLevel::TRACE; + cfg.log.level = Log::Level::TRACE; return 0; // satisfy compiler }(); @@ -25,19 +25,19 @@ int main() { SaveManager & mgr = SaveManager::get_instance(); - dbg_logf("has key = %s", mgr.has(key) ? "true" : "false"); + dbg_logf("has key = {}", mgr.has(key)); ValueBroker prop = mgr.get(key, 0); Proxy val = mgr.get(key, 0); - dbg_logf("val = %d", mgr.get(key).get()); + dbg_logf("val = {}", mgr.get(key).get()); prop.set(1); - dbg_logf("val = %d", mgr.get(key).get()); + dbg_logf("val = {}", mgr.get(key).get()); val = 2; - dbg_logf("val = %d", mgr.get(key).get()); + dbg_logf("val = {}", mgr.get(key).get()); mgr.set(key, 3); - dbg_logf("val = %d", mgr.get(key).get()); + dbg_logf("val = {}", mgr.get(key).get()); - dbg_logf("has key = %s", mgr.has(key) ? "true" : "false"); + dbg_logf("has key = {}", mgr.has(key)); assert(true == mgr.has(key)); return 0; diff --git a/src/example/script.cpp b/src/example/script.cpp index 9e8b147..d1388b5 100644 --- a/src/example/script.cpp +++ b/src/example/script.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include @@ -20,7 +20,7 @@ using namespace std; int _ = []() { // Show dbg_trace() output auto & cfg = Config::get_instance(); - cfg.log.level = LogLevel::TRACE; + cfg.log.level = Log::Level::TRACE; return 0; // satisfy compiler }(); @@ -30,7 +30,7 @@ class MyScript : public Script { void update() { // Retrieve component from the same GameObject this script is on Transform & test = get_component(); - dbg_logf("Transform(%.2f, %.2f)", test.position.x, test.position.y); + dbg_logf("Transform({:.2f}, {:.2f})", test.position.x, test.position.y); } }; -- cgit v1.2.3