diff --git a/model/recipe/ingredients/recipeingredient.cpp b/model/recipe/ingredients/recipeingredient.cpp index c7d3898..52fe6bc 100644 --- a/model/recipe/ingredients/recipeingredient.cpp +++ b/model/recipe/ingredients/recipeingredient.cpp @@ -1,11 +1,11 @@ #include "model/recipe/ingredients/recipeingredient.h" -RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, int quantity, UnitOfMeasure unit) : Ingredient(id, name, foodGroup){ +RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, float quantity, UnitOfMeasure unit) : Ingredient(id, name, foodGroup){ setQuantity(quantity); setUnit(unit); } -RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit){ +RecipeIngredient::RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit){ setId(i.getId()); setName(i.getName()); setFoodGroup(i.getFoodGroup()); @@ -13,11 +13,19 @@ RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure uni setUnit(unit); } +float RecipeIngredient::getQuantity(){ + return this->quantity; +} + +UnitOfMeasure RecipeIngredient::getUnit(){ + return this->unit; +} + string RecipeIngredient::getComment(){ return this->comment; } -void RecipeIngredient::setQuantity(int newQuantity){ +void RecipeIngredient::setQuantity(float newQuantity){ this->quantity = newQuantity; } diff --git a/model/recipe/ingredients/recipeingredient.h b/model/recipe/ingredients/recipeingredient.h index 8a75c0e..491d20e 100644 --- a/model/recipe/ingredients/recipeingredient.h +++ b/model/recipe/ingredients/recipeingredient.h @@ -15,18 +15,22 @@ using namespace std; class RecipeIngredient : public Ingredient { public: - RecipeIngredient(int id, string name, string foodGroup, int quantity, UnitOfMeasure unit); - RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit); + //Constructor for new RecipeIngredient without starting child ingredient. + RecipeIngredient(int id, string name, string foodGroup, float quantity, UnitOfMeasure unit); + //Constructor using data from a child ingredient. + RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit); - int getQuantity(); + //Getters + float getQuantity(); UnitOfMeasure getUnit(); string getComment(); - void setQuantity(int newQuantity); + //Setters + void setQuantity(float newQuantity); void setUnit(UnitOfMeasure newUnit); void setComment(string newComment); private: - int quantity; + float quantity; UnitOfMeasure unit; string comment; };