7#ifndef __VISITOR_SHOP_H__
8#define __VISITOR_SHOP_H__
13#include "helpers/mapofstrings.h"
18 class Visitor_Village;
Base class that all shops must implement.
void PickupOrder(StringList items, StringList &itemsToBePickedUp)
Pick up the items sold by this shop (assumes the items were ordered already). Basically,...
void SetIngredientsForItems(const MapOfStrings &ingredients)
std::string Address()
Address of the shop (could be a structure but a simple string is sufficient for this example).
void SetAddress(std::string address)
bool DoesShopSellItem(std::string item)
Determine if this shop sells the specified item.
std::string StringizeList(StringList items)
Convert a string list to a comma-delimited string. Useful for displaying the list.
const MapOfStrings & IngredientsForItems()
Specifies the ingredients needed for each item sold by the shop. Also, the keys are what the shop sel...
Visitor_Village * village
MapOfStrings ingredientsForItems
bool PlaceOrder(StringList items)
Place an order for the specified items. If the inventory is empty, replenish the inventory by visitin...
std::map< std::string, int > Inventory
Inventory for this shop.
std::unique_ptr< Visitor_Shop > unique_ptr_t
Alias to make it easier to refer to a unique instance of this class.
virtual ~Visitor_Shop()
Virtual destructor.
void AddItemToInventory(std::string item)
Add the specified item to this shop's inventory.
Visitor_Shop()
Default Constructor.
void SetVillage(Visitor_Village *v)
Visitor_Village * Village()
The Village that contains this shop.
void SetName(std::string name)
std::string Name()
Name of the shop.
bool IsItemInStock(std::string item)
Determine if this shop has the specified item in stock.
virtual void Accept(Visitor *visitor)=0
The visitor will call this method on each element it wants to visit.
Represents a collection of shops that can be visited.
All visitors must implement this base class and then override one or more of the VisitXXX() methods,...
std::vector< std::string > StringList
Typedef for a vector of std::string.
The namespace containing all Design Pattern Examples implemented in C++.
Represents a list of structures that map strings to ConstStringList objects.