Add permanent meal function, add bistro plac

This commit is contained in:
zv0n 2020-09-16 11:20:06 +02:00
parent b390a57e2f
commit 2c46f2d64a
4 changed files with 26 additions and 7 deletions

View File

@ -3,12 +3,12 @@ CFLAGS ?= -O2 -Wall -Wextra `pkg-config libxml-2.0 --cflags` `pkg-config libxml+
PREFIX ?= /usr/local/bin
LDFLAGS ?= -lcurl -lrestbed `pkg-config libxml-2.0 --libs` `pkg-config libxml++-3.0 --libs`
PARSERS = udrevaka.o padagali.o lightofindia.o ukarla.o alcapone.o
PARSERS = udrevaka.o padagali.o lightofindia.o ukarla.o alcapone.o plac.o
.PHONY: default
default: menuprint
menuprint: main.o meal.o menu.o network.o $(PARSERS)
menuprint: main.o meal.o menu.o network.o restaurants.o $(PARSERS)
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS}
main.o: main.cpp restaurant.hpp menu.hpp meal.hpp restaurants/restaurants.hpp
@ -19,15 +19,19 @@ menu.o: menu.cpp menu.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
network.o: network/network.cpp network/network.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
udrevaka.o: restaurants/udrevaka.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
restaurants.o: restaurants/restaurants.cpp restaurants/restaurants.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
padagali.o: restaurants/padagali.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
udrevaka.o: restaurants/udrevaka.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
lightofindia.o: restaurants/lightofindia.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
padagali.o: restaurants/padagali.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
ukarla.o: restaurants/ukarla.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
lightofindia.o: restaurants/lightofindia.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
alcapone.o: restaurants/alcapone.cpp restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
ukarla.o: restaurants/ukarla.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
alcapone.o: restaurants/alcapone.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
plac.o: restaurants/plac.cpp restaurants.o restaurants/restaurants.hpp network/network.hpp htmlparser.hpp
$(CXX) $(CFLAGS) -c -o $@ $<
clean:

View File

@ -98,6 +98,7 @@ int main() {
restaurants["lightofindia"] = std::make_unique<LunchRest::LightOfIndiaRestaurant>();
restaurants["ukarla"] = std::make_unique<LunchRest::UKarlaRestaurant>();
restaurants["alcapone"] = std::make_unique<LunchRest::AlCaponeRestaurant>();
restaurants["plac"] = std::make_unique<LunchRest::PlacRestaurant>();
std::cout << "Initial parsing" << std::endl;
for(auto &restaurant : restaurants)
restaurant.second->parse();

View File

@ -42,6 +42,12 @@ public:
ss << "]}";
return ss.str();
}
void addPermanent(const Meal &meal) {
permanent.push_back(meal);
}
void addPermanent(bool isSoup, const std::string &name, const std::string &desc, int price) {
permanent.emplace_back(isSoup, name, desc, price);
}
protected:
std::string _url;
std::string _restaurant;

View File

@ -1,6 +1,8 @@
#include "../restaurant.hpp"
#include <libxml++/libxml++.h>
namespace LunchRest {
std::string nodeToText(xmlpp::Node *node);
class UDrevakaRestaurant : public Restaurant {
public:
UDrevakaRestaurant() : Restaurant("https://www.udrevaka.cz/denni-menu/", "U Dřeváka") {}
@ -31,5 +33,11 @@ public:
virtual ~AlCaponeRestaurant() = default;
virtual void parse() override;
};
class PlacRestaurant : public Restaurant {
public:
PlacRestaurant() : Restaurant("https://www.bistroplac.cz/poledni-nabidka/", "Bistro Plac") {}
virtual ~PlacRestaurant() = default;
virtual void parse() override;
};
} // end of namespace LunchRest