Componentes.Terceros.RemObj.../internal/5.0.23.613/1/RemObjects SDK for Delphi/Source/CodeGen2/uRODLInvkConverter.pas
david 2824855ea7 - Modificación del paquete RemObjects_Core_D10 para que sea un paquete de runtime/designtime (antes era designtime sólo)
- Recompilación en Delphi10 de todos los paquetes de RO para generar las DCU's en Lib\D10
- Recompilación en Delphi10 de todos los paquetes de DA para generar las DCU's en Lib\D10

git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@9 b6239004-a887-0f4b-9937-50029ccdca16
2007-09-10 14:06:19 +00:00

111 lines
4.0 KiB
ObjectPascal

unit uRODLInvkConverter;
{----------------------------------------------------------------------------}
{ RemObjects SDK Library - CodeGen2 }
{ }
{ compiler: Delphi 5 and up, Kylix 2 and up }
{ platform: Win32, Linux }
{ }
{ (c)opyright RemObjects Software. all rights reserved. }
{ }
{ Using this code requires a valid license of the RemObjects SDK }
{ which can be obtained at http://www.remobjects.com. }
{----------------------------------------------------------------------------}
{$IFDEF LINUX}
{$I ../RemObjects.inc}
{$ELSE}
{$I ..\RemObjects.inc}
{$ENDIF LINUX}
interface
uses
Classes, IniFiles, uRODLTemplateBasedConverter, uRODLSplitableConverter, uRODLLineStream, uRODL;
type
TRODLInvkConverter = class (TRODLSplitableConverter)
private
function GetLibrary: TRODLLibrary;
protected
procedure SetupFiles(const aLibrary: TRODLLibrary); override;
function GetSplitFilesSuffix: string; override;
procedure AddEntityTypes(Types: {$IFDEF FPC}TStringList{$ELSE}THashedStringList{$ENDIF}; const AEntity: TRODLEntity; const unitName: string); override;
function ValidateTargetEntity(const aLibrary: TRODLLibrary; const aTargetEntity: string): boolean; override;
property ROLibrary: TRODLLibrary read GetLibrary;
published
public
constructor Create(const aLibrary: TRODLLibrary; const aTemplateFileName: string; const aUnitName: string;
const ASplit: Boolean = False; const AOutputDir: string = '';
const AWrapperTemplateName: string = ''; const aTargetEntities: string = ''); override;
end;
implementation
uses
Contnrs, uROTypes, uROClasses, uRODLTemplateBasedConverterUtils;
{ TRODLInvkConverter }
procedure TRODLInvkConverter.AddEntityTypes(Types: {$IFDEF FPC}TStringList{$ELSE}THashedStringList{$ENDIF};
const AEntity: TRODLEntity; const unitName: string);
begin
if AEntity is TRODLService then
begin
Types.Values['T' + AEntity.Name] := unitName;
end
else
inherited AddEntityTypes(Types, AEntity, unitName);
end;
constructor TRODLInvkConverter.Create(const aLibrary: TRODLLibrary;
const aTemplateFileName: string; const aUnitName: string;
const ASplit: Boolean = False; const AOutputDir: string = '';
const AWrapperTemplateName: string = ''; const aTargetEntities: string = '');
begin
// Call inherited with nil so that convert is not called, allowing us
// to setup the optional sections. Setting up the optional sections before
// calling the inherited Create is not an option, the section list would
// not have been created
inherited Create(nil, aTemplateFileName, aUnitName, ASplit, AOutputDir, AWrapperTemplateName, aTargetEntities);
// Setup the optional sections
// Now that everything is done, call convert if need be.
if (aLibrary <> nil) then Convert(aLibrary);
end;
function TRODLInvkConverter.GetLibrary: TRODLLibrary;
begin
Result := FLibrary;
end;
function TRODLInvkConverter.GetSplitFilesSuffix: string;
begin
Result := DEFAULT_INVK_SUFFIX;
end;
procedure TRODLInvkConverter.SetupFiles(const aLibrary: TRODLLibrary);
var
I: Integer;
newFile: TRODLSplitableConverterFile;
begin
FFiles.Clear;
// For the invoker, we only want files for the services.
for I := 0 to FOrderedServices.Count - 1 do
begin
newFile := TRODLSplitableConverterFile.Create(aLibrary, Self);
newFile.Services.Add(FOrderedServices.Objects[I]);
FFiles.Add(newFile);
end;
end;
function TRODLInvkConverter.ValidateTargetEntity(const aLibrary: TRODLLibrary;
const aTargetEntity: string): boolean;
begin
Result := True;
end;
end.