some getters added

This commit is contained in:
Martin Brodbeck 2018-07-11 15:59:38 +02:00
parent 4fdbc268a5
commit b2650fad26
2 changed files with 13 additions and 6 deletions

View file

@ -12,7 +12,7 @@ Seller::Seller(const std::string& firstName, const std::string& lastName, int se
numberOfOfferedArticles_ = numberOfArticles; numberOfOfferedArticles_ = numberOfArticles;
} }
inline void Seller::setSellerNo(int seller_no) { sellerNo_ = seller_no; } void Seller::setSellerNo(int seller_no) { sellerNo_ = seller_no; }
inline void Seller::setFirstName(const std::string& firstName) { firstName_ = firstName; } inline void Seller::setFirstName(const std::string& firstName) { firstName_ = firstName; }
@ -20,11 +20,15 @@ inline void Seller::setLastName(const std::string& lastName) { lastName_ = lastN
inline void Seller::setNumberOfOfferedArticles(int number) { numberOfOfferedArticles_ = number; } inline void Seller::setNumberOfOfferedArticles(int number) { numberOfOfferedArticles_ = number; }
inline size_t Seller::getNumberOfOfferedArticles() { return articles_.size(); } int Seller::getNumberOfOfferedArticles() const { return static_cast<int>(articles_.size()); }
void Seller::addArticle(Article article) { void Seller::addArticle(Article article) { articles_.push_back(article); }
articles_.push_back(article);
} std::string Seller::getFirstName() const { return firstName_; }
std::string Seller::getLastName() const { return lastName_; }
int Seller::getSellerNo() const { return sellerNo_; }
std::vector<Article*> Seller::getArticles(bool onlySold) std::vector<Article*> Seller::getArticles(bool onlySold)
{ {

View file

@ -22,8 +22,11 @@ class Seller : public Entity
void setNumberOfOfferedArticles(int number); void setNumberOfOfferedArticles(int number);
void addArticle(Article article); void addArticle(Article article);
std::string getFirstName() const;
std::string getLastName() const;
int getSellerNo() const;
int getNumberOfOfferedArticles() const;
std::vector<Article*> getArticles(bool onlySold = false); std::vector<Article*> getArticles(bool onlySold = false);
size_t getNumberOfOfferedArticles();
private: private:
int sellerNo_{-1}; int sellerNo_{-1};