mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 10:13:42 +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
|
||||
|
@ -8,59 +8,67 @@
|
|||
#include "TaskItem.h"
|
||||
#include "cpp-utils/vector.h"
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
void Mirai::loadFile(const std::string& path) {
|
||||
auto tasksFile = TodoMdFormat::readFile(path);
|
||||
files->push_back(std::move(tasksFile));
|
||||
tags.clear();
|
||||
for (auto& task : (*files)[0].getTasks()) {
|
||||
for (auto& tag : task->getTags()) {
|
||||
if (vectorUtils::contains(tags, tag)) {
|
||||
tags.push_back(tag);
|
||||
}
|
||||
void Mirai::loadFile(const std::string &path)
|
||||
{
|
||||
auto tasksFile = TodoMdFormat::readFile(path);
|
||||
files->push_back(std::move(tasksFile));
|
||||
tags.clear();
|
||||
for (auto &task : (*files)[0].getTasks()) {
|
||||
for (auto &tag : task->getTags()) {
|
||||
if (!vectorUtils::contains(tags, tag)) {
|
||||
tags.push_back(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::save() {
|
||||
for (auto& file : *files) {
|
||||
TodoMdFormat::writeFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::addTask(TaskItem taskItem) {
|
||||
(*files)[0].addTask(taskItem);
|
||||
for (auto& view : views) {
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::addTask(std::string text, std::string date) {
|
||||
/*std::time_t t = std::time(nullptr);*/
|
||||
/*std::tm tm = *std::localtime(&t);*/
|
||||
/*std::stringstream ssCreationDate;*/
|
||||
/*ssCreationDate << std::put_time(&tm, "%Y-%m-%d");*/
|
||||
(*files)[0].addTask(text, date);
|
||||
for (auto& view : views) {
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::removeTask(const TaskItem* taskItem) {
|
||||
(*files)[0].removeTask(taskItem);
|
||||
for (auto& view : views) {
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
std::weak_ptr<TasksView> Mirai::getTasks() {
|
||||
auto view = std::make_shared<TasksView>(files);
|
||||
views.push_back(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& Mirai::getTags() {
|
||||
return tags;
|
||||
void Mirai::save()
|
||||
{
|
||||
for (auto &file : *files) {
|
||||
TodoMdFormat::writeFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::addTask(TaskItem taskItem)
|
||||
{
|
||||
(*files)[0].addTask(taskItem);
|
||||
for (auto &view : views) {
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::addTask(std::string text, std::string date)
|
||||
{
|
||||
/*std::time_t t = std::time(nullptr);*/
|
||||
/*std::tm tm = *std::localtime(&t);*/
|
||||
/*std::stringstream ssCreationDate;*/
|
||||
/*ssCreationDate << std::put_time(&tm, "%Y-%m-%d");*/
|
||||
(*files)[0].addTask(text, date);
|
||||
for (auto &view : views) {
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
void Mirai::removeTask(const TaskItem *taskItem)
|
||||
{
|
||||
(*files)[0].removeTask(taskItem);
|
||||
for (auto &view : views) {
|
||||
view->update();
|
||||
}
|
||||
}
|
||||
|
||||
std::weak_ptr<TasksView> Mirai::getTasks()
|
||||
{
|
||||
auto view = std::make_shared<TasksView>(files);
|
||||
views.push_back(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
const std::vector<std::string> &Mirai::getTags()
|
||||
{
|
||||
return tags;
|
||||
}
|
||||
} // namespace mirai
|
||||
|
|
|
@ -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
|
||||
|
@ -14,33 +14,33 @@
|
|||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
class Mirai {
|
||||
class Mirai
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
void loadFile(const std::string &path);
|
||||
void save();
|
||||
void addTask(TaskItem taskItem);
|
||||
void addTask(std::string text, std::string date);
|
||||
void removeTask(const TaskItem *taskItem);
|
||||
|
||||
void loadFile(const std::string& path);
|
||||
void save();
|
||||
void addTask(TaskItem taskItem);
|
||||
void addTask(std::string text, std::string date);
|
||||
void removeTask(const TaskItem* taskItem);
|
||||
std::weak_ptr<TasksView> getTasks();
|
||||
const std::vector<std::string> &getTags();
|
||||
|
||||
std::weak_ptr<TasksView> getTasks();
|
||||
const std::vector<std::string>& getTags();
|
||||
private:
|
||||
// The `TasksFile`s are shared to the views, their lifetime can outlive
|
||||
// this (Mirai) object
|
||||
// because we can't control if the caller will keep the main object alive.
|
||||
std::shared_ptr<std::vector<TasksFile>> files = std::make_shared<std::vector<TasksFile>>();
|
||||
|
||||
private:
|
||||
|
||||
// The `TasksFile`s are shared to the views, their lifetime can outlive
|
||||
// this (Mirai) object
|
||||
// because we can't control if the caller will keep the main object alive.
|
||||
std::shared_ptr<std::vector<TasksFile>> files = std::make_shared<std::vector<TasksFile>>();
|
||||
|
||||
// We keep a vector of shared_ptr because we need the ref counting mechanism to know
|
||||
// if we have to remove the view (not used) or tell the view to update() on
|
||||
// some changes.
|
||||
std::vector<std::shared_ptr<TasksView>> views;
|
||||
std::vector<std::string> tags;
|
||||
};
|
||||
}
|
||||
// We keep a vector of shared_ptr because we need the ref counting mechanism to know
|
||||
// if we have to remove the view (not used) or tell the view to update() on
|
||||
// some changes.
|
||||
std::vector<std::shared_ptr<TasksView>> views;
|
||||
std::vector<std::string> tags;
|
||||
};
|
||||
} // namespace mirai
|
||||
#endif
|
||||
|
|
|
@ -1,41 +1,72 @@
|
|||
/*
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "TaskItem.h"
|
||||
#include "cpp-utils/vector.h"
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
void TaskItem::markAsDone() {
|
||||
state = DONE;
|
||||
}
|
||||
|
||||
void TaskItem::markAsUndone() {
|
||||
state = TODO;
|
||||
}
|
||||
|
||||
void TaskItem::setDate(const std::string& date) {
|
||||
this->date = date;
|
||||
}
|
||||
|
||||
void TaskItem::setText(const std::string& text) {
|
||||
this->text = text;
|
||||
}
|
||||
|
||||
const std::string& TaskItem::getText() const { return text; }
|
||||
const TaskItemState& TaskItem::getState() const { return state; }
|
||||
const std::string& TaskItem::getDate() const { return date; }
|
||||
const std::string& TaskItem::getStartTime() const { return startTime; }
|
||||
const std::string& TaskItem::getEndTime() const { return endTime; }
|
||||
const Tags& TaskItem::getTags() const { return tags; }
|
||||
bool TaskItem::hasDate() const { return isDate(date); }
|
||||
|
||||
|
||||
bool TaskItem::hasTag(const std::string& tag) const {
|
||||
return vectorUtils::contains(tags, tag);
|
||||
}
|
||||
void TaskItem::markAsDone()
|
||||
{
|
||||
state = DONE;
|
||||
}
|
||||
|
||||
void TaskItem::markAsUndone()
|
||||
{
|
||||
state = TODO;
|
||||
}
|
||||
|
||||
void TaskItem::setDate(const std::string &date)
|
||||
{
|
||||
this->date = date;
|
||||
}
|
||||
|
||||
void TaskItem::setText(const std::string &text)
|
||||
{
|
||||
this->text = text;
|
||||
}
|
||||
|
||||
const std::string &TaskItem::getText() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
const TaskItemState &TaskItem::getState() const
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
const std::string &TaskItem::getDate() const
|
||||
{
|
||||
return date;
|
||||
}
|
||||
|
||||
const std::string &TaskItem::getStartTime() const
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
const std::string &TaskItem::getEndTime() const
|
||||
{
|
||||
return endTime;
|
||||
}
|
||||
|
||||
const Tags &TaskItem::getTags() const
|
||||
{
|
||||
return tags;
|
||||
}
|
||||
|
||||
bool TaskItem::hasDate() const
|
||||
{
|
||||
return isDate(date);
|
||||
}
|
||||
|
||||
bool TaskItem::hasTag(const std::string &tag) const
|
||||
{
|
||||
return vectorUtils::contains(tags, tag);
|
||||
}
|
||||
} // namespace mirai
|
||||
|
|
|
@ -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,39 +20,36 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mirai {
|
||||
enum TaskItemState {
|
||||
TODO,
|
||||
DONE
|
||||
};
|
||||
namespace mirai
|
||||
{
|
||||
enum TaskItemState { TODO, DONE };
|
||||
|
||||
struct TaskItem {
|
||||
public:
|
||||
struct TaskItem {
|
||||
public:
|
||||
void markAsDone();
|
||||
|
||||
void markAsDone();
|
||||
void markAsUndone();
|
||||
void setDate(const std::string &date);
|
||||
|
||||
void markAsUndone();
|
||||
void setDate(const std::string& date);
|
||||
void setText(const std::string &text);
|
||||
|
||||
void setText(const std::string& text);
|
||||
const std::string &getLine() const;
|
||||
const std::string &getText() const;
|
||||
const TaskItemState &getState() const;
|
||||
const std::string &getDate() const;
|
||||
const std::string &getStartTime() const;
|
||||
const std::string &getEndTime() const;
|
||||
const Tags &getTags() const;
|
||||
bool hasTag(const std::string &tag) const;
|
||||
bool hasDate() const;
|
||||
|
||||
const std::string& getLine() const;
|
||||
const std::string& getText() const;
|
||||
const TaskItemState& getState() const;
|
||||
const std::string& getDate() const;
|
||||
const std::string& getStartTime() const;
|
||||
const std::string& getEndTime() const;
|
||||
const Tags& getTags() const;
|
||||
bool hasTag(const std::string& tag) const;
|
||||
bool hasDate() const;
|
||||
|
||||
std::string text;
|
||||
TaskItemState state;
|
||||
std::string date;
|
||||
std::string startTime;
|
||||
std::string endTime;
|
||||
Tags tags;
|
||||
};
|
||||
}
|
||||
std::string text;
|
||||
TaskItemState state;
|
||||
std::string date;
|
||||
std::string startTime;
|
||||
std::string endTime;
|
||||
Tags tags;
|
||||
};
|
||||
} // namespace mirai
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
@ -8,48 +8,64 @@
|
|||
#include "TaskItem.h"
|
||||
#include <memory>
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
TasksFile::TasksFile(TasksFileConstructor params) : name(params.name), path(params.path) {
|
||||
for (const auto& task : params.tasks) {
|
||||
tasks.push_back(std::make_unique<TaskItem>(task));
|
||||
}
|
||||
sortByDate();
|
||||
}
|
||||
|
||||
const std::string& TasksFile::getName() const { return name; }
|
||||
const std::string& TasksFile::getPath() const { return path; }
|
||||
TasksPtrs& TasksFile::getTasks() { return tasks; }
|
||||
|
||||
void TasksFile::addTask(TaskItem taskItem) {
|
||||
tasks.push_back(std::make_unique<TaskItem>(taskItem));
|
||||
sortByDate();
|
||||
}
|
||||
|
||||
void TasksFile::addTask(std::string text, std::string date) {
|
||||
auto newTask = std::make_unique<TaskItem>(TaskItem{
|
||||
.text = text,
|
||||
.state = TODO,
|
||||
.date = date == "" ? "No date" : date
|
||||
});
|
||||
tasks.push_back(std::move(newTask));
|
||||
sortByDate();
|
||||
}
|
||||
|
||||
void TasksFile::removeTask(const TaskItem* taskToRemove) {
|
||||
tasks.erase(std::remove_if(tasks.begin(), tasks.end(), [&] (const std::unique_ptr<TaskItem>& taskInFilter){
|
||||
return taskInFilter.get() == taskToRemove;
|
||||
}));
|
||||
}
|
||||
|
||||
void TasksFile::sortByDate() {
|
||||
std::sort(tasks.begin(), tasks.end(), [] (const std::unique_ptr<TaskItem>& t1, const std::unique_ptr<TaskItem>& t2) {
|
||||
if (t1->hasDate() && !t2->hasDate()) {
|
||||
return true;
|
||||
} else if (!t1->hasDate() && t2->hasDate()) {
|
||||
return false;
|
||||
}
|
||||
return t1->date < t2->date;
|
||||
});
|
||||
TasksFile::TasksFile(TasksFileConstructor params) : name(params.name), path(params.path)
|
||||
{
|
||||
for (const auto &task : params.tasks) {
|
||||
tasks.push_back(std::make_unique<TaskItem>(task));
|
||||
}
|
||||
sortByDate();
|
||||
}
|
||||
|
||||
const std::string &TasksFile::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
const std::string &TasksFile::getPath() const
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
TasksPtrs &TasksFile::getTasks()
|
||||
{
|
||||
return tasks;
|
||||
}
|
||||
|
||||
void TasksFile::addTask(TaskItem taskItem)
|
||||
{
|
||||
tasks.push_back(std::make_unique<TaskItem>(taskItem));
|
||||
sortByDate();
|
||||
}
|
||||
|
||||
void TasksFile::addTask(std::string text, std::string date)
|
||||
{
|
||||
auto newTask = std::make_unique<TaskItem>(
|
||||
TaskItem{.text = text, .state = TODO, .date = date == "" ? "No date" : date});
|
||||
tasks.push_back(std::move(newTask));
|
||||
sortByDate();
|
||||
}
|
||||
|
||||
void TasksFile::removeTask(const TaskItem *taskToRemove)
|
||||
{
|
||||
tasks.erase(std::remove_if(tasks.begin(), tasks.end(),
|
||||
[&](const std::unique_ptr<TaskItem> &taskInFilter) {
|
||||
return taskInFilter.get() == taskToRemove;
|
||||
}));
|
||||
}
|
||||
|
||||
void TasksFile::sortByDate()
|
||||
{
|
||||
std::sort(tasks.begin(), tasks.end(),
|
||||
[](const std::unique_ptr<TaskItem> &t1, const std::unique_ptr<TaskItem> &t2) {
|
||||
if (t1->hasDate() && !t2->hasDate()) {
|
||||
return true;
|
||||
} else if (!t1->hasDate() && t2->hasDate()) {
|
||||
return false;
|
||||
}
|
||||
return t1->date < t2->date;
|
||||
});
|
||||
}
|
||||
} // namespace mirai
|
||||
|
|
|
@ -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
|
||||
|
@ -7,6 +7,9 @@
|
|||
#ifndef MIRAI_TASKSFILE_H
|
||||
#define MIRAI_TASKSFILE_H
|
||||
|
||||
#include "TaskItem.h"
|
||||
#include "using.h"
|
||||
#include "utils.h"
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
|
@ -19,41 +22,38 @@
|
|||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "TaskItem.h"
|
||||
#include "using.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
using TasksPtrs = std::vector<std::unique_ptr<TaskItem>>;
|
||||
|
||||
using TasksPtrs = std::vector<std::unique_ptr<TaskItem>>;
|
||||
struct TasksFileConstructor {
|
||||
const std::string &name;
|
||||
const std::string &path;
|
||||
std::vector<TaskItem> tasks;
|
||||
};
|
||||
|
||||
struct TasksFileConstructor {
|
||||
const std::string& name;
|
||||
const std::string& path;
|
||||
std::vector<TaskItem> tasks;
|
||||
};
|
||||
class TasksFile
|
||||
{
|
||||
|
||||
class TasksFile {
|
||||
public:
|
||||
TasksFile(TasksFileConstructor params);
|
||||
|
||||
public:
|
||||
void addTask(std::string text, std::string date);
|
||||
void addTask(TaskItem TaskItem);
|
||||
void removeTask(const TaskItem *taskToRemove);
|
||||
void sortByDate();
|
||||
|
||||
TasksFile(TasksFileConstructor params);
|
||||
const std::string &getName() const;
|
||||
const std::string &getPath() const;
|
||||
TasksPtrs &getTasks();
|
||||
|
||||
void addTask(std::string text, std::string date);
|
||||
void addTask(TaskItem TaskItem);
|
||||
void removeTask(const TaskItem* taskToRemove);
|
||||
void sortByDate();
|
||||
|
||||
const std::string& getName() const;
|
||||
const std::string& getPath() const;
|
||||
TasksPtrs& getTasks();
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
std::string path;
|
||||
TasksPtrs tasks;
|
||||
};
|
||||
}
|
||||
private:
|
||||
std::string name;
|
||||
std::string path;
|
||||
TasksPtrs tasks;
|
||||
};
|
||||
} // namespace mirai
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
@ -7,53 +7,63 @@
|
|||
#include "TasksView.h"
|
||||
#include "cpp-utils/vector.h"
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
TasksView::TasksView(std::shared_ptr<std::vector<TasksFile>> files) : files(files)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
TasksView::TasksView(std::shared_ptr<std::vector<TasksFile>> files) : files(files) {
|
||||
update();
|
||||
}
|
||||
TaskItem &TasksView::operator[](int index)
|
||||
{
|
||||
return *(tasksToShow.at(index));
|
||||
}
|
||||
|
||||
TaskItem& TasksView::operator[](int index) {
|
||||
return *(tasksToShow.at(index));
|
||||
}
|
||||
size_t TasksView::count() const
|
||||
{
|
||||
return tasksToShow.size();
|
||||
}
|
||||
|
||||
int TasksView::count() const { return tasksToShow.size(); }
|
||||
|
||||
void TasksView::update() {
|
||||
tasksToShow.clear();
|
||||
for (auto& file : *files) {
|
||||
for (auto& task : file.getTasks()) {
|
||||
std::function<bool(const std::string&)> f = [&](const std::string& tag) {
|
||||
return task->hasTag(tag);
|
||||
};
|
||||
if (tagsFilter.size() > 0 && !vectorUtils::containsAll(tagsFilter, task->getTags()))
|
||||
continue;
|
||||
tasksToShow.push_back(task.get());
|
||||
void TasksView::update()
|
||||
{
|
||||
tasksToShow.clear();
|
||||
for (auto &file : *files) {
|
||||
for (auto &task : file.getTasks()) {
|
||||
if (tagsFilter.size() > 0 && !vectorUtils::containsAll(tagsFilter, task->getTags())) {
|
||||
continue;
|
||||
}
|
||||
tasksToShow.push_back(task.get());
|
||||
}
|
||||
}
|
||||
|
||||
void TasksView::addTagFilter(const std::string& tag) {
|
||||
tagsFilter.push_back(tag);
|
||||
update();
|
||||
}
|
||||
|
||||
void TasksView::removeTagFilter(const std::string& tag) {
|
||||
tagsFilter.erase(std::remove_if(tagsFilter.begin(), tagsFilter.end(), [&] (const auto& tagInFilter){
|
||||
return tag == tagInFilter;
|
||||
}));
|
||||
update();
|
||||
}
|
||||
|
||||
void TasksView::removeFilters() {
|
||||
tagsFilter.clear();
|
||||
update();
|
||||
}
|
||||
|
||||
const std::vector<std::string>& TasksView::getActiveTagsFilter() {
|
||||
return tagsFilter;
|
||||
}
|
||||
}
|
||||
|
||||
void TasksView::addTagFilter(const std::string &tag)
|
||||
{
|
||||
tagsFilter.push_back(tag);
|
||||
update();
|
||||
}
|
||||
|
||||
void TasksView::removeTagFilter(const std::string &tag)
|
||||
{
|
||||
tagsFilter.erase(std::remove_if(tagsFilter.begin(), tagsFilter.end(),
|
||||
[&](const auto &tagInFilter) { return tag == tagInFilter; }));
|
||||
update();
|
||||
}
|
||||
|
||||
void TasksView::removeFilters()
|
||||
{
|
||||
tagsFilter.clear();
|
||||
update();
|
||||
}
|
||||
|
||||
const std::vector<std::string> &TasksView::getActiveTagsFilter()
|
||||
{
|
||||
return tagsFilter;
|
||||
}
|
||||
} // namespace mirai
|
||||
|
|
|
@ -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
|
||||
|
@ -8,34 +8,32 @@
|
|||
#define MIRAI_TASKSVIEW_H
|
||||
#include "TasksFile.h"
|
||||
#include "using.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
class TasksView {
|
||||
class TasksView
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
TasksView(std::shared_ptr<std::vector<TasksFile>> files);
|
||||
|
||||
TasksView(std::shared_ptr<std::vector<TasksFile>> files);
|
||||
TaskItem &operator[](int index);
|
||||
|
||||
TaskItem& operator[](int index);
|
||||
size_t count() const;
|
||||
void update();
|
||||
void addTagFilter(const std::string &tag);
|
||||
void removeTagFilter(const std::string &tag);
|
||||
void removeFilters();
|
||||
const Tags &getActiveTagsFilter();
|
||||
|
||||
int count() const;
|
||||
void update();
|
||||
void addTagFilter(const std::string& tag);
|
||||
void removeTagFilter(const std::string& tag);
|
||||
void removeFilters();
|
||||
const Tags& getActiveTagsFilter();
|
||||
|
||||
private:
|
||||
|
||||
std::shared_ptr<std::vector<TasksFile>> files;
|
||||
std::vector<TaskItem*> tasksToShow;
|
||||
Tags tagsFilter;
|
||||
};
|
||||
}
|
||||
private:
|
||||
std::shared_ptr<std::vector<TasksFile>> files;
|
||||
std::vector<TaskItem *> tasksToShow;
|
||||
Tags tagsFilter;
|
||||
};
|
||||
} // namespace mirai
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
@ -8,122 +8,122 @@
|
|||
#include "TaskItem.h"
|
||||
#include "cpp-utils/vector.h"
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
TasksFile TodoMdFormat::readFile(const std::string& path) {
|
||||
std::ifstream file(path);
|
||||
if (!file.is_open()) {
|
||||
throw std::runtime_error("todo.txt file not found");
|
||||
}
|
||||
std::vector<TaskItem> taskItems;
|
||||
std::string line;
|
||||
TasksFile TodoMdFormat::readFile(const std::string &path)
|
||||
{
|
||||
std::ifstream file(path);
|
||||
if (!file.is_open()) {
|
||||
throw std::runtime_error("todo.txt file not found");
|
||||
}
|
||||
std::vector<TaskItem> taskItems;
|
||||
std::string line;
|
||||
|
||||
if (!std::getline(file, line) || line.substr(0, 2) != "# ") {
|
||||
std::cerr << "Couldn't find the task list name" << std::endl;
|
||||
}
|
||||
|
||||
std::string name = line.substr(2);
|
||||
std::string currentDate = "";
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
if (line.substr(0, 3) == "## ") {
|
||||
currentDate = line.substr(3);
|
||||
} else if (line.substr(0, 5) == "- [ ]" || line.substr(0, 5) == "- [X]") {
|
||||
TaskItem taskItem = StringToTask(line, currentDate);
|
||||
taskItem.setDate(currentDate);
|
||||
taskItems.push_back(taskItem);
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
TasksFile tasks({
|
||||
.name = name,
|
||||
.path = path,
|
||||
.tasks = taskItems
|
||||
});
|
||||
return tasks;
|
||||
if (!std::getline(file, line) || line.substr(0, 2) != "# ") {
|
||||
std::cerr << "Couldn't find the task list name" << std::endl;
|
||||
}
|
||||
|
||||
Tags TodoMdFormat::extractTagsFromMetadata(std::string metadata) {
|
||||
Tags tags;
|
||||
std::string name = line.substr(2);
|
||||
std::string currentDate = "";
|
||||
|
||||
std::regex regex("(#[a-zA-Z0-1]+)");
|
||||
std::smatch matches;
|
||||
|
||||
while (std::regex_search(metadata, matches, regex))
|
||||
{
|
||||
if (!vectorUtils::contains(tags, matches[0].str())) {
|
||||
tags.push_back(matches[0]);
|
||||
}
|
||||
metadata = matches.suffix();
|
||||
while (std::getline(file, line)) {
|
||||
if (line.substr(0, 3) == "## ") {
|
||||
currentDate = line.substr(3);
|
||||
} else if (line.substr(0, 5) == "- [ ]" || line.substr(0, 5) == "- [X]") {
|
||||
TaskItem taskItem = StringToTask(line, currentDate);
|
||||
taskItem.setDate(currentDate);
|
||||
taskItems.push_back(taskItem);
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
void TodoMdFormat::writeFile(TasksFile& tasks) {
|
||||
std::ofstream file(tasks.getPath());
|
||||
if (!file.is_open()) {
|
||||
throw std::runtime_error("can't create todo.txt");
|
||||
}
|
||||
std::string currentDate = "";
|
||||
|
||||
file << "# " << tasks.getName() << "\n";
|
||||
for (const auto& task : tasks.getTasks()) {
|
||||
if (currentDate != task->date) {
|
||||
currentDate = task->date;
|
||||
file << "\n## " << (task->date != "" ? task->date : "No date") << "\n\n";
|
||||
}
|
||||
file << TaskToString(*task) << '\n';
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
std::string TodoMdFormat::fieldWithSpace(const std::string& field) {
|
||||
if (field.length() == 0)
|
||||
return "";
|
||||
return (field + " ");
|
||||
}
|
||||
|
||||
TaskItem TodoMdFormat::StringToTask(const std::string& str, const std::string& date) {
|
||||
std::smatch matches;
|
||||
std::regex regex("- \\[(\\s|X)\\] (([0-9]{2}:[0-9]{2})-([0-9]{2}:[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::cout << "M 7 " << matches[7] << std::endl;*/
|
||||
|
||||
std::string text = stringUtils::trim(matches[5]);
|
||||
|
||||
TaskItem taskItem = {
|
||||
.text = text,
|
||||
.state = str.substr(0, 5) == "- [X]" ? DONE : TODO,
|
||||
.date = date,
|
||||
.startTime = matches[3],
|
||||
.endTime = matches[4],
|
||||
.tags = extractTagsFromMetadata(matches[7])
|
||||
};
|
||||
return taskItem;
|
||||
}
|
||||
|
||||
std::string TodoMdFormat::TaskToString(const TaskItem& task) {
|
||||
std::string str = task.getText();
|
||||
if (task.getTags().size() > 0) {
|
||||
str += " --";
|
||||
for (const std::string& tag : task.getTags()) {
|
||||
str += " " + tag;
|
||||
}
|
||||
}
|
||||
if (task.getStartTime() != "" && task.getEndTime() != "") {
|
||||
str = task.getStartTime() + "-" + task.getEndTime() + " > " + str;
|
||||
}
|
||||
str = (task.getState() == DONE ? "- [X] " : "- [ ] ") + str;
|
||||
return str;
|
||||
}
|
||||
file.close();
|
||||
TasksFile tasks({.name = name, .path = path, .tasks = taskItems});
|
||||
return tasks;
|
||||
}
|
||||
|
||||
Tags TodoMdFormat::extractTagsFromMetadata(std::string metadata)
|
||||
{
|
||||
Tags tags;
|
||||
|
||||
std::regex regex("(#[a-zA-Z0-1]+)");
|
||||
std::smatch matches;
|
||||
|
||||
while (std::regex_search(metadata, matches, regex)) {
|
||||
if (!vectorUtils::contains(tags, matches[0].str())) {
|
||||
tags.push_back(matches[0]);
|
||||
}
|
||||
metadata = matches.suffix();
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
void TodoMdFormat::writeFile(TasksFile &tasks)
|
||||
{
|
||||
std::ofstream file(tasks.getPath());
|
||||
if (!file.is_open()) {
|
||||
throw std::runtime_error("can't create todo.txt");
|
||||
}
|
||||
std::string currentDate = "";
|
||||
|
||||
file << "# " << tasks.getName() << "\n";
|
||||
for (const auto &task : tasks.getTasks()) {
|
||||
if (currentDate != task->date) {
|
||||
currentDate = task->date;
|
||||
file << "\n## " << (task->date != "" ? task->date : "No date") << "\n\n";
|
||||
}
|
||||
file << TaskToString(*task) << '\n';
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
std::string TodoMdFormat::fieldWithSpace(const std::string &field)
|
||||
{
|
||||
if (field.length() == 0)
|
||||
return "";
|
||||
return (field + " ");
|
||||
}
|
||||
|
||||
TaskItem TodoMdFormat::StringToTask(const std::string &str, const std::string &date)
|
||||
{
|
||||
std::smatch matches;
|
||||
std::regex regex(
|
||||
"- \\[(\\s|X)\\] (([0-9]{2}:[0-9]{2})-([0-9]{2}:[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::cout << "M 7 " << matches[7] << std::endl;*/
|
||||
|
||||
std::string text = stringUtils::trim(matches[5]);
|
||||
|
||||
TaskItem taskItem = {.text = text,
|
||||
.state = str.substr(0, 5) == "- [X]" ? DONE : TODO,
|
||||
.date = date,
|
||||
.startTime = matches[3],
|
||||
.endTime = matches[4],
|
||||
.tags = extractTagsFromMetadata(matches[7])};
|
||||
return taskItem;
|
||||
}
|
||||
|
||||
std::string TodoMdFormat::TaskToString(const TaskItem &task)
|
||||
{
|
||||
std::string str = task.getText();
|
||||
if (task.getTags().size() > 0) {
|
||||
str += " --";
|
||||
for (const std::string &tag : task.getTags()) {
|
||||
str += " " + tag;
|
||||
}
|
||||
}
|
||||
if (task.getStartTime() != "" && task.getEndTime() != "") {
|
||||
str = task.getStartTime() + "-" + task.getEndTime() + " > " + str;
|
||||
}
|
||||
str = (task.getState() == DONE ? "- [X] " : "- [ ] ") + str;
|
||||
return str;
|
||||
}
|
||||
} // namespace mirai
|
||||
|
|
|
@ -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,23 +20,23 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mirai {
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
class TodoMdFormat {
|
||||
public:
|
||||
class TodoMdFormat
|
||||
{
|
||||
public:
|
||||
static TasksFile readFile(const std::string &path);
|
||||
static void writeFile(TasksFile &tasks);
|
||||
|
||||
static TasksFile readFile(const std::string& path);
|
||||
static void writeFile(TasksFile& tasks);
|
||||
static std::string TaskToString(const TaskItem &task);
|
||||
static TaskItem StringToTask(const std::string &str, const std::string &date);
|
||||
|
||||
static std::string TaskToString(const TaskItem& task);
|
||||
static TaskItem StringToTask(const std::string& str, const std::string& date);
|
||||
|
||||
private:
|
||||
|
||||
static std::string fieldWithSpace(const std::string& field);
|
||||
static TaskItem parseLine(const std::string& line);
|
||||
static Tags extractTagsFromMetadata(std::string metadata);
|
||||
};
|
||||
}
|
||||
private:
|
||||
static std::string fieldWithSpace(const std::string &field);
|
||||
static TaskItem parseLine(const std::string &line);
|
||||
static Tags extractTagsFromMetadata(std::string metadata);
|
||||
};
|
||||
} // namespace mirai
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -11,8 +11,9 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mirai {
|
||||
using Tags = std::vector<std::string>;
|
||||
namespace mirai
|
||||
{
|
||||
using Tags = std::vector<std::string>;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
@ -6,9 +6,11 @@
|
|||
|
||||
#include "utils.h"
|
||||
|
||||
namespace mirai {
|
||||
bool isDate(const std::string& dateStr) {
|
||||
std::regex regex("[0-9]{4}-[0-9]{2}-[0-9]{2}");
|
||||
return std::regex_match(dateStr, regex);
|
||||
}
|
||||
namespace mirai
|
||||
{
|
||||
bool isDate(const std::string &dateStr)
|
||||
{
|
||||
std::regex regex("[0-9]{4}-[0-9]{2}-[0-9]{2}");
|
||||
return std::regex_match(dateStr, regex);
|
||||
}
|
||||
} // namespace mirai
|
||||
|
|
|
@ -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
|
||||
|
@ -7,19 +7,19 @@
|
|||
#ifndef MIRAI_UTILS_H
|
||||
#define MIRAI_UTILS_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <locale>
|
||||
#include <regex>
|
||||
#include <cpp-utils/string.h>
|
||||
#include <cpp-utils/vector.h>
|
||||
#include <locale>
|
||||
#include <regex>
|
||||
|
||||
namespace mirai {
|
||||
namespace stringUtils = cpputils::string;
|
||||
namespace vectorUtils = cpputils::vector;
|
||||
|
||||
bool isDate(const std::string& dateStr);
|
||||
}
|
||||
namespace mirai
|
||||
{
|
||||
namespace stringUtils = cpputils::string;
|
||||
namespace vectorUtils = cpputils::vector;
|
||||
|
||||
bool isDate(const std::string &dateStr);
|
||||
} // namespace mirai
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue