-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha2_functions.h
More file actions
106 lines (81 loc) · 2.73 KB
/
a2_functions.h
File metadata and controls
106 lines (81 loc) · 2.73 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/********* functions.h ********
Student Name = Kalid Wehbe
Student Number = 101259994
*/
#ifndef __A2_FUNCTIONS_H__
#define __A2_FUNCTIONS_H__
#include "a2_nodes.h"
/********** DON'T MODIFY **********/
/*
Function that creates a new user and adds it to a sorted (ascending order) linked list at
the proper sorted location. Return the head of the list.
*/
user_t *add_user(user_t *users, const char *username, const char *password);
/*
Function that searches if the user is available in the database
Return a pointer to the user if found and NULL if not found.
*/
user_t *find_user(user_t *users, const char *username);
/*
Function that creates a new friend's node.
Return the newly created node.
*/
friend_t *create_friend(const char *username);
/*
Function that links a friend to a user. The friend's name should be added into
a sorted (ascending order) linked list.
*/
void add_friend(user_t *user, const char *friend);
/*
Function that removes a friend from a user's friend list.
Return true of the friend was deleted and false otherwise.
*/
_Bool delete_friend(user_t *user, char *friend_name);
/*
Function that creates a new user's post.
Return the newly created post.
*/
post_t *create_post(const char *text);
/*
Function that adds a post to a user's timeline. New posts should be added following
the stack convention (LIFO) (i.e., to the beginning of the Posts linked list).
*/
void add_post(user_t *user, const char *text);
/*
Function that removes a post from a user's list of posts.
Return true if the post was deleted and false otherwise.
*/
_Bool delete_post(user_t *user, int number);
/*
Function that displays a specific user's posts
*/
void display_user_posts(user_t *user);
/*
Function that displays a specific user's friends
*/
void display_user_friends(user_t *user);
/*
Function that displays all the posts of 2 users at a time from the database.
After displaying 2 users' posts, it prompts if you want to display
posts of the next 2 users.
If there are no more post or the user types “n” or “N”, the function returns.
*/
void display_all_posts(user_t *users);
/*
Fucntion that free all users from the database before quitting the application.
*/
void teardown(user_t *users);
/*
Function that prints the main menu with a list of options for the user to choose from
*/
void print_menu();
/*
******** DONT MODIFY THIS FUNCTION ********
Function that reads users from the text file.
IMPORTANT: This function shouldn't be modified and used as is
******** DONT MODIFY THIS FUNCTION ********
*/
user_t *read_CSV_and_create_users(FILE *file, int num_users);
/********** DON'T MODIFY **********/
// Extra functions' Prototypes/Declarations go here
#endif