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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #include "StorageEditor.h"
  2. StorageEditor::StorageEditor() { }
  3. StorageEditor::StorageEditor(std::shared_ptr<WarenStorage> storage) {
  4. this->storage = storage;
  5. }
  6. std::shared_ptr<WarenStorage> StorageEditor::getWarenStorage() const {
  7. return storage;
  8. }
  9. void StorageEditor::setWarenStorage(const WarenStorage storage) {
  10. //move might be unnecessary here
  11. this->storage = std::make_shared<WarenStorage>(std::move(storage));
  12. }
  13. void StorageEditor::addWaren(const Ware ware, int amount) {
  14. for(auto i = 0; i < amount; i++) {
  15. storage->addWareAndGenerateId(ware);
  16. }
  17. }
  18. void StorageEditor::removeWaren(const std::string& name, const int amount) {
  19. for(auto i = 0; i < amount; i++) {
  20. storage->removeWare(name);
  21. }
  22. }