diff --git a/src/core/article.cpp b/src/core/article.cpp index b56c413..3270da7 100644 --- a/src/core/article.cpp +++ b/src/core/article.cpp @@ -10,10 +10,8 @@ void Article::setPrice(int price) { price_ = price; } void Article::setDescription(const std::string& description) { description_ = description; } -void Article::setSale(std::shared_ptr salePtr) { salePtr_ = salePtr; } - -bool Article::isSold() { return salePtr_ ? true : false; } - std::string Article::getDescription() { return description_; } -Seller* Article::getSeller() { return sellerPtr_.get(); } \ No newline at end of file +void Article::setSale(std::shared_ptr salePtr) { salePtr_ = salePtr; } + +bool Article::isSold() { return salePtr_ ? true : false; } \ No newline at end of file diff --git a/src/core/article.h b/src/core/article.h index 4042924..1d0487b 100644 --- a/src/core/article.h +++ b/src/core/article.h @@ -18,13 +18,11 @@ class Article : public Entity void setArticleNo(int articleNo); void setPrice(int price); void setDescription(const std::string& description); + std::string getDescription(); bool isSold(); void setSale(std::shared_ptr salePtr); void setSeller(std::shared_ptr sellerPtr); - std::string getDescription(); - Seller* getSeller(); - private: std::shared_ptr sellerPtr_{}; std::shared_ptr salePtr_{}; diff --git a/src/core/seller.cpp b/src/core/seller.cpp index 94d3a0d..5e7edae 100644 --- a/src/core/seller.cpp +++ b/src/core/seller.cpp @@ -30,17 +30,15 @@ std::string Seller::getLastName() const { return lastName_; } int Seller::getSellerNo() const { return sellerNo_; } -std::vector Seller::getArticles(bool onlySold) const +std::vector> Seller::getArticles(bool onlySold) { - std::vector articles; + std::vector> articles; for (const auto article : articles_) { if (onlySold && article->isSold()) { - articles.push_back(article.get()); + articles.push_back(article); } else if (!onlySold) { - articles.push_back(article.get()); + articles.push_back(article); } } return articles; -} - -size_t Seller::soldArticles() const { return getArticles(true).size(); } \ No newline at end of file +} \ No newline at end of file diff --git a/src/core/seller.h b/src/core/seller.h index a713292..63aebb2 100644 --- a/src/core/seller.h +++ b/src/core/seller.h @@ -27,8 +27,7 @@ class Seller : public Entity std::string getLastName() const; int getSellerNo() const; int getNumberOfOfferedArticles() const; - size_t soldArticles() const; - std::vector getArticles(bool onlySold = false) const; + std::vector> getArticles(bool onlySold = false); private: int sellerNo_{-1};