-
Notifications
You must be signed in to change notification settings - Fork 0
/
structures.h
108 lines (97 loc) · 2.05 KB
/
structures.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
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
107
108
#ifndef _STRUCTURES_INCULDED_
#define _STRUCTURES_INCULDED_
// Size of title and comment
#define MAX_SIZE_TITLE 100
#define MAX_SIZE_CONTENT 1000
#define MAX_SIZE_DESCRIPTION 10000
#define MAX_NUMBER_OF_POSTS 10000
#define MAX_NUMBER_OF_COMMENTS 100000
#define MAX_NUMBER_OF_USERS 100000
#define MAX_DISPLAY_SIZE 1000000
#define MAX_NOC 200
#define ARROW printf(" \xAF ");
#define UPVOTE_ARROW printf(" \x1E ");
#define DOWNVOTE_ARROW printf(" \x1F ");
#define D 2
// Structure for user
struct user
{
int id;
char username[18];
char name[25];
int karma;
int followers;
int date_of_joining;
char email[64];
};
typedef struct user USER;
// Structure for holding users
struct user_holder
{
struct user *user_content;
struct user_holder *next;
};
typedef struct user_holder USER_HOLDER;
struct comment
{
int id;
int user_id;
int upvotes;
int downvotes;
unsigned long long dt;
char username[18];
char content[MAX_SIZE_CONTENT];
struct comment *next;
struct comment *child;
};
typedef struct comment COMMENT;
struct post
{
int id;
int user_id;
int upvotes;
int downvotes;
unsigned long long dt;
char username[18];
char community_name[25];
char title[MAX_SIZE_TITLE];
char content[MAX_SIZE_CONTENT];
struct post *next;
struct comment *child;
};
typedef struct post POST;
struct community
{
int id;
int dt_created;
int members;
char name[25];
char desc[MAX_SIZE_DESCRIPTION];
struct post *posts;
};
typedef struct community COMMUNITY;
struct community_holder
{
struct community *user_content;
struct community_holder *next;
};
typedef struct community_holder COMMUNITY_HOLDER;
struct user_result
{
struct user *user_h;
int occurences;
};
typedef struct user_result USER_RESULT;
struct commmunity_result
{
struct community_holder **community_h;
int occurences;
};
typedef struct commmunity_result COMMUNITY_RESULT;
struct post_result
{
struct post *post_h;
int occurences;
};
typedef struct post_result POST_RESULT;
#endif