2018-02-02 12:27:57 +00:00
|
|
|
#ifndef RECIPE_H
|
|
|
|
#define RECIPE_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2018-02-12 18:20:38 +00:00
|
|
|
#include <QDate>
|
|
|
|
#include <QTime>
|
|
|
|
#include <QImage>
|
2018-03-30 10:29:10 +00:00
|
|
|
#include <algorithm>
|
2018-02-02 12:27:57 +00:00
|
|
|
|
2018-05-22 19:16:54 +00:00
|
|
|
#include "model/recipe/ingredients/ingredient.h"
|
2018-02-12 13:24:11 +00:00
|
|
|
#include "model/recipe/instruction.h"
|
2018-02-12 18:37:35 +00:00
|
|
|
#include "model/recipe/tags/recipetag.h"
|
2018-02-02 12:27:57 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2018-02-12 14:15:04 +00:00
|
|
|
/**
|
|
|
|
* @brief The Recipe class represents all the data of a recipe:
|
|
|
|
* - A name.
|
|
|
|
* - List of ingredients.
|
|
|
|
* - An instruction object, which represents a block of HTML text which forms the instructions.
|
|
|
|
* - An image, if possible.
|
|
|
|
* - Created Date
|
|
|
|
* - A list of tags.
|
|
|
|
* - Makes X Servings.
|
|
|
|
* - Prep time.
|
|
|
|
* - Cook time.
|
|
|
|
* The recipe object can be used to populate the window with a full recipe. Prep time, cook time, servings, will be displayed at the beginning of the instructions block.
|
|
|
|
*/
|
|
|
|
|
2018-02-02 12:27:57 +00:00
|
|
|
class Recipe
|
|
|
|
{
|
|
|
|
public:
|
2018-02-12 18:20:38 +00:00
|
|
|
//Full constructor
|
2018-03-31 13:02:35 +00:00
|
|
|
Recipe(string name, string author, vector<RecipeIngredient> ingredients, Instruction instruction, QImage image, vector<RecipeTag> tags, QDate createdDate, QTime prepTime, QTime cookTime, float servings);
|
2018-02-12 19:27:27 +00:00
|
|
|
//Constructor with default values.
|
|
|
|
Recipe();
|
2018-02-02 12:27:57 +00:00
|
|
|
|
2018-02-12 18:20:38 +00:00
|
|
|
//Getters
|
2018-02-13 09:22:05 +00:00
|
|
|
string getName() const;
|
2018-03-31 13:02:35 +00:00
|
|
|
string getAuthor() const;
|
2018-02-13 09:22:05 +00:00
|
|
|
vector<RecipeIngredient> getIngredients() const;
|
2018-03-30 10:29:10 +00:00
|
|
|
vector<string> getFoodGroups() const;
|
2018-02-13 09:22:05 +00:00
|
|
|
Instruction getInstruction() const;
|
|
|
|
QImage getImage() const;
|
|
|
|
vector<RecipeTag> getTags() const;
|
|
|
|
QDate getCreatedDate() const;
|
|
|
|
QTime getPrepTime() const;
|
|
|
|
QTime getCookTime() const;
|
|
|
|
QTime getTotalTime() const; //Derived method to add prep and cook times.
|
|
|
|
float getServings() const;
|
2018-03-29 14:09:58 +00:00
|
|
|
bool isEmpty() const;
|
2018-02-12 18:37:35 +00:00
|
|
|
|
2018-02-12 18:20:38 +00:00
|
|
|
//Setters
|
|
|
|
void setName(string newName);
|
2018-03-31 13:02:35 +00:00
|
|
|
void setAuthor(string newName);
|
2018-02-12 18:44:35 +00:00
|
|
|
void setIngredients(vector<RecipeIngredient> ingredients);
|
|
|
|
void setTags(vector<RecipeTag> tags);
|
2018-02-12 18:20:38 +00:00
|
|
|
void addIngredient(RecipeIngredient newIngredient);
|
|
|
|
void setInstruction(Instruction newInstruction);
|
2018-02-12 18:37:35 +00:00
|
|
|
void setImage(QImage newImage);
|
|
|
|
void setCreatedDate(QDate newDate);
|
|
|
|
void setPrepTime(QTime newTime);
|
|
|
|
void setCookTime(QTime newTime);
|
|
|
|
void setServings(float newServingsCount);
|
2018-03-03 09:18:38 +00:00
|
|
|
|
|
|
|
void print();
|
2018-02-02 12:27:57 +00:00
|
|
|
private:
|
2018-02-12 18:20:38 +00:00
|
|
|
//Main information.
|
|
|
|
string name; //The name of the recipe.
|
2018-03-31 13:02:35 +00:00
|
|
|
string authorName; //The name of the author of this recipe.
|
2018-02-12 18:20:38 +00:00
|
|
|
vector<RecipeIngredient> ingredients; //The list of ingredients in the recipe.
|
|
|
|
Instruction instruction; //The instruction HTML document.
|
|
|
|
QImage image; //An image displayed alongside the recipe.
|
|
|
|
//Auxiliary Information.
|
2018-02-12 18:37:35 +00:00
|
|
|
vector<RecipeTag> tags; //The list of tags which can be used to categorize the recipe.
|
2018-02-12 18:20:38 +00:00
|
|
|
QDate createdDate; //The date the recipe was created.
|
|
|
|
QTime prepTime; //The time taken for preparation.
|
|
|
|
QTime cookTime; //The time taken to cook.
|
|
|
|
float servings; //The number of servings which this recipe produces.
|
2018-02-02 12:27:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RECIPE_H
|