mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Format all c++ files
This commit is contained in:
parent
081e107b9b
commit
f8f49233dc
21 changed files with 683 additions and 599 deletions
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Mirai. Copyright (C) 2024 Vyn
|
||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
@ -20,76 +20,75 @@
|
|||
|
||||
/*namespace mirai {*/
|
||||
|
||||
/*class TodoTxtFormat {*/
|
||||
/*public:*/
|
||||
/*class TodoTxtFormat {*/
|
||||
/*public:*/
|
||||
|
||||
/*static TaskList readFile() {*/
|
||||
/*std::ifstream file("../newqml/todo.txt");*/
|
||||
/*if (!file.is_open()) {*/
|
||||
/*throw std::runtime_error("todo.txt file not found");*/
|
||||
/*}*/
|
||||
/*std::vector<TaskItem> taskItems;*/
|
||||
/*std::string line;*/
|
||||
/*while (std::getline(file, line)) {*/
|
||||
/*auto taskItem = parseLine(line);*/
|
||||
/*taskItems.push_back(taskItem);*/
|
||||
/*}*/
|
||||
/*file.close();*/
|
||||
/*TaskList tasks({*/
|
||||
/*.tasks = taskItems*/
|
||||
/*});*/
|
||||
/*return tasks;*/
|
||||
/*}*/
|
||||
/*static TaskList readFile() {*/
|
||||
/*std::ifstream file("../newqml/todo.txt");*/
|
||||
/*if (!file.is_open()) {*/
|
||||
/*throw std::runtime_error("todo.txt file not found");*/
|
||||
/*}*/
|
||||
/*std::vector<TaskItem> taskItems;*/
|
||||
/*std::string line;*/
|
||||
/*while (std::getline(file, line)) {*/
|
||||
/*auto taskItem = parseLine(line);*/
|
||||
/*taskItems.push_back(taskItem);*/
|
||||
/*}*/
|
||||
/*file.close();*/
|
||||
/*TaskList tasks({*/
|
||||
/*.tasks = taskItems*/
|
||||
/*});*/
|
||||
/*return tasks;*/
|
||||
/*}*/
|
||||
|
||||
/*static void writeFile(TaskList& tasks) {*/
|
||||
/*std::ofstream file("../newqml/todo.txt");*/
|
||||
/*if (!file.is_open()) {*/
|
||||
/*throw std::runtime_error("can't create todo.txt");*/
|
||||
/*}*/
|
||||
/*for (const auto& task : tasks.getTasks()) {*/
|
||||
/*file << fieldWithSpace(task->state == DONE ? "x" : task->priority);*/
|
||||
/*file << fieldWithSpace(task->state == DONE ? task->getDate() : "");*/
|
||||
/*file << fieldWithSpace(task->getCreationDate());*/
|
||||
/*file << task->getText() << '\n';*/
|
||||
/*}*/
|
||||
/*file.close();*/
|
||||
/*}*/
|
||||
/*static void writeFile(TaskList& tasks) {*/
|
||||
/*std::ofstream file("../newqml/todo.txt");*/
|
||||
/*if (!file.is_open()) {*/
|
||||
/*throw std::runtime_error("can't create todo.txt");*/
|
||||
/*}*/
|
||||
/*for (const auto& task : tasks.getTasks()) {*/
|
||||
/*file << fieldWithSpace(task->state == DONE ? "x" : task->priority);*/
|
||||
/*file << fieldWithSpace(task->state == DONE ? task->getDate() : "");*/
|
||||
/*file << fieldWithSpace(task->getCreationDate());*/
|
||||
/*file << task->getText() << '\n';*/
|
||||
/*}*/
|
||||
/*file.close();*/
|
||||
/*}*/
|
||||
|
||||
/*private:*/
|
||||
/*private:*/
|
||||
|
||||
/*static std::string fieldWithSpace(const std::string& field) {*/
|
||||
/*if (field.length() == 0)*/
|
||||
/*return "";*/
|
||||
/*return (field + " ");*/
|
||||
/*}*/
|
||||
/*static std::string fieldWithSpace(const std::string& field) {*/
|
||||
/*if (field.length() == 0)*/
|
||||
/*return "";*/
|
||||
/*return (field + " ");*/
|
||||
/*}*/
|
||||
|
||||
/*static TaskItem parseLine(const std::string& line) {*/
|
||||
/*std::smatch matches;*/
|
||||
/*std::regex regex("(^x )?(\\([A-Z]\\) )?([0-9]{4}-[0-9]{2}-[0-9]{2} )?([0-9]{4}-[0-9]{2}-[0-9]{2} )?(.*)");*/
|
||||
/*std::regex_match(line, matches, regex);*/
|
||||
|
||||
/*for (size_t i = 0; i < matches.size(); ++i) {*/
|
||||
/*std::ssub_match sub_match = matches[i];*/
|
||||
/*std::string piece = sub_match.str();*/
|
||||
/*}*/
|
||||
/*static TaskItem parseLine(const std::string& line) {*/
|
||||
/*std::smatch matches;*/
|
||||
/*std::regex regex("(^x )?(\\([A-Z]\\) )?([0-9]{4}-[0-9]{2}-[0-9]{2} )?([0-9]{4}-[0-9]{2}-[0-9]{2}
|
||||
* )?(.*)");*/
|
||||
/*std::regex_match(line, matches, regex);*/
|
||||
|
||||
/*const TaskItemState taskState = trim_copy(matches[1].str()) == "x" ? DONE : TODO;*/
|
||||
/*const std::string priority = trim_copy(matches[2].str());*/
|
||||
/*const std::string firstDate = trim_copy(matches[3].str());*/
|
||||
/*const std::string secondDate = trim_copy(matches[4].str());*/
|
||||
/*const std::string text = trim_copy(matches[5].str());*/
|
||||
/*for (size_t i = 0; i < matches.size(); ++i) {*/
|
||||
/*std::ssub_match sub_match = matches[i];*/
|
||||
/*std::string piece = sub_match.str();*/
|
||||
/*}*/
|
||||
|
||||
/*const std::string date = taskState == DONE ? firstDate : "";*/
|
||||
/*const TaskItemState taskState = trim_copy(matches[1].str()) == "x" ? DONE : TODO;*/
|
||||
/*const std::string priority = trim_copy(matches[2].str());*/
|
||||
/*const std::string firstDate = trim_copy(matches[3].str());*/
|
||||
/*const std::string secondDate = trim_copy(matches[4].str());*/
|
||||
/*const std::string text = trim_copy(matches[5].str());*/
|
||||
|
||||
|
||||
|
||||
/*return {*/
|
||||
/*.text = text,*/
|
||||
/*.state = taskState,*/
|
||||
/*.date = date,*/
|
||||
/*};*/
|
||||
/*}*/
|
||||
/*};*/
|
||||
/*const std::string date = taskState == DONE ? firstDate : "";*/
|
||||
|
||||
/*return {*/
|
||||
/*.text = text,*/
|
||||
/*.state = taskState,*/
|
||||
/*.date = date,*/
|
||||
/*};*/
|
||||
/*}*/
|
||||
/*};*/
|
||||
/*}*/
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue