[Gotisso-commit] SF.net SVN: gotisso:[11] trunk
Status: Inactive
Brought to you by:
jmvaz
From: <jm...@us...> - 2009-12-04 18:35:52
|
Revision: 11 http://gotisso.svn.sourceforge.net/gotisso/?rev=11&view=rev Author: jmvaz Date: 2009-12-04 18:35:45 +0000 (Fri, 04 Dec 2009) Log Message: ----------- changed classes names from portuguese to english Modified Paths: -------------- trunk/gotisso.lpi trunk/u_classes.pas trunk/u_main.pas trunk/u_meal.pas Modified: trunk/gotisso.lpi =================================================================== --- trunk/gotisso.lpi 2009-12-04 17:53:02 UTC (rev 10) +++ trunk/gotisso.lpi 2009-12-04 18:35:45 UTC (rev 11) @@ -4,6 +4,11 @@ <PathDelim Value="\"/> <Version Value="7"/> <General> + <Flags> + <SaveClosedFiles Value="False"/> + <SaveOnlyProjectUnits Value="True"/> + <AlwaysBuild Value="False"/> + </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> <TargetFileExt Value=".exe"/> Modified: trunk/u_classes.pas =================================================================== --- trunk/u_classes.pas 2009-12-04 17:53:02 UTC (rev 10) +++ trunk/u_classes.pas 2009-12-04 18:35:45 UTC (rev 11) @@ -30,146 +30,147 @@ type - { TPrato } + { TDish } - TPrato = class(TPersistent) + TDish = class(TPersistent) private - fIngredientes: TStringList; - fNome: String; - fTipo: String; - procedure SetIngredientes(const AValue: TStringList); - procedure SetNome(const AValue: String); - procedure SetTipo(const AValue: String); + fDishType: String; + fIngredients: TStringList; + fName: String; + procedure SetDishType(const AValue: String); + procedure SetIngredients(const AValue: TStringList); + procedure SetName(const AValue: String); public constructor Create; overload; - constructor Create(ANome,ATipo: String); overload; + constructor Create(AName,ADishType: String); overload; destructor Destroy; override; procedure Assign(Source: TPersistent); override; - property Nome: String read fNome write SetNome; - property Tipo: String read fTipo write SetTipo; - property Ingredientes: TStringList read fIngredientes write SetIngredientes; + property Name: String read fName write SetName; + property DishType: String read fDishType write SetDishType; + property Ingredients: TStringList read fIngredients write SetIngredients; end; - { TPratos } + { TDishes } - TPratos = class + TDishes = class private - fLista: TStringList; + fList: TStringList; protected - function GetTodosTipos: TStringList; virtual; - function GetTodosIngredientes: TStringList; virtual; - function GetTodosPratos: TStringList; virtual; - function GetTotal: Integer; virtual; - function GetPrato(Index: Integer): TPrato; virtual; + function GetAllDishTypes: TStringList; virtual; + function GetAllIngredients: TStringList; virtual; + function GetAllDishes: TStringList; virtual; + function GetCount: Integer; virtual; + function GetDish(Index: Integer): TDish; virtual; public constructor Create; destructor Destroy; override; - function PratosPorTipo(ATipo: String): TPratos; virtual; - function PratosPorIngrediente(AIngrediente: String): TPratos; virtual; - function PratoPorNome(ANome: String): TPrato; virtual; - procedure AdicionaPrato(APrato: TPrato); - function RemovePrato(ANome: String): Boolean; overload; - function RemovePrato(APrato: TPrato): Boolean; overload; - procedure Limpar; - property TodosTipos: TStringList read GetTodosTipos; - property TodosIngredientes: TStringList read GetTodosIngredientes; - property TodosPratos: TStringList read GetTodosPratos; - property Total: Integer read GetTotal; - property Prato[Index: Integer]: TPrato read GetPrato; + function DishesByDishType(ADishType: String): TDishes; virtual; + function DishesByIngredient(AIngredient: String): TDishes; virtual; + function DishByName(AName: String): TDish; virtual; + procedure AddDish(ADish: TDish); + function RemoveDish(AName: String): Boolean; overload; + function RemoveDish(ADish: TDish): Boolean; overload; + procedure Clear; + property AllDishTypes: TStringList read GetAllDishTypes; + property AllIngredients: TStringList read GetAllIngredients; + property AllDishes: TStringList read GetAllDishes; + property Count: Integer read GetCount; + property Dish[Index: Integer]: TDish read GetDish; end; - { TPratosDB } + { TDishesDB } - TPratosDB = class(TPratos) + TDishesDB = class(TDishes) private public function LoadFromFile(AFileName: TFileName): Boolean; end; - { TRefeicao } + { TMeal } - TRefeicao = class + TMeal = class private - fPratos: TPratos; - fData: TDateTime; + fDishes: TDishes; + fDate: TDateTime; protected - procedure SetData(const AValue: TdateTime); - procedure SetPratos(const AValue: TPratos); + procedure SetDate(const AValue: TDateTime); + procedure SetDishes(const AValue: TDishes); public constructor Create; overload; - constructor Create(AData: TDateTime; APratos: TPratos); overload; + constructor Create(ADate: TDateTime; ADishes: TDishes); overload; destructor Destroy; override; - procedure AdicionaPrato(APrato: TPrato); - procedure Limpar; - function RemovePrato(APrato: String): Boolean; overload; - function RemovePrato(APrato: TPrato): Boolean; overload; - property Data: TdateTime read fData write SetData; - property Pratos: TPratos read fPratos write SetPratos; + procedure AddDish(ADish: TDish); + procedure Clear; + function RemoveDish(ADish: String): Boolean; overload; + function RemoveDish(ADish: TDish): Boolean; overload; + property Date: TDateTime read fDate write SetDate; + property Dishes: TDishes read fDishes write SetDishes; end; var - Pratos: TPratosDB; + Dishes: TDishesDB; implementation -{ TPrato } +{ TDish } -procedure TPrato.SetIngredientes(const AValue: TStringList); + +procedure TDish.SetDishType(const AValue: String); begin - if FIngredientes=AValue then exit; - FIngredientes.Assign(AValue); + if fDishType = AValue then exit; + fDishType:= AValue; end; -procedure TPrato.SetNome(const AValue: String); +procedure TDish.SetIngredients(const AValue: TStringList); begin - if FNome=AValue then exit; - FNome:=AValue; + if fIngredients = AValue then exit; + fIngredients:= AValue; end; -procedure TPrato.SetTipo(const AValue: String); +procedure TDish.SetName(const AValue: String); begin - if FTipo=AValue then exit; - FTipo:=AValue; + if fName = AValue then exit; + fName:= AValue; end; -constructor TPrato.Create; +constructor TDish.Create; begin - FIngredientes:= TStringList.Create; + fIngredients:= TStringList.Create; end; -constructor TPrato.Create(ANome, ATipo: String); +constructor TDish.Create(AName, ADishType: String); begin Self.Create; - Self.Tipo:= ATipo; - Self.Nome:= ANome; + Self.DishType:= ADishType; + Self.Name:= AName; end; -destructor TPrato.Destroy; +destructor TDish.Destroy; begin - FIngredientes.Clear; - FIngredientes.Free; + FIngredients.Clear; + FIngredients.Free; inherited Destroy; end; -procedure TPrato.Assign(Source: TPersistent); +procedure TDish.Assign(Source: TPersistent); begin - if (Source <> Nil) and (Source is TPrato) then + if (Source <> Nil) and (Source is TDish) then begin - Nome:= TPrato(Source).Nome; - Tipo:= TPrato(Source).Tipo; - Ingredientes.Assign(TPrato(Source).Ingredientes); + Name:= TDish(Source).Name; + DishType:= TDish(Source).DishType; + Ingredients.Assign(TDish(Source).Ingredients); end else inherited Assign(Source); end; -{ TPratos } +{ TDishes } -function TPratos.GetTodosTipos: TStringList; +function TDishes.GetAllDishTypes: TStringList; var i: Integer; begin @@ -177,14 +178,14 @@ try Result.Sorted:= True; Result.Duplicates:= dupIgnore; - for i:= 0 to (fLista.Count-1) do - Result.Add(TPrato(fLista.Objects[i]).Tipo); + for i:= 0 to (fList.Count-1) do + Result.Add(TDish(fList.Objects[i]).DishType); except Result:= nil; end; end; -function TPratos.GetTodosIngredientes: TStringList; +function TDishes.GetAllIngredients: TStringList; var i,j: Integer; begin @@ -192,15 +193,15 @@ try Result.Sorted:= True; Result.Duplicates:= dupIgnore; - for i:= 0 to (fLista.Count-1) do - for j:= 0 to (TPrato(fLista.Objects[i]).Ingredientes.Count-1) do - Result.Add(TPrato(fLista.Objects[i]).Ingredientes.Strings[j]); + for i:= 0 to (fList.Count-1) do + for j:= 0 to (TDish(fList.Objects[i]).Ingredients.Count-1) do + Result.Add(TDish(fList.Objects[i]).Ingredients.Strings[j]); except Result:= nil; end; end; -function TPratos.GetTodosPratos: TStringList; +function TDishes.GetAllDishes: TStringList; var i: Integer; begin @@ -208,166 +209,166 @@ try Result.Sorted:= True; Result.Duplicates:= dupIgnore; - for i:= 0 to (fLista.Count-1) do - Result.Add(TPrato(fLista.Objects[i]).Nome); + for i:= 0 to (fList.Count-1) do + Result.Add(TDish(fList.Objects[i]).Name); except Result:= nil; end; end; -function TPratos.GetTotal: Integer; +function TDishes.GetCount: Integer; begin - Result:= fLista.Count; + Result:= fList.Count; end; -function TPratos.GetPrato(Index: Integer): TPrato; +function TDishes.GetDish(Index: Integer): TDish; begin - if ((Index >= 0) and (Index < fLista.Count)) then - Result:= (fLista.Objects[Index] as TPrato); + if ((Index >= 0) and (Index < fList.Count)) then + Result:= (fList.Objects[Index] as TDish); end; -constructor TPratos.Create; +constructor TDishes.Create; begin - fLista:= TStringList.Create; + fList:= TStringList.Create; end; -destructor TPratos.Destroy; +destructor TDishes.Destroy; begin - Limpar; - fLista.Free; + Clear; + fList.Free; inherited Destroy; end; -function TPratos.PratosPorTipo(ATipo: String): TPratos; +function TDishes.DishesByDishType(ADishType: String): TDishes; var i: Integer; begin - Result:= TPratos.Create; + Result:= TDishes.Create; try - for i:= 0 to (fLista.Count-1) do - if TPrato(fLista.Objects[i]).Tipo = ATipo then - Result.AdicionaPrato(TPrato(fLista.Objects[i])); + for i:= 0 to (fList.Count-1) do + if TDish(fList.Objects[i]).DishType = ADishType then + Result.AddDish(TDish(fList.Objects[i])); except Result:= nil; end; end; -function TPratos.PratosPorIngrediente(AIngrediente: String): TPratos; +function TDishes.DishesByIngredient(AIngredient: String): TDishes; var i: Integer; begin - Result:= TPratos.Create; + Result:= TDishes.Create; try - for i:= 0 to (fLista.Count-1) do - if (TPrato(fLista.Objects[i]).Ingredientes.IndexOf(AIngrediente) > -1) then - Result.AdicionaPrato(TPrato(fLista.Objects[i])); + for i:= 0 to (fList.Count-1) do + if (TDish(fList.Objects[i]).Ingredients.IndexOf(AIngredient) > -1) then + Result.AddDish(TDish(fList.Objects[i])); except Result:= nil; end; end; -function TPratos.PratoPorNome(ANome: String): TPrato; +function TDishes.DishByName(AName: String): TDish; var i: Integer; begin - Result:= TPrato.Create; - for i:= 0 to (fLista.Count-1) do - if TPrato(fLista.Objects[i]).Nome = ANome then - Result.Assign(TPrato(fLista.Objects[i])); + Result:= TDish.Create; + for i:= 0 to (fList.Count-1) do + if TDish(fList.Objects[i]).Name = AName then + Result.Assign(TDish(fList.Objects[i])); end; -procedure TPratos.AdicionaPrato(APrato: TPrato); +procedure TDishes.AddDish(ADish: TDish); begin - fLista.AddObject(APrato.Nome,APrato); + fList.AddObject(ADish.Name,ADish); end; -function TPratos.RemovePrato(ANome: String): Boolean; +function TDishes.RemoveDish(AName: String): Boolean; var i: Integer; begin - for i:= 0 to (fLista.Count-1) do - if TPrato(fLista.Objects[i]).Nome = ANome then + for i:= 0 to (fList.Count-1) do + if TDish(fList.Objects[i]).Name = AName then begin - TPrato(fLista.Objects[i]).Free; - fLista.Delete(i); + TDish(fList.Objects[i]).Free; + fList.Delete(i); Result:= True; end; end; -function TPratos.RemovePrato(APrato: TPrato): Boolean; +function TDishes.RemoveDish(ADish: TDish): Boolean; begin - Result:= RemovePrato(APrato.Nome); + Result:= RemoveDish(ADish.Name); end; -procedure TPratos.Limpar; +procedure TDishes.Clear; begin - fLista.Clear; + fList.Clear; end; -{ TPratosDB } +{ TDishesDB } -function TPratosDB.LoadFromFile(AFileName: TFileName): Boolean; +function TDishesDB.LoadFromFile(AFileName: TFileName): Boolean; begin end; -{ TRefeicao } +{ TMeal } -procedure TRefeicao.SetData(const AValue: TDateTime); +procedure TMeal.SetDate(const AValue: TDateTime); begin - if fData = AValue then exit; - fData:=AValue; + if fDate = AValue then exit; + fDate:=AValue; end; -procedure TRefeicao.SetPratos(const AValue: TPratos); +procedure TMeal.SetDishes(const AValue: TDishes); var i: Integer; begin - fPratos.Limpar; - for i:= 0 to AValue.Total-1 do - fPratos.AdicionaPrato(AValue.Prato[i]); + fDishes.Clear; + for i:= 0 to AValue.Count-1 do + fDishes.AddDish(AValue.Dish[i]); end; -constructor TRefeicao.Create; +constructor TMeal.Create; begin - fPratos:= TPratos.Create; - fData:= Date; + fDishes:= TDishes.Create; + fDate:= Date; end; -constructor TRefeicao.Create(AData: TDateTime; APratos: TPratos); +constructor TMeal.Create(ADate: TDateTime; ADishes: TDishes); begin Self.Create; - Self.Data:= AData; - Self.Pratos:= APratos; + Self.Date:= ADate; + Self.Dishes:= ADishes; end; -destructor TRefeicao.Destroy; +destructor TMeal.Destroy; begin inherited Destroy; end; -procedure TRefeicao.AdicionaPrato(APrato: TPrato); +procedure TMeal.AddDish(ADish: TDish); begin - fPratos.AdicionaPrato(APrato); + fDishes.AddDish(ADish); end; -procedure TRefeicao.Limpar; +procedure TMeal.Clear; begin - Pratos.Limpar; - Data:= Date; + Dishes.Clear; + Date:= Now; end; -function TRefeicao.RemovePrato(APrato: String): Boolean; +function TMeal.RemoveDish(ADish: String): Boolean; begin - Result:= fPratos.RemovePrato(APrato); + Result:= fDishes.RemoveDish(ADish); end; -function TRefeicao.RemovePrato(APrato: TPrato): Boolean; +function TMeal.RemoveDish(ADish: TDish): Boolean; begin - Result:= fPratos.RemovePrato(APrato); + Result:= fDishes.RemoveDish(ADish); end; end. Modified: trunk/u_main.pas =================================================================== --- trunk/u_main.pas 2009-12-04 17:53:02 UTC (rev 10) +++ trunk/u_main.pas 2009-12-04 18:35:45 UTC (rev 11) @@ -66,19 +66,19 @@ procedure TfmMain.FormCreate(Sender: TObject); begin Caption:= sTitle; - Pratos:= TPratosDB.Create; + Dishes:= TDishesDB.Create; // testes temporários - Pratos.AdicionaPrato(TPrato.Create('Bife a milanesa','carne')); - Pratos.AdicionaPrato(TPrato.Create('Frango a milanesa','carne')); - Pratos.AdicionaPrato(TPrato.Create('Frango a milanesa','carne')); - Pratos.AdicionaPrato(TPrato.Create('Filé de peixe','carne')); - Pratos.AdicionaPrato(TPrato.Create('Arroz','carboidrato')); - Pratos.AdicionaPrato(TPrato.Create('Purê de batatas','carboidrato')); - Pratos.AdicionaPrato(TPrato.Create('Macarrão','carboidrato')); - Pratos.AdicionaPrato(TPrato.Create('Feijão','leguminosa')); - Pratos.AdicionaPrato(TPrato.Create('Grão de bico','leguminosa')); + Dishes.AddDish(TDish.Create('Bife a milanesa','carne')); + Dishes.AddDish(TDish.Create('Frango a milanesa','carne')); + Dishes.AddDish(TDish.Create('Frango a milanesa','carne')); + Dishes.AddDish(TDish.Create('Filé de peixe','carne')); + Dishes.AddDish(TDish.Create('Arroz','carboidrato')); + Dishes.AddDish(TDish.Create('Purê de batatas','carboidrato')); + Dishes.AddDish(TDish.Create('Macarrão','carboidrato')); + Dishes.AddDish(TDish.Create('Feijão','leguminosa')); + Dishes.AddDish(TDish.Create('Grão de bico','leguminosa')); // fim dos testes temporários Modified: trunk/u_meal.pas =================================================================== --- trunk/u_meal.pas 2009-12-04 17:53:02 UTC (rev 10) +++ trunk/u_meal.pas 2009-12-04 18:35:45 UTC (rev 11) @@ -81,7 +81,7 @@ procedure TfmMeal.FormCreate(Sender: TObject); begin - cbType.Items.Assign(Pratos.TodosTipos); + cbType.Items.Assign(Dishes.AllDishTypes); end; procedure TfmMeal.FormShow(Sender: TObject); @@ -93,7 +93,7 @@ procedure TfmMeal.cbTypeChange(Sender: TObject); begin - cbDish.Items.Assign(Pratos.PratosPorTipo(cbType.Items[cbType.ItemIndex]).TodosPratos); + cbDish.Items.Assign(Dishes.DishesByDishType(cbType.Items[cbType.ItemIndex]).AllDishes); cbDish.ItemIndex:= 0; end; @@ -173,17 +173,17 @@ function TfmMeal.Adicionar: Boolean; var - Refeicao: TRefeicao; + Meal: TMeal; i: Integer; begin Result:= False; - Refeicao:= TRefeicao.Create; + Meal:= TMeal.Create; try for i:= 0 to (lbMeal.Count-1) do begin - Refeicao.AdicionaPrato(Pratos.PratoPorNome(lbMeal.Items.Strings[i])); + Meal.AddDish(Dishes.DishByName(lbMeal.Items.Strings[i])); end; - Refeicao.Data:= deDate.Date; + Meal.Date:= deDate.Date; //TODO: falta adicionar ao cardápio This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |