Removed ID from Ingredient.
This commit is contained in:
parent
b6093aeee9
commit
30df250c7c
|
@ -1,21 +1,15 @@
|
||||||
#include "model/recipe/ingredients/ingredient.h"
|
#include "model/recipe/ingredients/ingredient.h"
|
||||||
|
|
||||||
Ingredient::Ingredient(){
|
Ingredient::Ingredient(){
|
||||||
setId(-1);
|
|
||||||
setName("NULL");
|
setName("NULL");
|
||||||
setFoodGroup("NULL");
|
setFoodGroup("NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ingredient::Ingredient(int id, string name, string foodGroup){
|
Ingredient::Ingredient(string name, string foodGroup){
|
||||||
setId(id);
|
|
||||||
setName(name);
|
setName(name);
|
||||||
setFoodGroup(foodGroup);
|
setFoodGroup(foodGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Ingredient::getId(){
|
|
||||||
return this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
string Ingredient::getName(){
|
string Ingredient::getName(){
|
||||||
return this->name;
|
return this->name;
|
||||||
}
|
}
|
||||||
|
@ -24,10 +18,6 @@ string Ingredient::getFoodGroup(){
|
||||||
return this->foodGroup;
|
return this->foodGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ingredient::setId(int newId){
|
|
||||||
this->id = newId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ingredient::setName(string newName){
|
void Ingredient::setName(string newName){
|
||||||
this->name = newName;
|
this->name = newName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,16 @@ class Ingredient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Ingredient();
|
Ingredient();
|
||||||
Ingredient(int id, string name, string foodGroup);
|
Ingredient(string name, string foodGroup);
|
||||||
|
|
||||||
int getId();
|
//Getters
|
||||||
string getName();
|
string getName();
|
||||||
string getFoodGroup();
|
string getFoodGroup();
|
||||||
|
|
||||||
void setId(int newId);
|
//Setters
|
||||||
void setName(string newName);
|
void setName(string newName);
|
||||||
void setFoodGroup(string newFoodGroup);
|
void setFoodGroup(string newFoodGroup);
|
||||||
protected:
|
protected:
|
||||||
int id;
|
|
||||||
string name;
|
string name;
|
||||||
string foodGroup;
|
string foodGroup;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#include "model/recipe/ingredients/recipeingredient.h"
|
#include "model/recipe/ingredients/recipeingredient.h"
|
||||||
|
|
||||||
RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, float quantity, UnitOfMeasure unit) : Ingredient(id, name, foodGroup){
|
RecipeIngredient::RecipeIngredient(string name, string foodGroup, float quantity, UnitOfMeasure unit) : Ingredient(name, foodGroup){
|
||||||
setQuantity(quantity);
|
setQuantity(quantity);
|
||||||
setUnit(unit);
|
setUnit(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecipeIngredient::RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit){
|
RecipeIngredient::RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit){
|
||||||
setId(i.getId());
|
|
||||||
setName(i.getName());
|
setName(i.getName());
|
||||||
setFoodGroup(i.getFoodGroup());
|
setFoodGroup(i.getFoodGroup());
|
||||||
setQuantity(quantity);
|
setQuantity(quantity);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class RecipeIngredient : public Ingredient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Constructor for new RecipeIngredient without starting child ingredient.
|
//Constructor for new RecipeIngredient without starting child ingredient.
|
||||||
RecipeIngredient(int id, string name, string foodGroup, float quantity, UnitOfMeasure unit);
|
RecipeIngredient(string name, string foodGroup, float quantity, UnitOfMeasure unit);
|
||||||
//Constructor using data from a child ingredient.
|
//Constructor using data from a child ingredient.
|
||||||
RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit);
|
RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue