mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-04 10:43:19 +00:00
Convert classes and files to snake_case
This commit is contained in:
parent
686d86df6f
commit
6fa94b279c
26 changed files with 272 additions and 301 deletions
76
external/mirai-core/src/Task.cpp
vendored
76
external/mirai-core/src/Task.cpp
vendored
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* 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 "Task.h"
|
||||
#include "DataProvider.h"
|
||||
#include "utils.h"
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
int Task::id() const
|
||||
{
|
||||
return task_.id;
|
||||
}
|
||||
|
||||
int Task::source_id() const
|
||||
{
|
||||
return data_->id;
|
||||
}
|
||||
|
||||
std::string Task::title() const
|
||||
{
|
||||
return task_.title;
|
||||
}
|
||||
|
||||
mirai::task_state Task::state() const
|
||||
{
|
||||
return task_.state;
|
||||
}
|
||||
|
||||
bool Task::checked() const
|
||||
{
|
||||
return task_.state == mirai::DONE;
|
||||
}
|
||||
|
||||
bool Task::has_due_date() const
|
||||
{
|
||||
return task_.due_date.has_value();
|
||||
}
|
||||
|
||||
std::optional<Date> Task::due_date() const
|
||||
{
|
||||
if (!task_.due_date.has_value()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return task_.due_date.value();
|
||||
}
|
||||
|
||||
void Task::set_title(const std::string &newTitle)
|
||||
{
|
||||
data_->update_task(id(), {.title = newTitle});
|
||||
}
|
||||
|
||||
void Task::set_date(const Date &date)
|
||||
{
|
||||
auto emptyEventId = std::optional<std::optional<int>>(std::optional<int>(std::nullopt));
|
||||
data_->update_task(id(), {.due_date = date});
|
||||
}
|
||||
|
||||
void Task::unschedule()
|
||||
{
|
||||
auto emptyId = std::optional<std::optional<int>>(std::optional<int>(std::nullopt));
|
||||
data_->update_task(id(), {.due_date = std::nullopt});
|
||||
}
|
||||
|
||||
void Task::set_checked(bool checked)
|
||||
{
|
||||
data_->update_task(id(), {.state = checked ? DONE : TODO});
|
||||
}
|
||||
|
||||
} // namespace mirai
|
Loading…
Add table
Add a link
Reference in a new issue