summaryrefslogtreecommitdiff
path: root/include/book_store/person.hh
blob: 729001a623db3cc4cc67b797f3696eb31f3689b5 (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
#ifndef PERSON_HH
#define PERSON_HH

#include <string>

namespace book_store::consumer {
class person {
private:
  std::string _first_name;
  std::string _last_name;
  std::size_t _id;

public:
  person(std::string first_name, std::string last_name, std::size_t person_id)
      : _first_name(std::move(first_name)), _last_name(std::move(last_name)),
        _id(person_id) {}
  person() = default;
  person(const person &) = default;
  person(person &&) = default;

  [[nodiscard]] auto first_name() const noexcept -> std::string_view;
  [[nodiscard]] auto last_name() const noexcept -> std::string_view;
  [[nodiscard]] auto
  full_name(bool last_first = false) const noexcept -> std::string;
  [[nodiscard]] auto id() const noexcept -> std::size_t;

  auto first_name(std::string_view first_name) noexcept -> person &;
  auto last_name(std::string_view last_name) noexcept -> person &;
  auto id(std::size_t person_id) noexcept -> person &;

  auto operator=(const person &) -> person & = default;
  auto operator=(person &&) -> person & = default;
};
} // namespace book_store::consumer

#endif // PERSON_HH