-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAccounts.h
More file actions
111 lines (76 loc) · 2.14 KB
/
Accounts.h
File metadata and controls
111 lines (76 loc) · 2.14 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
107
108
109
110
111
//
// Created by tarek on 5/9/2024.
//
#ifndef CUSTOMIZED_NEWS_FEED_ALGORITHM_ACCOUNTS_H
#define CUSTOMIZED_NEWS_FEED_ALGORITHM_ACCOUNTS_H
#include <string>
#include <iostream>
#include "Article.h"
#include "MaxHeap.h"
#include <math.h>
using namespace std;
class Accounts {
protected:
string username;
string password;
public:
Accounts();
Accounts(string, string);
void setusername(string);
void setpassword(string);
string getusername();
string getpassword();
void addArticle(Article);
int addVideo(string, string, string, string);
};
class Admins : public Accounts{
private:
static customVector<Admins> admins;
public:
Admins();
Admins(string, string);
static customVector<Admins>& getAdmins();
static Admins findByUsername(string);
static bool registerNewUser(string, string);
bool removeUser(string);
static bool saveAdmins();
static bool loadAdmin();
};
struct prefrenceNode{
string category;
int count;
};
class Users : public Accounts{
private:
string prefrence;
static customVector<Users> users;
customVector<prefrenceNode> prefrenceVector;
MaxHeap heapOfPrefrences;
string seen;
customVector<string> seenVector;
public:
Users();
Users(string, string, string, string);
void setPrefrence(string);
string getPrefrence();
static customVector<Users>& getUsers();
static int findByUsername(string);
float calcScore(Article);
void loadPrefrenceVector();
void savePrefrenceVector();
void loadSeenVector();
void saveSeenVector();
static customVector<Article> filterByCategory(string cat);
static customVector<Article> filterByType(string typ);
static customVector<Article> filterByType(customVector<Article>, string);
void buildHeap(customVector<Article>& articles); //to be looked at
void likeArticle(string);
void notInterested(string);
void removeLikeArticle(string);
void removeNotInterested(string);
// to add mark as read
Article getArticle();
static bool saveUsers();
static bool loadUsers();
};
#endif //CUSTOMIZED_NEWS_FEED_ALGORITHM_ACCOUNTS_H