Compare commits
No commits in common. "96113653e7e34d14b09ea3f016194c29334f0050" and "c1fa3cb404874582f86fe7562e975cbabacc5094" have entirely different histories.
96113653e7
...
c1fa3cb404
7 changed files with 9 additions and 119 deletions
|
@ -3,16 +3,13 @@
|
|||
find_package(Boost 1.62 REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
|
||||
#set(CORE_HEADERS
|
||||
# entity.h
|
||||
# database.h
|
||||
#)
|
||||
|
||||
set(CORE_HEADERS
|
||||
entity.h
|
||||
database.h
|
||||
)
|
||||
set(CORE_SOURCES
|
||||
database.cpp
|
||||
entity.cpp
|
||||
seller.cpp
|
||||
article.cpp
|
||||
database.cpp
|
||||
)
|
||||
|
||||
add_library(core STATIC ${CORE_SOURCES})
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#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;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#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
|
|
@ -13,8 +13,8 @@ void Entity::createUuid()
|
|||
uuid = generator();
|
||||
}
|
||||
|
||||
void Entity::createUuidFromString(const std::string& uuidString)
|
||||
void Entity::createUuidFromString(const std::string& uuid_string)
|
||||
{
|
||||
boost::uuids::string_generator generator{};
|
||||
uuid = generator(uuidString);
|
||||
uuid = generator(uuid_string);
|
||||
}
|
|
@ -10,9 +10,9 @@ class Entity
|
|||
public:
|
||||
Entity();
|
||||
virtual ~Entity() = 0;
|
||||
const boost::uuids::uuid& getUuid() const { return uuid; };
|
||||
const boost::uuids::uuid& getUuid() { return uuid; };
|
||||
void createUuid();
|
||||
void createUuidFromString(const std::string& uuidString);
|
||||
void createUuidFromString(const std::string& uuid_string);
|
||||
|
||||
private:
|
||||
boost::uuids::uuid uuid{};
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#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();
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#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