Created getters/setters for Recipe Class and cleaned up constructor.
This commit is contained in:
parent
7d358d6e55
commit
cd3f527785
|
@ -14,15 +14,15 @@ Recipe::Recipe(){
|
||||||
}
|
}
|
||||||
|
|
||||||
Recipe::Recipe(string name, vector<RecipeIngredient> ingredients, Instruction instruction, QImage image, vector<RecipeTag> tags, QDate createdDate, QTime prepTime, QTime cookTime, float servings){
|
Recipe::Recipe(string name, vector<RecipeIngredient> ingredients, Instruction instruction, QImage image, vector<RecipeTag> tags, QDate createdDate, QTime prepTime, QTime cookTime, float servings){
|
||||||
this->name = name;
|
setName(name);
|
||||||
this->ingredients = ingredients;
|
setIngredients(ingredients);
|
||||||
this->instruction = instruction;
|
setInstruction(instruction);
|
||||||
this->image = image;
|
setImage(image);
|
||||||
this->tags = tags;
|
setTags(tags);
|
||||||
this->createdDate = createdDate;
|
setCreatedDate(createdDate);
|
||||||
this->prepTime = prepTime;
|
setPrepTime(prepTime);
|
||||||
this->cookTime = cookTime;
|
setCookTime(cookTime);
|
||||||
this->servings = servings;
|
setServings(servings);
|
||||||
}
|
}
|
||||||
|
|
||||||
string Recipe::getName(){
|
string Recipe::getName(){
|
||||||
|
@ -60,3 +60,43 @@ QTime Recipe::getTotalTime(){
|
||||||
float Recipe::getServings(){
|
float Recipe::getServings(){
|
||||||
return this->servings;
|
return this->servings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Recipe::setName(string newName){
|
||||||
|
this->name = newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setIngredients(vector<RecipeIngredient> ingredients){
|
||||||
|
this->ingredients = ingredients;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setTags(vector<RecipeTag> tags){
|
||||||
|
this->tags = tags
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::addIngredient(RecipeIngredient newIngredient){
|
||||||
|
this->ingredients.push_back(newIngredient);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setInstruction(Instruction newInstruction){
|
||||||
|
this->instruction = newInstruction;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setImage(QImage newImage){
|
||||||
|
this->image = newImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setCreatedDate(QDate newDate){
|
||||||
|
this->createdDate = newDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setPrepTime(QTime newTime){
|
||||||
|
this->prepTime = newTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setCookTime(QTime newTime){
|
||||||
|
this->cookTime = newTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recipe::setServings(float newServingsCount){
|
||||||
|
this->servings = newServingsCount;
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
|
|
||||||
//Setters
|
//Setters
|
||||||
void setName(string newName);
|
void setName(string newName);
|
||||||
|
void setIngredients(vector<RecipeIngredient> ingredients);
|
||||||
|
void setTags(vector<RecipeTag> tags);
|
||||||
void addIngredient(RecipeIngredient newIngredient);
|
void addIngredient(RecipeIngredient newIngredient);
|
||||||
void setInstruction(Instruction newInstruction);
|
void setInstruction(Instruction newInstruction);
|
||||||
void setImage(QImage newImage);
|
void setImage(QImage newImage);
|
||||||
|
|
Loading…
Reference in New Issue