mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-04 02:33: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
Normal file
76
external/mirai-core/src/task.cpp
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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 "data_provider.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<class 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