From c928533e6a1d115a722829e97d76ae57bf8286c0 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Mon, 12 Feb 2018 19:25:48 +0100 Subject: [PATCH] Added RecipeTag object to replace string in recipe object. --- RecipeDB.pro | 6 ++++-- model/recipe/recipe.cpp | 5 +++++ model/recipe/tags/recipetag.cpp | 17 +++++++++++++++++ model/recipe/tags/recipetag.h | 26 ++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 model/recipe/tags/recipetag.cpp create mode 100644 model/recipe/tags/recipetag.h diff --git a/RecipeDB.pro b/RecipeDB.pro index 7c40f21..a84d67e 100644 --- a/RecipeDB.pro +++ b/RecipeDB.pro @@ -21,7 +21,8 @@ SOURCES += SQLite/sqlite3.c \ model/recipe/ingredients/unitofmeasure.cpp \ model/recipe/ingredients/ingredient.cpp \ model/recipe/ingredients/ingredientlistmodel.cpp \ - model/recipe/ingredients/recipeingredient.cpp + model/recipe/ingredients/recipeingredient.cpp \ + model/recipe/tags/recipetag.cpp HEADERS += SQLite/sqlite3.h \ SQLite/sqlite3ext.h \ @@ -33,7 +34,8 @@ HEADERS += SQLite/sqlite3.h \ model/recipe/ingredients/unitofmeasure.h \ model/recipe/ingredients/ingredient.h \ model/recipe/ingredients/ingredientlistmodel.h \ - model/recipe/ingredients/recipeingredient.h + model/recipe/ingredients/recipeingredient.h \ + model/recipe/tags/recipetag.h FORMS += gui/mainwindow.ui diff --git a/model/recipe/recipe.cpp b/model/recipe/recipe.cpp index bd61d8d..149b3cd 100644 --- a/model/recipe/recipe.cpp +++ b/model/recipe/recipe.cpp @@ -2,6 +2,11 @@ Recipe::Recipe(){ //Set default values when none are specified. + this->Recipe("Unnamed Recipe", + vector(), + Instruction(), + QImage(), + vector()) this->name = "Unnamed Recipe"; this->ingredients = vector(); this->instruction = Instruction(); diff --git a/model/recipe/tags/recipetag.cpp b/model/recipe/tags/recipetag.cpp new file mode 100644 index 0000000..c33c6a7 --- /dev/null +++ b/model/recipe/tags/recipetag.cpp @@ -0,0 +1,17 @@ +#include "recipetag.h" + +RecipeTag::RecipeTag(){ + this->RecipeTag(""); +} + +RecipeTag::RecipeTag(string val){ + this->value = val; +} + +RecipeTag::getValue(){ + return this->value; +} + +RecipeTag::setValue(string newValue){ + this->value = newValue; +} diff --git a/model/recipe/tags/recipetag.h b/model/recipe/tags/recipetag.h new file mode 100644 index 0000000..5613af7 --- /dev/null +++ b/model/recipe/tags/recipetag.h @@ -0,0 +1,26 @@ +#ifndef RECIPETAG_H +#define RECIPETAG_H + +#include + +using namespace std; + +/** + * @brief The RecipeTag class is used to represent tags which can be used to categorize recipes for easy retrieval. + */ + +class RecipeTag +{ +public: + RecipeTag(); + RecipeTag(string val); + + //Getters + string getValue(); + //Setters + void setValue(string newValue); +private: + string value; +}; + +#endif // RECIPETAG_H