unit ToolsContainer;
interface
uses Sysutils, Classes, dpCollection, CollectionItems_Impl;
TToolsContainerItem =
class(TCollectionItem)
private
FMenuName:
String;
FProgName:
String;
FPathName:
String;
FOptions:
String;
FMacros:
String;
public
procedure Assign(Source: TPersistent);
override;
property MenuName:
String read FMenuName
write FMenuName;
property ProgName:
String read FProgName
write FProgName;
property PathName:
String read FPathName
write FPathName;
property Options:
String read FOptions
write FOptions;
property Macros:
String read FMacros
write FMacros;
end;
TToolsContainer =
class(TObject)
private
FList: TmxJsCollection;
function GetMenuName(
Index: Integer):
String;
function GetProgName(
Index: Integer):
String;
function GetPathName(
Index: Integer):
String;
function GetOptions(
Index: Integer):
String;
function GetMacros(
Index: Integer):
String;
procedure SetMenuName(
Index: Integer; value:
String);
procedure SetProgName(
Index: Integer; value:
String);
procedure SetPathName(
Index: Integer; value:
String);
procedure SetOptions(
Index: Integer; value:
String);
procedure SetMacros(
Index: Integer; value:
String);
public
constructor Create;
destructor Destroy;
override;
procedure Add(menName, prgName, pthName, opts, AMacros:
String);
procedure LoadFromFile(AFileName: TFileName);
procedure SaveToFile(AFileName: TFileName);
property MenuName[
Index: Integer]:
String read GetMenuName
write SetMenuName;
property ProgName[
Index: Integer]:
String read GetProgName
write SetProgName;
property PathName[
Index: Integer]:
String read GetPathName
write SetPathName;
property Options[
Index: Integer]:
String read GetOptions
write SetOptions;
property Macros[
Index: Integer]:
String read GetMacros
write SetMacros;
end;
implementation
{ TToolsContainerItem }
procedure TToolsContainerItem.Assign(Source: TPersistent);
begin
if Source
is TToolsContainerItem
then
begin
FMenuName := TToolsContainerItem(Source).MenuName;
FProgName := TToolsContainerItem(Source).ProgName;
FPathName := TToolsContainerItem(Source).PathName;
FOptions := TToolsContainerItem(Source).Options;
FMacros := TToolsContainerItem(Source).Macros;
end else Inherited Assign(Source);
end;
{ TToolsContainer }
function TToolsContainer.GetMenuName(
Index: Integer):
String;
begin
With FList.Items[
Index]
as TToolsContainerItem
do Result := MenuName;
end;
function TToolsContainer.GetProgName(
Index: Integer):
String;
begin
With FList.Items[
Index]
as TToolsContainerItem
do Result := ProgName;
end;
function TToolsContainer.GetPathName(
Index: Integer):
String;
begin
With FList.Items[
Index]
as TToolsContainerItem
do Result := PathName;
end;
function TToolsContainer.GetOptions(
Index: Integer):
String;
begin
With FList.Items[
Index]
as TToolsContainerItem
do Result := Options;
end;
function TToolsContainer.GetMacros(
Index: Integer):
String;
begin
With FList.Items[
Index]
as TToolsContainerItem
do Result := Macros;
end;
procedure TToolsContainer.SetMenuName(
Index: Integer; value:
String);
begin
With FList.Items[
Index]
as TToolsContainerItem
do MenuName := value;
end;
procedure TToolsContainer.SetProgName(
Index: Integer; value:
String);
begin
With FList.Items[
Index]
as TToolsContainerItem
do ProgName := value;
end;
procedure TToolsContainer.SetPathName(
Index: Integer; value:
String);
begin
With FList.Items[
Index]
as TToolsContainerItem
do PathName := value;
end;
procedure TToolsContainer.SetOptions(
Index: Integer; value:
String);
begin
With FList.Items[
Index]
as TToolsContainerItem
do Options := value;
end;
procedure TToolsContainer.SetMacros(
Index: Integer; value:
String);
begin
With FList.Items[
Index]
as TToolsContainerItem
do Macros := value;
end;
constructor TToolsContainer.Create;
begin
FList := TmxJsCollection.Create(TToolsContainerItem);
FList.Binary := false;
end;
destructor TToolsContainer.Destroy;
begin
FList.Free;
inherited Destroy;
end;
procedure TToolsContainer.Add(menName, prgName, pthName, opts, AMacros:
String);
begin
with FList.Add
as TToolsContainerItem
do
begin
MenuName := menName;
ProgName := prgName;
PathName := pthName;
Options := opts;
Macros := AMacros;
end;
end;
procedure TToolsContainer.LoadFromFile(AFileName: TFileName);
begin
FList.LoadFromFile(AFileName);
end;
procedure TToolsContainer.SaveToFile(AFileName: TFileName);
begin
FList.SaveToFile(AFileName);
end;
end.