Added RecipeTag object to replace string in recipe object.

This commit is contained in:
Andrew Lalis 2018-02-12 19:25:48 +01:00
parent c09f29930b
commit c928533e6a
4 changed files with 52 additions and 2 deletions

View File

@ -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

View File

@ -2,6 +2,11 @@
Recipe::Recipe(){
//Set default values when none are specified.
this->Recipe("Unnamed Recipe",
vector<RecipeIngredient>(),
Instruction(),
QImage(),
vector<string>())
this->name = "Unnamed Recipe";
this->ingredients = vector<RecipeIngredient>();
this->instruction = Instruction();

View File

@ -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;
}

View File

@ -0,0 +1,26 @@
#ifndef RECIPETAG_H
#define RECIPETAG_H
#include <string>
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