blob: e80e6df722ccbb6b4256f96a413e4af6e2162e24 (
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
|
#include <cstddef>
#include <string>
#include <string_view>
#include <book_store/person.hh>
namespace book_store::consumer {
auto person::last_name() const noexcept -> std::string_view {
return this->_last_name;
}
auto person::first_name() const noexcept -> std::string_view {
return this->_first_name;
}
auto person::full_name(bool last_first) const noexcept -> std::string {
if (last_first) {
return this->_last_name + ", " + this->_first_name;
}
return this->_first_name + " " + this->_last_name;
}
auto person::id() const noexcept -> std::size_t { return this->_id; }
auto person::last_name(std::string_view last_name) noexcept -> person & {
this->_last_name = last_name;
return *this;
}
auto person::first_name(std::string_view first_name) noexcept -> person & {
this->_first_name = first_name;
return *this;
}
auto person::id(std::size_t person_id) noexcept -> person & {
this->_id = person_id;
return *this;
}
} // namespace book_store::consumer
|