todo-cli
Loading...
Searching...
No Matches
todo::Model Class Reference

#include <model.h>

Public Member Functions

 Model ()=default
 ~Model ()=default
void dir_init ()
 Sets up the .todo directory and its contents.
void add (Task &task, const std::vector< u64 > &path)
 Adds task with description to todo list.
void remove (const std::vector< u64 > &path)
 Remove task from the todo list.
void clear ()
 Clears (empties) the list.
void load_file ()
 Load from a JSON file to populate todo list vector.
void save_file ()
 Save todo list vector to a JSON file.
void change_task_desc (const std::vector< u64 > &path, const std::string &desc)
 Changes the completion status of a task.
void change_task_status (const std::vector< u64 > &path, const Status status)
 Changes the completion status of a task.
void change_task_priority (const std::vector< u64 > &path, const u16 priority)
 Changes the completion status of a task.
const std::vector< Task > & get_list ()
 Returns a const reference of the todo list vector.
const Taskget_task (const std::vector< u64 > &path)
 Finds task via path.
const Taskget_parent_task (const std::vector< u64 > &path)
 Finds parent of task via path.

Constructor & Destructor Documentation

◆ Model()

todo::Model::Model ( )
default

◆ ~Model()

todo::Model::~Model ( )
default

Member Function Documentation

◆ add()

void todo::Model::add ( Task & task,
const std::vector< u64 > & path )

Adds task with description to todo list.

Parameters
taskA reference to the task to add.
pathPath of task to add.

◆ change_task_desc()

void todo::Model::change_task_desc ( const std::vector< u64 > & path,
const std::string & desc )

Changes the completion status of a task.

Parameters
pathPath of the task to change.
descDescription(str) to change to.

◆ change_task_priority()

void todo::Model::change_task_priority ( const std::vector< u64 > & path,
const u16 priority )

Changes the completion status of a task.

Parameters
pathPath of the task to change.
prioPriority to change to.

◆ change_task_status()

void todo::Model::change_task_status ( const std::vector< u64 > & path,
const Status status )

Changes the completion status of a task.

Parameters
pathPath of the task to change.
statusStatus to change to.

◆ clear()

void todo::Model::clear ( )

Clears (empties) the list.

◆ dir_init()

void todo::Model::dir_init ( )

Sets up the .todo directory and its contents.

◆ get_list()

const std::vector< Task > & todo::Model::get_list ( )

Returns a const reference of the todo list vector.

◆ get_parent_task()

const Task * todo::Model::get_parent_task ( const std::vector< u64 > & path)

Finds parent of task via path.

Parameters
pathPath to the task.

◆ get_task()

const Task * todo::Model::get_task ( const std::vector< u64 > & path)

Finds task via path.

Parameters
pathPath to the task.

◆ load_file()

void todo::Model::load_file ( )

Load from a JSON file to populate todo list vector.

Note
Uses boost.JSON to parse file.

◆ remove()

void todo::Model::remove ( const std::vector< u64 > & path)

Remove task from the todo list.

Parameters
pathPath of the task to remove.

◆ save_file()

void todo::Model::save_file ( )

Save todo list vector to a JSON file.

Note
Uses boost.JSON to serialize data.

The documentation for this class was generated from the following files: