New classes added
This commit is contained in:
parent
c1fa3cb404
commit
0c72b31953
4 changed files with 107 additions and 0 deletions
24
src/core/article.cpp
Normal file
24
src/core/article.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "article.h"
|
||||
|
||||
Article::Article() : Entity()
|
||||
{}
|
||||
|
||||
Article::Article(const std::shared_ptr<Seller> sellerPtr) : Entity()
|
||||
{
|
||||
this->sellerPtr = sellerPtr;
|
||||
}
|
||||
|
||||
void Article::setArticleNo(int articleNo)
|
||||
{
|
||||
this->articleNo = articleNo;
|
||||
}
|
||||
|
||||
void Article::setPrice(int price)
|
||||
{
|
||||
this->price = price;
|
||||
}
|
||||
|
||||
void Article::setDescription(const std::string& description)
|
||||
{
|
||||
this->description = description;
|
||||
}
|
27
src/core/article.h
Normal file
27
src/core/article.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef ARTICLE_H
|
||||
#define ARTICLE_H
|
||||
|
||||
#include "entity.h"
|
||||
#include "seller.h"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
class Seller;
|
||||
|
||||
class Article : public Entity
|
||||
{
|
||||
public:
|
||||
Article();
|
||||
Article(std::shared_ptr<Seller> sellerPtr);
|
||||
void setArticleNo(int articleNo);
|
||||
void setPrice(int price);
|
||||
void setDescription(const std::string& description);
|
||||
private:
|
||||
std::shared_ptr<Seller> sellerPtr{};
|
||||
int articleNo{};
|
||||
int price{};
|
||||
std::string description{};
|
||||
};
|
||||
|
||||
#endif
|
26
src/core/seller.cpp
Normal file
26
src/core/seller.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "seller.h"
|
||||
|
||||
void Seller::setSellerNo(int seller_no)
|
||||
{
|
||||
this->sellerNo = seller_no;
|
||||
}
|
||||
|
||||
void Seller::setFirstName(const std::string& firstName)
|
||||
{
|
||||
this->firstName = firstName;
|
||||
}
|
||||
|
||||
void Seller::setLastName(const std::string& lastName)
|
||||
{
|
||||
this->lastName = lastName;
|
||||
}
|
||||
|
||||
void Seller::setNumberOfOfferedArticles(int number)
|
||||
{
|
||||
numberOfOfferedArticles = number;
|
||||
}
|
||||
|
||||
size_t Seller::getNumberOfOfferedArticles()
|
||||
{
|
||||
return articles.size();
|
||||
}
|
30
src/core/seller.h
Normal file
30
src/core/seller.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef SELLER_H
|
||||
#define SELLER_H
|
||||
|
||||
#include "entity.h"
|
||||
#include "article.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Article;
|
||||
|
||||
class Seller : public Entity
|
||||
{
|
||||
public:
|
||||
void setSellerNo(int sellerNo);
|
||||
void setFirstName(const std::string& firstName);
|
||||
void setLastName(const std::string& lastName);
|
||||
void setNumberOfOfferedArticles(int number);
|
||||
|
||||
size_t getNumberOfOfferedArticles();
|
||||
|
||||
private:
|
||||
int sellerNo{};
|
||||
int numberOfOfferedArticles{};
|
||||
std::string firstName{};
|
||||
std::string lastName{};
|
||||
std::vector<Article> articles{};
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue