84 lines
2.5 KiB
ObjectPascal
84 lines
2.5 KiB
ObjectPascal
/// SOA interface methods definition to circumvent FPC missing RTTI
|
|
// - generated at 2016-07-27 09:30:40
|
|
unit mORMotRESTFPCInterfaces;
|
|
|
|
{
|
|
WARNING:
|
|
This unit has been generated by a mORMot 1.18.2797 server.
|
|
Any manual modification of this file may be lost after regeneration.
|
|
|
|
Synopse mORMot framework. Copyright (C) 2022 Arnaud Bouchez
|
|
Synopse Informatique - https://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 mORMotRESTFPCInterfaces unit to your uses clause, so that the following
|
|
interfaces would be defined as expected by mORMot under FPC:
|
|
|
|
- IRestMethods
|
|
|
|
}
|
|
|
|
interface
|
|
|
|
{$I Synopse.inc} // needed for setting HASINTERFACERTTI and proper FPC modes
|
|
|
|
uses
|
|
SysUtils,
|
|
Classes,
|
|
SynCommons,
|
|
SynLog,
|
|
mORMot,
|
|
RestMethodsInterfaceUnit;
|
|
|
|
|
|
implementation
|
|
|
|
{$ifndef HASINTERFACERTTI} // circumvent old FPC bug of missing RTTI
|
|
|
|
{ TInterfaceFactoryDefinition }
|
|
|
|
type
|
|
/// define and manage missing interface RTTI for the following interfaces:
|
|
// - IRestMethods
|
|
TInterfaceFactoryDefinition = class(TInterfaceFactoryGenerated)
|
|
protected
|
|
procedure AddMethodsFromTypeInfo(aInterface: PTypeInfo); override;
|
|
end;
|
|
|
|
procedure TInterfaceFactoryDefinition.AddMethodsFromTypeInfo(aInterface: PTypeInfo);
|
|
begin
|
|
if aInterface=TypeInfo(IRestMethods) then begin
|
|
AddMethod('HelloWorld',[
|
|
ord(smdresult),'Result',TypeInfo(AnsiString)]);
|
|
AddMethod('Sum',[
|
|
ord(smdconst),'val1',TypeInfo(Double),
|
|
ord(smdconst),'val2',TypeInfo(Double),
|
|
ord(smdresult),'Result',TypeInfo(Double)]);
|
|
AddMethod('GetCustomRecord',[
|
|
ord(smdresult),'Result',TypeInfo(rCustomRecord)]);
|
|
AddMethod('SendCustomRecord',[
|
|
ord(smdconst),'CustomResult',TypeInfo(rCustomRecord),
|
|
ord(smdresult),'Result',TypeInfo(Boolean)]);
|
|
AddMethod('SendMultipleCustomRecords',[
|
|
ord(smdconst),'CustomResult',TypeInfo(rCustomRecord),
|
|
ord(smdconst),'CustomComplicatedRecord',TypeInfo(rCustomComplicatedRecord),
|
|
ord(smdresult),'Result',TypeInfo(Boolean)]);
|
|
AddMethod('GetMethodCustomResult',[
|
|
ord(smdresult),'Result',TypeInfo(TServiceCustomAnswer)]);
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
initialization
|
|
TInterfaceFactoryDefinition.RegisterInterface(TypeInfo(IRestMethods));
|
|
|
|
{$endif HASINTERFACERTTI}
|
|
end.
|