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.