aisl-sdk/components/todo.h

117 lines
1.9 KiB
C
Raw Normal View History

2019-06-24 07:42:56 +02:00
/******************************************************************************
*
* 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 '_'
2019-06-24 07:42:56 +02:00
struct ax_todo {
uuid_t list_id;
const char *file;
char *swap;
/* todo: add file timestamp */
2019-06-24 07:42:56 +02:00
};
typedef struct ax_todo * AxTodo;
struct ax_todo_task {
uuid_t list_id;
2019-06-24 07:42:56 +02:00
uuid_t task_id;
time_t completed;
time_t created;
2019-06-24 07:42:56 +02:00
char *description;
bool is_done;
char priority;
2019-06-24 07:42:56 +02:00
};
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;
2019-06-24 07:42:56 +02:00
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);
2019-06-24 07:42:56 +02:00
AislStatus
ax_todo_write(AxTodo self, CStuffList list);
2019-06-24 07:42:56 +02:00
AxTodoTask
ax_todo_task_new(uuid_t list_id);
2019-06-24 07:42:56 +02:00
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);
2019-06-24 07:42:56 +02:00
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);
2019-06-24 07:42:56 +02:00
#endif /* !TODO_H */