-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtasklist.h
40 lines (29 loc) · 992 Bytes
/
tasklist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef TASKLIST
#define TASKLIST
#include <stdio.h>
#include "task.h"
#include "dllist.h"
typedef struct tasklist {
// This trick allows all of dllist's methods to work on Tasklist. Hell yeah.
union {
struct dllist;
dllist list;
};
} tasklist;
/// Create a new tasklist.
// This function malloc's a tasklist from memory.
tasklist* tasklist_new();
/// Frees a tasklist from memory.
// This does NOT delete the tasks. See tasklist_destroy for that.
void tasklist_free(tasklist *list);
/// Destroys a tasklist with all the tasks.
void tasklist_destroy(tasklist *list);
/// Reads a todo.txt file and populates a tasklist with it
int tasklist_read(tasklist *list, FILE* file);
/// Dumps a tasklist to a file
int tasklist_dump(tasklist *list, FILE* file);
Task *tasklist_get(tasklist *list, int index);
Task *tasklist_remove(tasklist *list, int index);
tasklist* tasklist_search(tasklist *list, char *string);
int tasklist_display(tasklist *list);
#endif