diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-02-12 15:55:21 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-02-12 15:55:21 +0800 |
commit | 10eb95869601e145b1d8bc909424777c25752d51 (patch) | |
tree | 49449a4076ded9bd937a51679318edbe2a532cae /works/life/cpp-practicum/Book.hpp | |
parent | 29ba3e88b1a7425fe00af0005b8a8228103aa21c (diff) | |
parent | f8c10dd1fc55e60f35286475356e48c4f642eb63 (diff) | |
download | crupest-10eb95869601e145b1d8bc909424777c25752d51.tar.gz crupest-10eb95869601e145b1d8bc909424777c25752d51.tar.bz2 crupest-10eb95869601e145b1d8bc909424777c25752d51.zip |
import(life): IMPORT crupest/life COMPLETE.
Diffstat (limited to 'works/life/cpp-practicum/Book.hpp')
-rw-r--r-- | works/life/cpp-practicum/Book.hpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/works/life/cpp-practicum/Book.hpp b/works/life/cpp-practicum/Book.hpp new file mode 100644 index 0000000..250460f --- /dev/null +++ b/works/life/cpp-practicum/Book.hpp @@ -0,0 +1,51 @@ +#pragma once
+#include "Base.hpp"
+
+#include <QTextStream>
+#include <string>
+
+class Book final {
+public:
+ Book() = default;
+
+ Book(std::u16string isbn, std::u16string title, std::u16string type,
+ std::u16string author, std::u16string press, int stock_count)
+ : isbn_(std::move(isbn)), title_(std::move(title)),
+ type_(std::move(type)), author_(std::move(author)),
+ press_(std::move(press)), stock_count_(stock_count) {}
+
+ CRU_DEFAULT_COPY(Book)
+ CRU_DEFAULT_MOVE(Book)
+
+ ~Book() = default;
+
+public:
+ std::u16string GetIsbn() const { return isbn_; }
+ void SetIsbn(std::u16string isbn) { isbn_ = std::move(isbn); }
+
+ std::u16string GetTitle() const { return title_; }
+ void SetTitle(std::u16string title) { title_ = std::move(title); }
+
+ std::u16string GetType() const { return type_; }
+ void SetType(std::u16string type) { type_ = std::move(type); }
+
+ std::u16string GetAuthor() const { return author_; }
+ void SetAuthor(std::u16string author) { author_ = std::move(author); }
+
+ std::u16string GetPress() const { return press_; }
+ void SetPress(std::u16string press) { press_ = std::move(press); }
+
+ int GetStockCount() const { return stock_count_; }
+ void SetStockCount(int stock_count) { stock_count_ = stock_count; }
+
+private:
+ std::u16string isbn_;
+ std::u16string title_;
+ std::u16string type_;
+ std::u16string author_;
+ std::u16string press_;
+ int stock_count_ = 0;
+};
+
+QTextStream &operator>>(QTextStream &left, Book &right);
+QTextStream &operator<<(QTextStream &left, const Book &right);
|