You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
753 B
31 lines
753 B
#include "StorageEditor.h"
|
|
|
|
StorageEditor::StorageEditor() { }
|
|
|
|
StorageEditor::StorageEditor(std::shared_ptr<WarenStorage> storage) {
|
|
this->storage = storage;
|
|
}
|
|
|
|
std::shared_ptr<WarenStorage> StorageEditor::getWarenStorage() const {
|
|
return storage;
|
|
}
|
|
|
|
void StorageEditor::setWarenStorage(const WarenStorage storage) {
|
|
//move might be unnecessary here
|
|
this->storage = std::make_shared<WarenStorage>(std::move(storage));
|
|
}
|
|
|
|
|
|
void StorageEditor::addWaren(const Ware ware, int amount) {
|
|
for(auto i = 0; i < amount; i++) {
|
|
storage->addWareAndGenerateId(ware);
|
|
}
|
|
}
|
|
|
|
|
|
void StorageEditor::removeWaren(const std::string& name, const int amount) {
|
|
for(auto i = 0; i < amount; i++) {
|
|
storage->removeWare(name);
|
|
}
|
|
}
|
|
|