parallax 1.0
command-line based task/todo manager
|
Contains structures and functions for handling task-related operations. More...
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
Go to the source code of this file.
Classes | |
struct | Task |
A basic task. More... | |
struct | TaskClass |
A task class containing other tasks. More... | |
struct | TaskCollection |
A task collection containing other classes. More... |
Macros | |
#define | MAX_TABLE_SIZE 50 |
Typedefs | |
typedef struct Task | Task |
A basic task. | |
typedef struct TaskClass | TaskClass |
A task class containing other tasks. | |
typedef struct TaskCollection | TaskCollection |
A task collection containing other classes. |
Functions | |
Task * | create_task (char *class_of_task, char *task_content) |
Creates a task of known class and content. | |
TaskClass * | create_task_class (char *class_of_task, size_t class_size) |
Creates a task class of a known class and size. | |
TaskCollection * | create_task_collection (size_t collection_size) |
Creates a task collection of known size. | |
Task * | get_task (TaskClass *task_class, const char *key) |
Finds a task in a task class by its content. | |
void | add_task (TaskClass *task_class, Task *new_task) |
Adds a task to a task class. | |
TaskClass * | get_task_class (TaskCollection *task_collection, const char *key) |
Gets a task class by its class name from a task collection. | |
void | add_task_class (TaskCollection *task_collection, TaskClass *task_class) |
Adds a task class to a task collection. | |
void | remove_task (TaskClass *task_class, char *task_content) |
Removes a task from a task class by its content. | |
void | remove_task_class (TaskCollection *task_collection, char *class_name) |
Removes a task class from a task collection. | |
void | print_task (Task *task) |
Prints the content of a task. |
Contains structures and functions for handling task-related operations.
Defines the schema of tasks, task classes, and task collections. It also contains the procedures for creating, modifying, removing, and destroying the task structures.
Definition in file task.h.
typedef struct Task Task |
A basic task.
Contains two strings, which are the class and the content.
typedef struct TaskClass TaskClass |
A task class containing other tasks.
Synonymous to a subject or category that the task belongs to.
typedef struct TaskCollection TaskCollection |
A task collection containing other classes.
Serves as a lookup table for the existing classes in the serverside
Adds a task to a task class.
task_class | Pointer to the task class that will contain the new task |
new_task | Pointer to the task to be added |
Definition at line 74 of file task.c.
void add_task_class | ( | TaskCollection * | task_collection, |
TaskClass * | task_class ) |
Adds a task class to a task collection.
task_collection | Pointer to the task collection that will contain the new task |
task_class | Pointer to the task class to be added |
Definition at line 123 of file task.c.
Task * create_task | ( | char * | class_of_task, |
char * | task_content ) |
Creates a task of known class and content.
class_of_task | Pointer to the class string of the task |
task_content | Pointer to the content string of the task |
TaskClass * create_task_class | ( | char * | class_of_task, |
size_t | class_size ) |
Creates a task class of a known class and size.
class_of_task | Pointer to the class string of the task class |
class_size | Size of the task class hash table |
Definition at line 24 of file task.c.
TaskCollection * create_task_collection | ( | size_t | collection_size | ) |
Creates a task collection of known size.
collection_size | Size of the task collection hash table |
Finds a task in a task class by its content.
task_class | Pointer to the task class to look into |
key | Pointer to the key string (task content) |
Casts the output of hashmap_get to a Task* type
Definition at line 47 of file task.c.
TaskClass * get_task_class | ( | TaskCollection * | task_collection, |
const char * | key ) |
Gets a task class by its class name from a task collection.
task_collection | Pointer to the task collection containing the task class to be found |
key | Pointer to the key string (task class name) |
Casts the output of hashmap_get to a TaskClass* type
Definition at line 98 of file task.c.
void print_task | ( | Task * | task | ) |
void remove_task | ( | TaskClass * | task_class, |
char * | task_content ) |
Removes a task from a task class by its content.
task_class | Pointer to the task class that contains the task to be removed |
task_content | Pointer to the content string of the task to be removed |
Definition at line 140 of file task.c.
void remove_task_class | ( | TaskCollection * | task_collection, |
char * | class_name ) |
Removes a task class from a task collection.
task_collection | Pointer to the task collection that contains the task class to be removed |
class_name | Pointer to the class name string of the task class to be removed |
Definition at line 156 of file task.c.