aboutsummaryrefslogtreecommitdiff
path: root/My structures/Contact.hpp
blob: 0877b1aadfa2b18ed6c5bc5dc18b4533edc821cb (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
#ifndef CONTACT_HPP
#define CONTACT_HPP

#include <iostream>
using namespace std;

namespace myStructures
{
    template <class C>
    class contact
    {
	public:
		// constructors and destructors.
		contact() = default;

		~contact() = default;

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


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


		//getters and setters

		string Get_firstName();
		void Set_firstName(string firstName);

		string Get_lastName();
		void Set_lastName(string lastName);

		string Get_streetAddress();
		void Set_streetAddress(string streetAddress);

		string Get_city();
		void Set_city(string city);

		string Get_state();
		void Set_state(string state);

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

		string Get_email();
		void Set_email(string 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;
		string _firstName;
		string _lastName;
		string _streetAddress;
		string _city;
		string _state;
		int _zip;
		string _email;

    };






	template <class CList>
    class ContactList
    {
    public:
        ContactList() = default;
        ContactList(size_t size); //Creates contact list of this size
        ContactList(const CList* contacts, const size_t& length); //Makes a copy of another contact list
        ~ContactList();

        ContactList(const ContactList& copy); //deep copy constructor
        ContactList& operator=(const ContactList& rhs); //deep copy assignment

        ContactList(ContactList&& move); //reference(move) constructor
        ContactList& operator=(ContactList&& rhs); //reference(move) assignment

    private:
        CList* contacts_{ nullptr };
        size_t length_{ 0 };
        size_t size_{ 0 };

        CList* AllocateContactList(const size_t& size);
    };
}





#endif CONTACT_HPP