Rework book example to support upload book photo.

This commit is contained in:
Chunting Gu
2019-09-05 10:53:39 +08:00
parent 4c413e245d
commit f1ad97b227
5 changed files with 271 additions and 163 deletions
+6 -1
View File
@@ -4,6 +4,8 @@
#include <list>
#include <string>
#include "boost/filesystem/path.hpp"
// In-memory test data.
// There should be some database in a real product.
@@ -11,6 +13,7 @@ struct Book {
std::string id;
std::string title;
double price;
boost::filesystem::path photo;
bool IsNull() const { return id.empty(); }
};
@@ -21,7 +24,9 @@ extern const Book kNullBook;
class BookStore {
public:
const std::list<Book>& books() const { return books_; }
const std::list<Book>& books() const {
return books_;
}
const Book& GetBook(const std::string& id) const;