-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.cpp
More file actions
96 lines (71 loc) · 2.26 KB
/
Copy pathcontact.cpp
File metadata and controls
96 lines (71 loc) · 2.26 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
#include "contact.h"
#include <iostream>
#include <string>
#include "memtrace.h"
//konstruktorok
Contact::Contact(): name(), p_num(""), w_num(""), address("") {};
Contact::Contact(const Name& name, const std::string& pnum, const std::string& wnum, const std::string& addr){
this->name = name;
this->p_num = pnum;
this->w_num = wnum;
this->address = addr;
};
//masolo konstruktor
Contact::Contact(const Contact& c){
this->name = c.getName();
this->p_num = c.getPNum();
this->w_num = c.getWNum();
this->address = c.getAddr();
}
//getterek
Name Contact::getName() const{
return this->name;
}
std::string Contact::getPNum() const{
return this->p_num;
}
std::string Contact::getWNum() const{
return this->w_num;
}
std::string Contact::getAddr() const{
return this->address;
}
//setterek
void Contact::setName(const Name& n) {
this->name=n;
}
void Contact::setPNum(const std::string& num){
this->p_num = num;
}
void Contact::setWNum(const std::string& num){
this->w_num = num;
}
void Contact::setAddr(const std::string& addr){
this->address = addr;
}
//egyenloseg operator
//@param rhs: ezzel teszi egyenlove a contactot
Contact Contact::operator=(const Contact& rhs){
this->name = rhs.getName();
this->p_num = rhs.getPNum();
this->w_num = rhs.getWNum();
this->address = rhs.getAddr();
return *this;
}
//igaz erteket ad, ha egy keresett szoveg megtalalhato a contact adatai kozott (akar reszben is)
//@param s: a keresett szoveg
bool Contact::is_in(const std::string& s){
if(this->name.is_in(s) || this->getPNum().find(s) <= this->getPNum().size() ||
this->getWNum().find(s) <= this->getWNum().size() || this->getAddr().find(s) <= this->getAddr().size())
return true;
return false;
}
//kiirato operator
//@param os: erre a kimenetre ir
//@param c: ezt a Contactot irja ki
std::ostream& operator<<(std::ostream& os, const Contact& c){
return os << c.getName().getTitle() << ";" << c.getName().getLastN() << ";" << c.getName().getFirstN() <<
";" << c.getName().getNickN() << ";" << c.getPNum() << ";" << c.getWNum() << ";" << c.getAddr() << ";";
}
//destruktor
Contact::~Contact(){};