diff --git a/CMakeLists.txt b/CMakeLists.txt index a5fbf1e..6c19acb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.21) project(mirai LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 23) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_COMPILE_WARNING_AS_ERROR ON) set(CMAKE_BUILD_RPATH_USE_ORIGIN ON) diff --git a/external/mirai-core/CMakeLists.txt b/external/mirai-core/CMakeLists.txt index 50ce1b7..97585e8 100644 --- a/external/mirai-core/CMakeLists.txt +++ b/external/mirai-core/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.21) project(mirai LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 23) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_COMPILE_WARNING_AS_ERROR ON) diff --git a/external/mirai-core/external/cpp-utils/debug.h b/external/mirai-core/external/cpp-utils/debug.h index 592a453..2df87ca 100644 --- a/external/mirai-core/external/cpp-utils/debug.h +++ b/external/mirai-core/external/cpp-utils/debug.h @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace cpputils::debug @@ -50,7 +51,7 @@ class Timer durationToShow += std::chrono::duration_cast(now - startTime).count(); } - std::cout << "[Debug - Timer] " << message << ": " << durationToShow << " ms" << std::endl; + std::println("[Debug - Timer] {}: {} ms", message, durationToShow); } private: diff --git a/external/mirai-core/src/MarkdownDataProvider.Parser.cpp b/external/mirai-core/src/MarkdownDataProvider.Parser.cpp index cfdeda9..79603d8 100644 --- a/external/mirai-core/src/MarkdownDataProvider.Parser.cpp +++ b/external/mirai-core/src/MarkdownDataProvider.Parser.cpp @@ -7,6 +7,7 @@ #include "MarkdownDataProvider.h" #include "cpp-utils/debug.h" #include "utils.h" +#include #include namespace mirai @@ -43,16 +44,6 @@ TaskData stringToTask(const std::string &str, const std::string &date) ); std::regex_match(str, matches, regex); - /*std::cout << "line " << str << std::endl;*/ - /*std::cout << "M 0 " << matches[0] << std::endl;*/ - /*std::cout << "M 1 " << matches[1] << std::endl;*/ - /*std::cout << "M 2 " << matches[2] << std::endl;*/ - /*std::cout << "M 3 " << matches[3] << std::endl;*/ - /*std::cout << "M 4 " << matches[4] << std::endl;*/ - /*std::cout << "M 5 " << matches[5] << std::endl;*/ - /*std::cout << "M 6 " << matches[6] << std::endl;*/ - /*std::cout << "M 7 " << matches[7] << std::endl;*/ - std::string text = stringUtils::trim(matches[5]); TaskData taskItem{ @@ -83,15 +74,6 @@ EventData stringToEvent(const std::string &str, const std::string &dateString) std::regex regex("> (([0-9]{2}h[0-9]{2})-([0-9]{2}h[0-9]{2}) )(.*?)( -- (.*))?"); std::regex_match(str, matches, regex); - /*std::cout << "line " << str << std::endl;*/ - /*std::cout << "M 0 " << matches[0] << std::endl;*/ - /*std::cout << "M 1 " << matches[1] << std::endl;*/ - /*std::cout << "M 2 " << matches[2] << std::endl;*/ - /*std::cout << "M 3 " << matches[3] << std::endl;*/ - /*std::cout << "M 4 " << matches[4] << std::endl;*/ - /*std::cout << "M 5 " << matches[5] << std::endl;*/ - /*std::cout << "M 6 " << matches[6] << std::endl;*/ - std::string text = stringUtils::trim(matches[4]); auto date = stringToDate(dateString); @@ -101,8 +83,9 @@ EventData stringToEvent(const std::string &str, const std::string &dateString) } EventData eventData{ - .title = text, .startsAt = stringToTime(matches[2]), .endsAt = stringToTime(matches[3]), - //.tags = extractTagsFromMetadata(matches[6]) + .title = text, + .startsAt = stringToTime(matches[2]), + .endsAt = stringToTime(matches[3]), }; return eventData; } @@ -110,12 +93,6 @@ EventData stringToEvent(const std::string &str, const std::string &dateString) std::string taskToString(const TaskData &task) { std::string str = task.title; - /*if (task.getTags().size() > 0) {*/ - /*str += " --";*/ - /*for (const std::string &tag : task.getTags()) {*/ - /*str += " #" + tag;*/ - /*}*/ - /*}*/ str = (task.state == DONE ? "- [X] " : "- [ ] ") + str; return str; } @@ -170,13 +147,12 @@ MarkdownData MarkdownDataProvider::parseMarkdown(const std::string &content) { cpputils::debug::Timer readMdFormatDuration; - // std::vector taskItems; std::string line; std::stringstream contentStream(content); if (!std::getline(contentStream, line) || line.substr(0, 2) != "# ") { - std::cerr << "Couldn't find the task list name" << std::endl; + std::println("Couldn't find the task list name"); } data.name = line.substr(2); diff --git a/external/mirai-core/src/Mirai.cpp b/external/mirai-core/src/Mirai.cpp index 4552b2c..f82ffbd 100644 --- a/external/mirai-core/src/Mirai.cpp +++ b/external/mirai-core/src/Mirai.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -52,7 +53,7 @@ void Mirai::saveConfig() { std::ofstream file(configPath_); if (!file.is_open()) { - std::cerr << "Can't save config to " << configPath_ << std::endl; + std::print(std::cerr, "Can't save config to {}", configPath_); return; } auto configJson = nlohmann::json::parse(R"( diff --git a/src/AppWindowBackend.cpp b/src/AppWindowBackend.cpp index cde3e83..5ddb993 100644 --- a/src/AppWindowBackend.cpp +++ b/src/AppWindowBackend.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ AppWindowBackend::AppWindowBackend(mirai::Mirai *miraiInstance) const auto palettePath = std::string(getenv("HOME")) + "/.config/evalyte/theme.json"; const auto palette = selenite::parseJson(palettePath); if (palette.has_value()) { - std::cerr << "Warning, no " << palettePath << " found" << std::endl; + std::println(std::cerr, "Warning, no {} found", palettePath); setSelenitePalette(mainWindow_->global(), palette.value()); setSelenitePalette(settingsWindow_->global(), palette.value()); setSelenitePalette(addSourceWindow_->global(), palette.value());