diff options
Diffstat (limited to 'include/book_store/book_count.hh')
| -rw-r--r-- | include/book_store/book_count.hh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/book_store/book_count.hh b/include/book_store/book_count.hh new file mode 100644 index 0000000..a9c68c1 --- /dev/null +++ b/include/book_store/book_count.hh @@ -0,0 +1,37 @@ +#ifndef BOOK_COUNT_HH +#define BOOK_COUNT_HH + +#include <ostream> +#include <string> + +namespace book_store::product { +class book_count { +public: + using book_count_type = std::size_t; + +private: + book_count_type _count; + +public: + book_count() = default; + book_count(book_count_type count) : _count(count) {} + + friend auto operator<<(std::ostream &output_stream, const book_count &price) + -> std::ostream & { + output_stream << price._count; + + return output_stream; + } + + friend auto operator==(const book_count &lhs, const book_count &rhs) -> bool { + return lhs._count == rhs._count; + } + + friend auto operator+(const book_count &lhs, const book_count &rhs) + -> book_count { + return {lhs._count + rhs._count}; + } +}; +} // namespace book_store::product + +#endif // BOOK_COUNT_HH |