diff options
author | rtk0c <[email protected]> | 2021-03-30 19:40:11 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-03-30 19:40:11 -0700 |
commit | 31950890c939862f79c817053c106bf711c63a64 (patch) | |
tree | 4e02abf37d69ab7d4f988f143b340cfd3d93331c /core/src/Model/Items.cpp | |
parent | e75e26da92424528e190a2111acfcc49c657e894 (diff) |
Product items and misc stuff
Diffstat (limited to 'core/src/Model/Items.cpp')
-rw-r--r-- | core/src/Model/Items.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/core/src/Model/Items.cpp b/core/src/Model/Items.cpp new file mode 100644 index 0000000..db2d39f --- /dev/null +++ b/core/src/Model/Items.cpp @@ -0,0 +1,83 @@ +#include "Items.hpp" + +#include <limits> +#include <utility> + +ItemBase::ItemBase() + : mId{ std::numeric_limits<size_t>::max() } { +} + +ItemBase::ItemBase(size_t id) + : mId{ id } { +} + +bool ItemBase::IsInvalid() const { + return mId == std::numeric_limits<size_t>::max(); +} + +size_t ItemBase::GetId() const { + return mId; +} + +ProductItem::ProductItem(size_t id, std::string name) + : ItemBase(id) + , mName{ std::move(name) } { +} + +const std::string& ProductItem::GetName() const { + return mName; +} + +void ProductItem::SetName(std::string name) { + mName = std::move(name); +} + +const std::string& ProductItem::GetDescription() const { + return mDescription; +} + +void ProductItem::SetDescription(std::string description) { + mDescription = std::move(description); +} + +FactoryItem::FactoryItem(size_t id, std::string name) + : ItemBase(id) + , mName{ std::move(name) } { +} + +const std::string& FactoryItem::GetName() const { + return mName; +} + +void FactoryItem::SetName(std::string name) { + mName = std::move(name); +} + +const std::string& FactoryItem::GetDescription() const { + return mDescription; +} + +void FactoryItem::SetDescription(std::string description) { + mDescription = std::move(description); +} + +CustomerItem::CustomerItem(size_t id, std::string name) + : ItemBase(id) + , mName{ std::move(name) } { +} + +const std::string& CustomerItem::GetName() const { + return mName; +} + +void CustomerItem::SetName(std::string name) { + mName = std::move(name); +} + +const std::string& CustomerItem::GetDescription() const { + return mDescription; +} + +void CustomerItem::SetDescription(std::string description) { + mDescription = std::move(description); +} |