-
Notifications
You must be signed in to change notification settings - Fork 0
/
Control.h
90 lines (69 loc) · 1.88 KB
/
Control.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
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include "FansPage.h"
#include "Status.h"
#include "Friend.h"
#include <map>
#include "Exeption1.h"
using namespace std;
class Control
{
map< string, Friend*> mapOfFriends;
int numOfFriends = 0;
map< string, FansPage*> mapOfFansPage;
int numOfFanPage = 0;
public:
//constractor
Control();
//discractor
~Control();
//add fucntions
void addFriend( const string& name)noexcept(false)
{
if (mapOfFriends.find(name) != mapOfFriends.end())
{
eror1 ex( name);
throw ex;
}
numOfFriends++;
Friend*newFriend = new Friend(name);
string temp = name;
mapOfFriends.insert({ temp ,newFriend });
}
void addFansPage( const string& name)noexcept(false)
{
if (mapOfFansPage.find(name) != mapOfFansPage.end())
{
eror1 ex( name);
throw ex;
}
numOfFanPage++;
FansPage* newFansPage = new FansPage(name);
mapOfFansPage.insert({ name, newFansPage });
}
//print fucntions
void printFriendsWithIndex()const;
void printFriendsWithIndexWithoutspecificIndex(int index)const;
void printFansPagesWithIndex()const;
void printFriendsWithIndexWithouTheFriendsOfTheFansPage(FansPage* fansPage)const;//for function 8
void printFriendsWithIndexWithouTheFriendsOfTheFriend(Friend* friend1)const;
//small functions to make the code more readble
void addStatusToAFriend(const string&);
void addStatusToAFansPage(const string&);
void getFriendsName( string& name);
void getFansPageName( string& name);
//manu fanctions
void function1AddFriend();
void function2AddFansPage();
void function3AddStatus();
void function4AllStatus();
void function5TenStatus();
void function6Connection();
void function7Delete();
void function8AddFriendToFansPage();
void function9RemoveFriendFromFansPage();
void function10PrintAllObjects()const;
void function11PrintAllFriendsOfASpecificObject();
int menu();
};