source upload
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
/// SOA interface methods definition to circumvent FPC missing RTTI
|
||||
{{#uri}}
|
||||
// - retrieved from http://{{host}}/{{uri}}
|
||||
// at {{time}} using "{{templateName}}" template
|
||||
{{/uri}}
|
||||
{{^uri}}
|
||||
// - generated at {{time}}
|
||||
{{/uri}}
|
||||
unit {{fileName}};
|
||||
|
||||
{
|
||||
WARNING:
|
||||
This unit has been generated by a mORMot {{mORMotVersion}} server.
|
||||
Any manual modification of this file may be lost after regeneration.
|
||||
|
||||
Synopse mORMot framework. Copyright (C) {{year}} Arnaud Bouchez
|
||||
Synopse Informatique - http://synopse.info
|
||||
|
||||
This unit is released under a MPL/GPL/LGPL tri-license,
|
||||
and therefore may be freely included in any application.
|
||||
|
||||
This unit is intended to work on older FPC compilers, which lack of RTTI
|
||||
for interfaces - see http://bugs.freepascal.org/view.php?id=26774
|
||||
|
||||
USAGE:
|
||||
|
||||
Add this {{fileName}} unit to your uses clause, so that the following
|
||||
interfaces would be defined as expected by mORMot under FPC:
|
||||
|
||||
{{#soa.services}}
|
||||
- {{interfaceName}}
|
||||
{{/soa.services}}
|
||||
|
||||
}
|
||||
|
||||
interface
|
||||
|
||||
{$I Synopse.inc} // needed for setting HASINTERFACERTTI and proper FPC modes
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
Classes,
|
||||
SynCommons,
|
||||
SynLog,
|
||||
mORMot{{#units}},
|
||||
{{.}}{{/units}};
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{{#soa.enabled}}
|
||||
{$ifndef HASINTERFACERTTI} // circumvent old FPC bug of missing RTTI
|
||||
|
||||
{ TInterfaceFactoryDefinition }
|
||||
|
||||
type
|
||||
/// define and manage missing interface RTTI for the following interfaces:
|
||||
{{#soa.services}}
|
||||
// - {{interfaceName}}
|
||||
{{/soa.services}}
|
||||
TInterfaceFactoryDefinition = class(TInterfaceFactoryGenerated)
|
||||
protected
|
||||
procedure AddMethodsFromTypeInfo(aInterface: PTypeInfo); override;
|
||||
end;
|
||||
|
||||
procedure TInterfaceFactoryDefinition.AddMethodsFromTypeInfo(aInterface: PTypeInfo);
|
||||
begin
|
||||
{{#soa.services}}
|
||||
if aInterface=TypeInfo({{interfaceName}}) then begin
|
||||
{{#methods}}
|
||||
AddMethod('{{methodName}}',[
|
||||
{{#args}} ord(smd{{dirName}}),'{{argName}}',TypeInfo({{typeSource}}){{#isArgLast}}]);{{/isArgLast}}{{^isArgLast}},
|
||||
{{/isArgLast}}{{/args}} {{^args}}]);{{/args}}
|
||||
{{/methods}}
|
||||
exit;
|
||||
end;
|
||||
{{/soa.services}}
|
||||
end;
|
||||
|
||||
initialization
|
||||
{{#soa.services}}
|
||||
TInterfaceFactoryDefinition.RegisterInterface(TypeInfo({{interfaceName}}));
|
||||
{{/soa.services}}
|
||||
|
||||
{$endif HASINTERFACERTTI}
|
||||
{{/soa.enabled}}
|
||||
end.
|
Reference in New Issue
Block a user