aboutsummaryrefslogtreecommitdiff
path: root/Project1/Contacts.h
blob: a86f698cd041c24ab189bcf6a819bd2b67b665ce (plain) (blame)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef CONTACTS_HEADER_H
#define CONTACTS_HEADER_H



// functions

class contact
{
public:
	contact() = default;

	/*contact(const contact& copy);
	contact& operator=(const contact& rhs);

	contact(contact&& move);
	contact& operator=(contact&& rhs);*/

	int Get_index();
	void Set_index(int id);

	const char* Get_firstName();
	void Set_firstName(const char* firstName);

	const char* Get_lastName();
	void Set_lastName(const char* lastName);

	const char* Get_streetAddress();
	void Set_streetAddress(const char* streetAddress);

	const char* Get_city();
	void Set_city(const char* city);

	const char* Get_state();
	void Set_state(const char* state);

	int Get_zip();
	void Set_zip(int zip);

	const char* Get_email();
	void Set_email(const char* email);

	size_t Get_a();
	void Set_a(size_t a);

	size_t Get_id();
	void Set_id(size_t id);

	void print();

private:
	size_t _a = 0;
	// _a functions as delete bool. if a = 1, the slot is overwritten
	int _id;
	const char* _firstName{ };
	const char* _lastName{ };
	const char* _streetAddress{ };
	const char* _city{ };
	const char* _state{ };
	int _zip;
	const char* _email{ };

};

class contact_list
{
private:

	contact* contacts_{ nullptr };

	size_t length_{ 0 };

	size_t size_{ 0 };

public:

	void set_length(size_t MAX);
	size_t get_length();

	void set_size(size_t size);
	size_t get_size();

	void DeleteContact(contact newContact[], size_t MAX);

	void CopyList(const contact* contacts, const size_t& size);

	void AddContact(contact* newContact, size_t MAX, size_t& t);

	void update(contact newContact[], size_t MAX);

	void Print(contact newContact[], size_t& MAX);

	//size_t Size() const;
};

//struct contact_struct
//{
//    int a = 0;
//	size_t id = contact_list::get_length;
//    size_t count = 0;
//    char Name[30];
//    char Email[105];
//    char StreetAddress[45];
//    char City[35];
//    char State[4];
//    int Zip = 0;
//    contact() : a(true), id(0), count(0), Zip(0) {}
//};

//struct contact
//{
//    bool a = true;
//    size_t id = 0;
//    size_t count = 0;
//    char Name[25]{};
//    char Email[100]{};
//    char StreetAddress[35]{};
//    char City[30]{};
//    char State[3]{};
//    int Zip = 0;
//};
//contact newContact[11];

//int menu();
//
//char addNew(contact newContact[], size_t MAX, size_t& t);
//
//void update(contact newContact[], size_t MAX);
//
//void printAll(contact newContact[], size_t& MAX);
//
//contact contact_double(contact*& newContact, size_t& MAX, size_t t);
//
//size_t max_double(size_t MAX);
//
//void delete_contact(contact newContact[], size_t MAX);

#endif CONTACTS_HEADER_H