117 lines
1.9 KiB
C
117 lines
1.9 KiB
C
/******************************************************************************
|
|
*
|
|
* Copyright (c) 2017-2019 by Löwenware Ltd
|
|
* Please, refer LICENSE file for legal information
|
|
*
|
|
******************************************************************************/
|
|
|
|
/**
|
|
* @file todo.h
|
|
* @author Ilja Kartašov <ik@lowenware.com>
|
|
* @brief ToDo.txt module
|
|
*
|
|
* @see https://lowenware.com/
|
|
*/
|
|
|
|
#ifndef TODO_H_FAD28DF0_DA05_4436_88E5_E3715DA254E8
|
|
#define TODO_H_FAD28DF0_DA05_4436_88E5_E3715DA254E8
|
|
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
#include <time.h>
|
|
#include <aisl/aisl.h>
|
|
#include <cStuff/list.h>
|
|
|
|
#define AX_TODO_ZERO_PRIORITY '_'
|
|
|
|
struct ax_todo {
|
|
uuid_t list_id;
|
|
const char *file;
|
|
char *swap;
|
|
/* todo: add file timestamp */
|
|
};
|
|
|
|
typedef struct ax_todo * AxTodo;
|
|
|
|
|
|
struct ax_todo_task {
|
|
uuid_t list_id;
|
|
uuid_t task_id;
|
|
time_t completed;
|
|
time_t created;
|
|
char *description;
|
|
bool is_done;
|
|
char priority;
|
|
};
|
|
|
|
typedef struct ax_todo_task * AxTodoTask;
|
|
|
|
|
|
struct ax_todo_project {
|
|
uuid_t project_id;
|
|
time_t last_completed;
|
|
char *name;
|
|
uint32_t ref_count;
|
|
};
|
|
|
|
typedef struct ax_todo_project * AxTodoProject;
|
|
|
|
|
|
struct ax_todo_tag {
|
|
uuid_t tag_id;
|
|
char *name;
|
|
uint32_t ref_count;
|
|
};
|
|
|
|
typedef struct ax_todo_tag * AxTodoTag;
|
|
|
|
AislStatus
|
|
ax_todo_init(AxTodo self, const char *file);
|
|
|
|
|
|
void
|
|
ax_todo_release(AxTodo self);
|
|
|
|
|
|
AislStatus
|
|
ax_todo_read(AxTodo self, CStuffList tasks, CStuffList projs, CStuffList tags);
|
|
|
|
|
|
AislStatus
|
|
ax_todo_write(AxTodo self, CStuffList list);
|
|
|
|
|
|
AxTodoTask
|
|
ax_todo_task_new(uuid_t list_id);
|
|
|
|
|
|
void
|
|
ax_todo_task_release(AxTodoTask task);
|
|
|
|
|
|
void
|
|
ax_todo_task_free(AxTodoTask task);
|
|
|
|
|
|
int
|
|
ax_todo__get_dt(char *buf, time_t *p_dt);
|
|
|
|
|
|
void
|
|
ax_todo__remove_line_break(char *description);
|
|
|
|
|
|
AislStatus
|
|
ax_todo_task_set(AxTodoTask task, char *buf, ssize_t length);
|
|
|
|
|
|
void
|
|
ax_todo_project_free(AxTodoProject project);
|
|
|
|
|
|
void
|
|
ax_todo_tag_free(AxTodoTag tag);
|
|
|
|
|
|
#endif /* !TODO_H */
|