Add permanent meal function, add bistro plac
This commit is contained in:
parent
b390a57e2f
commit
2c46f2d64a
18
Makefile
18
Makefile
@ -3,12 +3,12 @@ CFLAGS ?= -O2 -Wall -Wextra `pkg-config libxml-2.0 --cflags` `pkg-config libxml+
|
|||||||
PREFIX ?= /usr/local/bin
|
PREFIX ?= /usr/local/bin
|
||||||
LDFLAGS ?= -lcurl -lrestbed `pkg-config libxml-2.0 --libs` `pkg-config libxml++-3.0 --libs`
|
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
|
.PHONY: default
|
||||||
default: menuprint
|
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}
|
$(CXX) $(CFLAGS) -o $@ $^ ${LDFLAGS}
|
||||||
|
|
||||||
main.o: main.cpp restaurant.hpp menu.hpp meal.hpp restaurants/restaurants.hpp
|
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 $@ $<
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||||
network.o: network/network.cpp network/network.hpp
|
network.o: network/network.cpp network/network.hpp
|
||||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
$(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 $@ $<
|
$(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 $@ $<
|
$(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 $@ $<
|
$(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 $@ $<
|
$(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 $@ $<
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
1
main.cpp
1
main.cpp
@ -98,6 +98,7 @@ int main() {
|
|||||||
restaurants["lightofindia"] = std::make_unique<LunchRest::LightOfIndiaRestaurant>();
|
restaurants["lightofindia"] = std::make_unique<LunchRest::LightOfIndiaRestaurant>();
|
||||||
restaurants["ukarla"] = std::make_unique<LunchRest::UKarlaRestaurant>();
|
restaurants["ukarla"] = std::make_unique<LunchRest::UKarlaRestaurant>();
|
||||||
restaurants["alcapone"] = std::make_unique<LunchRest::AlCaponeRestaurant>();
|
restaurants["alcapone"] = std::make_unique<LunchRest::AlCaponeRestaurant>();
|
||||||
|
restaurants["plac"] = std::make_unique<LunchRest::PlacRestaurant>();
|
||||||
std::cout << "Initial parsing" << std::endl;
|
std::cout << "Initial parsing" << std::endl;
|
||||||
for(auto &restaurant : restaurants)
|
for(auto &restaurant : restaurants)
|
||||||
restaurant.second->parse();
|
restaurant.second->parse();
|
||||||
|
@ -42,6 +42,12 @@ public:
|
|||||||
ss << "]}";
|
ss << "]}";
|
||||||
return ss.str();
|
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:
|
protected:
|
||||||
std::string _url;
|
std::string _url;
|
||||||
std::string _restaurant;
|
std::string _restaurant;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "../restaurant.hpp"
|
#include "../restaurant.hpp"
|
||||||
|
#include <libxml++/libxml++.h>
|
||||||
|
|
||||||
namespace LunchRest {
|
namespace LunchRest {
|
||||||
|
std::string nodeToText(xmlpp::Node *node);
|
||||||
class UDrevakaRestaurant : public Restaurant {
|
class UDrevakaRestaurant : public Restaurant {
|
||||||
public:
|
public:
|
||||||
UDrevakaRestaurant() : Restaurant("https://www.udrevaka.cz/denni-menu/", "U Dřeváka") {}
|
UDrevakaRestaurant() : Restaurant("https://www.udrevaka.cz/denni-menu/", "U Dřeváka") {}
|
||||||
@ -31,5 +33,11 @@ public:
|
|||||||
virtual ~AlCaponeRestaurant() = default;
|
virtual ~AlCaponeRestaurant() = default;
|
||||||
virtual void parse() override;
|
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
|
} // end of namespace LunchRest
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user