This repository has been archived on 2022-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
patterns-old/lesson_4/NYPizzaStore.hpp

55 lines
1.4 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* NYPizzaStore.hpp
*
* Created on: 3 нояб. 2021 г.
* Author: alexander
*/
#pragma once
#include "PizzaStore.hpp"
#include "CheesePizza.hpp"
#include "PepperoniPizza.hpp"
#include "VeggiePizza.hpp"
#include "ClamPizza.hpp"
#include "StandardPizza.hpp"
#include "NYPizzaIngredientFactory.hpp"
class NYPizzaStore: public PizzaStore
{
public:
Pizza* createPizza(const std::string &type) const override
{
Pizza *pizza = NULL;
PizzaIngredientFactory *ingredientFactory = new NYPizzaIngredientFactory();
if (type == "cheese")
{
pizza = new CheesePizza(ingredientFactory);
pizza->setName("New York Style Cheese Pizza");
}
else if (type == "veggie")
{
pizza = new VeggiePizza(ingredientFactory);
pizza->setName("New York Style Veggie Pizza");
}
else if (type == "clam")
{
pizza = new ClamPizza(ingredientFactory);
pizza->setName("New York Style Clam Pizza");
}
else if (type == "pepperoni")
{
pizza = new PepperoniPizza(ingredientFactory);
pizza->setName("New York Style Pepperoni Pizza");
}
else
{
pizza = new StandardPizza(ingredientFactory);
pizza->setName("New York Style Standard Pizza");
}
return pizza;
}
};