Accessing properties of classes wrapped with "DelphiInterface" - delphi

I have a FMX project in C++Builder 10.2 Tokyo that is targeted for Android only. I am trying to make use of the Camera2 API. I used the Java2Pas tool to create the Delphi interfaces and classes that I need, combining them into a single Pascal file which I have added to my C++ project.
Parts of this pascal file look like this:
JTextureView_SurfaceTextureListenerClass = interface(JObjectClass)
['{106DB13E-C1B4-4898-B906-0143D97C0075}']
function onSurfaceTextureDestroyed(JSurfaceTextureparam0 : JSurfaceTexture) : boolean; cdecl;// (Landroid/graphics/SurfaceTexture;)Z A: $401
procedure onSurfaceTextureAvailable(JSurfaceTextureparam0 : JSurfaceTexture; Integerparam1 : Integer; Integerparam2 : Integer) ; cdecl;// (Landroid/graphics/SurfaceTexture;II)V A: $401
procedure onSurfaceTextureSizeChanged(JSurfaceTextureparam0 : JSurfaceTexture; Integerparam1 : Integer; Integerparam2 : Integer) ; cdecl;// (Landroid/graphics/SurfaceTexture;II)V A: $401
procedure onSurfaceTextureUpdated(JSurfaceTextureparam0 : JSurfaceTexture) ; cdecl;// (Landroid/graphics/SurfaceTexture;)V A: $401
end;
[JavaSignature('android/view/TextureView_SurfaceTextureListener')]
JTextureView_SurfaceTextureListener = interface(JObject)
['{58A7FBD1-27B9-44AC-B013-F077E1BF5975}']
function onSurfaceTextureDestroyed(JSurfaceTextureparam0 : JSurfaceTexture) : boolean; cdecl;// (Landroid/graphics/SurfaceTexture;)Z A: $401
procedure onSurfaceTextureAvailable(JSurfaceTextureparam0 : JSurfaceTexture; Integerparam1 : Integer; Integerparam2 : Integer) ; cdecl;// (Landroid/graphics/SurfaceTexture;II)V A: $401
procedure onSurfaceTextureSizeChanged(JSurfaceTextureparam0 : JSurfaceTexture; Integerparam1 : Integer; Integerparam2 : Integer) ; cdecl;// (Landroid/graphics/SurfaceTexture;II)V A: $401
procedure onSurfaceTextureUpdated(JSurfaceTextureparam0 : JSurfaceTexture) ; cdecl;// (Landroid/graphics/SurfaceTexture;)V A: $401
end;
TJTextureView_SurfaceTextureListener = class(TJavaGenericImport<JTextureView_SurfaceTextureListenerClass, JTextureView_SurfaceTextureListener>)
end;
The TJTextureView_SurfaceTextureListener interface needs to be used as a callback object, so I added some event handlers to it and changed it to look like this:
TOnSurfaceTextureDestroyed = function(aSurface: JSurfaceTexture): Boolean of object;
TOnSurfaceTextureUpdated = procedure(aSurface: JSurfaceTexture) of object;
TOnSurfaceTextureSize = procedure(aSurface: JSurfaceTexture; aWidth:Integer; aHeight: Integer) of object;
TJTextureView_SurfaceTextureListener = class(TJavaGenericImport<JTextureView_SurfaceTextureListenerClass, JTextureView_SurfaceTextureListener>)
protected
FOnTextureDestroyed: TOnSurfaceTextureDestroyed;
FOnTextureUpdated: TOnSurfaceTextureUpdated;
FOnTextureAvailable: TOnSurfaceTextureSize;
FOnTextureSizeChanged: TOnSurfaceTextureSize;
public
function onSurfaceTextureDestroyed(aSurface : JSurfaceTexture) : boolean; cdecl;
procedure onSurfaceTextureAvailable(aSurface : JSurfaceTexture; aWidth : Integer; aHeight : Integer) ; cdecl;
procedure onSurfaceTextureSizeChanged(aSurface : JSurfaceTexture; aWidth : Integer; aHeight : Integer) ; cdecl;
procedure onSurfaceTextureUpdated(aSurface : JSurfaceTexture) ; cdecl;
property OnTextureDestroyed: TOnSurfaceTextureDestroyed read FOnTextureDestroyed write FOnTextureDestroyed;
property OnTextureUpdated: TOnSurfaceTextureUpdated read FOnTextureUpdated write FOnTextureUpdated;
property OnTextureAvailable: TOnSurfaceTextureSize read FOnTextureAvailable write FOnTextureAvailable;
property OnTextureSizeChanged: TOnSurfaceTextureSize read FOnTextureSizeChanged write FOnTextureSizeChanged;
end;
implementation
{ TJTextureView_SurfaceTextureListener }
procedure TJTextureView_SurfaceTextureListener.onSurfaceTextureAvailable(aSurface: JSurfaceTexture; aWidth, aHeight: Integer);
begin
if Assigned(FOnTextureAvailable) then
FOnTextureAvailable(aSurface, aWidth, aHeight);
end;
function TJTextureView_SurfaceTextureListener.onSurfaceTextureDestroyed(aSurface: JSurfaceTexture): boolean;
begin
if Assigned(FOnTextureDestroyed) then
Result := FOnTextureDestroyed(aSurface)
else
Result := False;
end;
procedure TJTextureView_SurfaceTextureListener.onSurfaceTextureSizeChanged(aSurface: JSurfaceTexture; aWidth, aHeight: Integer);
begin
if Assigned(FOnTextureSizeChanged) then
FOnTextureSizeChanged(aSurface, aWidth, aHeight);
end;
procedure TJTextureView_SurfaceTextureListener.onSurfaceTextureUpdated(aSurface: JSurfaceTexture);
begin
if Assigned(FOnTextureUpdated) then
FOnTextureUpdated(aSurface);
end;
The IDE created the Header file that looks like this:
__interface JTextureView_SurfaceTextureListenerClass;
typedef System::DelphiInterface<JTextureView_SurfaceTextureListenerClass> _di_JTextureView_SurfaceTextureListenerClass;
__interface JTextureView_SurfaceTextureListener;
typedef System::DelphiInterface<JTextureView_SurfaceTextureListener> _di_JTextureView_SurfaceTextureListener;
class DELPHICLASS TJTextureView_SurfaceTextureListener;
__interface INTERFACE_UUID("{106DB13E-C1B4-4898-B906-0143D97C0075}") JTextureView_SurfaceTextureListenerClass : public Androidapi::Jni::Javatypes::JObjectClass
{
virtual bool __cdecl onSurfaceTextureDestroyed(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0) = 0 ;
virtual void __cdecl onSurfaceTextureAvailable(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0, int Integerparam1, int Integerparam2) = 0 ;
virtual void __cdecl onSurfaceTextureSizeChanged(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0, int Integerparam1, int Integerparam2) = 0 ;
virtual void __cdecl onSurfaceTextureUpdated(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0) = 0 ;
};
__interface INTERFACE_UUID("{58A7FBD1-27B9-44AC-B013-F077E1BF5975}") JTextureView_SurfaceTextureListener : public Androidapi::Jni::Javatypes::JObject
{
virtual bool __cdecl onSurfaceTextureDestroyed(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0) = 0 ;
virtual void __cdecl onSurfaceTextureAvailable(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0, int Integerparam1, int Integerparam2) = 0 ;
virtual void __cdecl onSurfaceTextureSizeChanged(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0, int Integerparam1, int Integerparam2) = 0 ;
virtual void __cdecl onSurfaceTextureUpdated(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture JSurfaceTextureparam0) = 0 ;
};
typedef bool __fastcall (__closure *TOnSurfaceTextureDestroyed)(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface);
typedef void __fastcall (__closure *TOnSurfaceTextureUpdated)(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface);
typedef void __fastcall (__closure *TOnSurfaceTextureSize)(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface, int aWidth, int aHeight);
class PASCALIMPLEMENTATION TJTextureView_SurfaceTextureListener : public Androidapi::Jnibridge::TJavaGenericImport__2<_di_JTextureView_SurfaceTextureListenerClass,_di_JTextureView_SurfaceTextureListener>
{
typedef Androidapi::Jnibridge::TJavaGenericImport__2<_di_JTextureView_SurfaceTextureListenerClass,_di_JTextureView_SurfaceTextureListener> inherited;
protected:
TOnSurfaceTextureDestroyed FOnTextureDestroyed;
TOnSurfaceTextureUpdated FOnTextureUpdated;
TOnSurfaceTextureSize FOnTextureAvailable;
TOnSurfaceTextureSize FOnTextureSizeChanged;
public:
bool __cdecl onSurfaceTextureDestroyed(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface);
void __cdecl onSurfaceTextureAvailable(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface, int aWidth, int aHeight);
void __cdecl onSurfaceTextureSizeChanged(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface, int aWidth, int aHeight);
void __cdecl onSurfaceTextureUpdated(Androidapi::Jni::Graphicscontentviewtext::_di_JSurfaceTexture aSurface);
__property TOnSurfaceTextureDestroyed OnTextureDestroyed = {read=FOnTextureDestroyed, write=FOnTextureDestroyed};
__property TOnSurfaceTextureUpdated OnTextureUpdated = {read=FOnTextureUpdated, write=FOnTextureUpdated};
__property TOnSurfaceTextureSize OnTextureAvailable = {read=FOnTextureAvailable, write=FOnTextureAvailable};
__property TOnSurfaceTextureSize OnTextureSizeChanged = {read=FOnTextureSizeChanged, write=FOnTextureSizeChanged};
public:
/* TObject.Create */ inline __fastcall TJTextureView_SurfaceTextureListener(void) : Androidapi::Jnibridge::TJavaGenericImport__2<_di_JTextureView_SurfaceTextureListenerClass,_di_JTextureView_SurfaceTextureListener> () { }
/* TObject.Destroy */ inline __fastcall virtual ~TJTextureView_SurfaceTextureListener(void) { }
};
Inside my C++ code, I am trying to use it like this:
_di_JTextureView_SurfaceTextureListener = TJTextureView_SurfaceTextureListener::JavaClass->init();
SurfaceTextureListener->OnTextureAvailable = SetupCamera;
But the compiler gives me an error:
no member named 'OnTextureAvailable' in 'Androidcamera2::JTextureView_SurfaceTextureListener'
Can anyone tell me what I am doing wrong here?

You're getting the error message because the JTextureView_SurfaceTextureListener interface does not have the OnTextureAvailable property.
The idea here is that the JTextureView_SurfaceTextureListener interface is the callback, and you should implement the JTextureView_SurfaceTextureListener interface in your own object. Then, in your onSurfaceTextureAvailable implementation, you call SetupCamera.
Note that you'll have to call TextureView.setSurfaceTextureListener and pass an instance of your JTextureView_SurfaceTextureListener instance in order to register your listener.

Related

How to get interface from C dll to Delphi?

I have a library written in C and I have a header file with a description of the interface in C. The DLL has a function to get this interface. How to describe it correctly and get it in the DELPHI application?
using DllCallbackClassPtr = void*;
using DllCallbackFunction = void(*)(const char *, DllCallbackClassPtr);
#ifdef _WIN32
#include <Windows.h>
__interface IXeoma
{
public:
enum ConnectErrorCode {
OK = 0,
SERVER_NOT_FOUND,
WRONG_PASSWORD,
UNKNOWN
};
// return ConnectErrorCode
virtual int start(const char* connectionString) = 0;
virtual bool isConnected() = 0;
virtual void stop() = 0;
virtual void requestData(const char* request, const char* additionalData, DllCallbackClassPtr classPtr, DllCallbackFunction callbackFunc) = 0;
virtual const char* getRequestResult(const char* request) = 0;
virtual void setCameraRenderHandle(const char* previewId, HWND hWnd) = 0;
};
The library is loaded, but the function returns nil.
type
IXeoma = interface
function Start(connectionString: PChar): integer;
end;
type
TCreateXeomaInterface = function() : IXeoma; stdcall;
var
Form1: TForm1;
CreateXeomaInterface: TCreateXeomaInterface;
implementation
{$R *.dfm}
var
LibraryHandle: THandle;
procedure TForm1.Button1Click(Sender: TObject);
var
XeomaInt: IXeoma;
i: integer;
begin
LibraryHandle := LoadLibrary(PChar('D:\Projects\XeomaSDK\Win32\Debug\xeomaclientdll.dll'));
if LibraryHandle >= 32 then
begin
#CreateXeomaInterface := GetProcAddress(LibraryHandle, 'createXeomaInterface');
end;
XeomaInt := CreateXeomaInterface();
// Here XeomaInt = nil
end;
The __interface extension in Visual C++, and the interface keyword in Delphi, are not the same thing, and are not compatible with each other.
IXeoma in the C++ code is just an ordinary class type, not a COM interface. But in Delphi, all interfaces derive from IUnknown, and all classes derive from TObject, neither of which you want in this situation. So, you are going to have to use a plain record instead, and declare TCreateXeomaInterface as returning a pointer to that record.
Also, note that a Delphi record can't have virtual methods, but the C++ class does have them, so you are going to have to manually account for the C++ class's vtable in Delphi.
Try something like this:
type
DllCallbackClassPtr = Pointer;
DllCallbackFunction = procedure(Param1: PAnsiChar; Param2: DllCallbackClassPtr); cdecl;
IXeomaPtr = ^IXeoma;
IXeomaVTable = record
start: function(_Self: IXeomaPtr; connectionString: PAnsiChar): Integer; cdecl;
isConnected: function(_Self: IXeomaPtr): Boolean; cdecl;;
stop: procedure(_Self: IXeomaPtr); cdecl;
requestData: procedure(_Self: IXeomaPtr; request: PAnsiChar; additionalData: PAnsiChar; classPtr: DllCallbackClassPtr; callbackFunc: DllCallbackFunction); cdecl;
getRequestResult: function(_Self: IXeomaPtr; request: PAnsiChar): PAnsiChar; cdecl;
setCameraRenderHandle: procedure(_Self: IXeomaPtr; previewId: PAnsiChar; hWnd: HWND); cdecl;
end;
ConnectErrorCode = (
OK = 0,
SERVER_NOT_FOUND,
WRONG_PASSWORD,
UNKNOWN
);
IXeoma = record
vtable: ^IXeomaVTable:
end;
type
TCreateXeomaInterface = function() : IXeomaPtr; stdcall;
var
Form1: TForm1;
CreateXeomaInterface: TCreateXeomaInterface;
implementation
{$R *.dfm}
var
LibraryHandle: THandle;
procedure TForm1.Button1Click(Sender: TObject);
var
XeomaInt: IXeomaPtr;
i: integer;
begin
XeomaInt := nil;
LibraryHandle := LoadLibrary('D:\Projects\XeomaSDK\Win32\Debug\xeomaclientdll.dll');
if LibraryHandle >= 32 then
begin
#CreateXeomaInterface := GetProcAddress(LibraryHandle, 'createXeomaInterface');
XeomaInt := CreateXeomaInterface();
if XeomaInt <> nil then
XeomaInt^.vtable^.start(XeomaInt, '123:123#localhost:8090');
end;
...
end;

E2015 Operator not applicable to this operand type (Delphi 10.2)

Like in the Java Collection interface definition, I want to create a list type, which addItems/removeItems get a validator parameter to filter the items before addition/deletion.
The very necessary code snippet:
IListItemValidator<T> = interface
['{79E22756-9EC5-40C5-A958-0AA04F6F1A79}']
function validateItem( item_ : T ) : boolean;
end;
IList<T> = interface
['{DC051351-D7B7-48BB-984E-A0D9978A02C1}']
function getCount : cardinal;
function itemAt( ndx_ : cardinal ) : T;
function addItems( list_ : ILIst<T>; validator_ : IListItemValidator<T> = NIL );
end;
TList<T> = class ( TInterfacedObject, IList<T> )
private
fCount : cardinal;
fItems : TArray<T>;
public
function getCount : cardinal;
function getItemAt( ndx_ : cardinal ) : T;
function addItems( list_ : ILIst<T>; validator_ : IListItemValidator<T> = NIL );
function TList<T>.getCount : cardinal;
begin
result := fCount;
end;
function TList<T>.getItemAt( ndx_ : cardinal ) : T;
begin
if ( ndx_ < fCount ) then
result := fItems[ndx_]
else
;//raise...
end;
function TList<T>.addItems( list_ : ILIst<T>; validator_ : IListItemValidator<T> = NIL );
var
i : integer;
item : T;
begin
if ( list_ <> NIL ) then
for i := 0 to list_.getCount-1 do
begin
item := list_.getItemAt( i );
if ( ( validator_ = NIL ) or validator_.validateItem( item ) ) then
//addItem
else
result := -1;
end
else
;//raise...
end;
How should I define a TListItemValidator if I want to add items with value larger then 4? (for example)
The anonymous function parameterized overloaded addItems/removeItems methods just work fine but how can I create the generic interface based solution?
No one variation compiles:
The first one (it is clear. the T is not compatible with System.Integer)
TListItemValidator<T> = class ( TInterfacedObject, IListItemValidator<T> )
public
function validateItem( item_ : T ) : boolean;
end;
function TListItemValidator<T>.validateItem( item_ : T ) : boolean;
begin
result := item_ > 5;
end;
The second one (i tried to use integer directly):
TListItemValidator<integer> = class ( TInterfacedObject, IListItemValidator<integer> )
public
function validateItem( item_ : integer ) : boolean;
end;
function TListItemValidator<integer>.validateItem( item_ : integer ) : boolean;
begin
result := item_ > 5;
end;
The compilation error:
E2015 Operator not applicable to this operand type
I understand the reason : the 'integer' in the 'TListItemValidator'is just like 'T' in the first example, just the type placeholder. But how could I create a working validator for integer values?
Your two variants are in fact identical in meaning:
TListItemValidator<T> = class ( TInterfacedObject, IListItemValidator<T> )
public
function validateItem( item_ : T ) : boolean;
end;
TListItemValidator<integer> = class ( TInterfacedObject, IListItemValidator<integer> )
public
function validateItem( item_ : integer ) : boolean;
end;
They are both generic types. The only difference is cosmetic, namely the name of the generic parameter. You might have given the generic parameter the name integer, but that is just a name, in this context.
What you need is a concrete class that implements IListItemValidator<integer>. Something like this:
type
TIntegerListItemValidator = class ( TInterfacedObject, IListItemValidator<integer> )
function validateItem( item_ : integer ) : boolean;
end;
function TIntegerListItemValidator.validateItem( item_ : integer ) : boolean;
begin
result := item_ > 4;
end;
OK. I found the solution in the same time when David send his comment.
I modified the validator definition:
IListItemValidator = interface
[...]
function validateItem( const item_ ) : boolean;
end;
TIntegerListItemValidator = class ( TInterfacedObject, IListItemValidator )
function validateItem( const item_ ) : boolean;
end;
function TIntegerListItemValidator.validateItem( const item_ ) : boolean;
begin
result := integer( item_ ) > 4;
end;

Why I receive Invoke error: method not found

I try to integrate in Delphi appsFlyer (android)
public abstract interface AppsFlyerConversionListener
{
#WorkerThread
public abstract void onInstallConversionDataLoaded(Map<String, String> paramMap);
public abstract void onInstallConversionFailure(String paramString);
#WorkerThread
public abstract void onAppOpenAttribution(Map<String, String> paramMap);
public abstract void onAttributionFailure(String paramString);
}
public class AppsFlyerLib implements a
{
public static AppsFlyerLib getInstance() {...}
public AppsFlyerLib init(String paramString, AppsFlyerConversionListener paramAppsFlyerConversionListener) {...}
public AppsFlyerLib init(String paramString, AppsFlyerConversionListener paramAppsFlyerConversionListener, Context paramContext) {...}
}
so i translate thoses class in delphi like this :
{*******************************************************}
JAppsFlyerConversionListenerClass = interface(IJavaClass)
['{FE22E5D8-EF6E-44DE-AE27-45C224FF4E06}']
end;
{**********************************************************}
[JavaSignature('com/appsflyer/AppsFlyerConversionListener')]
JAppsFlyerConversionListener = interface(IJavaInstance)
['{698F89B7-7DD7-4F32-B196-BEE4E16FBD36}']
procedure onAppOpenAttribution(conversionData: JMap); cdecl;
procedure onAttributionFailure(errorMessage: JString); cdecl;
procedure onInstallConversionDataLoaded(conversionData: JMap); cdecl;
procedure onInstallConversionFailure(errorMessage: JString); cdecl;
end;
TJAppsFlyerConversionListener = class(TJavaGenericImport<JAppsFlyerConversionListenerClass, JAppsFlyerConversionListener>) end;
{****************************************}
JAppsFlyerLibClass = interface(IJavaClass)
['{B2787D1A-BDFB-41A3-B876-05148C26FF3F}']
{class} function getInstance: JAppsFlyerLib; cdecl;
end;
{*******************************************}
[JavaSignature('com/appsflyer/AppsFlyerLib')]
JAppsFlyerLib = interface(IJavaInstance)
['{F8676840-7A1B-4BA7-BFFD-362668E9927A}']
function init(key: JString; conversionListener: JAppsFlyerConversionListener): JAppsFlyerLib; cdecl; overload;
function init(key: JString; conversionListener: JAppsFlyerConversionListener; context: JContext): JAppsFlyerLib; cdecl; overload;
end;
TJAppsFlyerLib = class(TJavaGenericImport<JAppsFlyerLibClass, JAppsFlyerLib>) end;
and I implemente the JAppsFlyerConversionListener like this :
TAppsFlyerConversionListener= class(TJavaLocal, JAppsFlyerConversionListener)
private
public
procedure onAppOpenAttribution(conversionData: JMap); cdecl;
procedure onAttributionFailure(errorMessage: JString); cdecl;
procedure onInstallConversionDataLoaded(conversionData: JMap); cdecl;
procedure onInstallConversionFailure(errorMessage: JString); cdecl;
end;
but now when i call :
FAppsFlyerConversionListener := TAppsFlyerConversionListener.create;
TJAppsFlyerLib.JavaClass.getInstance.init(StringToJstring('xxxxx'), FAppsFlyerConversionListener, TAndroidHelper.Context.getApplicationContext);
I receive :
Invoke error: method not found
any idea why ?
NOTE: even doing TJAppsFlyerLib.JavaClass.getInstance.init(nil, nil, nil) return me
Invoke error: method not found
NOTE2: I don't know if it's matter but we have also the function init in JObjectClass :
JObjectClass = interface(IJavaClass)
['{83BD30EE-FE9B-470D-AD6C-23AEAABB7FFA}']
{class} function init: JObject; cdecl;
end;

Delphi XE6 E2008 on Inherited

I encountered some error for which i just can't find a proper hint on the net. Hopefully one of you can point me to the right direction.
Simple Problem: I've got a class inheriting from TObject. I've got a constructor named Create and i want to call Inherited on the very first line of the very only constructor.
Does not work!
On compile i get a
[dcc32 Fehler] ULSRAware.pas(58): E2008 Inkompatible Typen
If I comment the inherited out it compiles fine but on runtime on creating the object, while I can access methods regulary (like some private _InitAdo method), every access to a property yields an access violation error.
I guess it's coming from calling the inherited nonetheless but without any sufficient success.
This is the declaration at the head of the Unit. Just to mention it, it's just this class in the unit. And of course in the implementation section the implementation.
type TLAConnect = class( TObject )
private
_mailHost : String;
_mailPort : Integer;
_mailUsername : String;
_mailPassword : String;
_mailAddress : String;
_sql_script_sms : String;
_sql_script_mail: String;
_sms_mail_addon : String;
//connection : TADOConnection;
(*
procedure SendMessage( recp:String; subj, body : String );
procedure _InitAdo( config_filename : String; path: String );
function GetMsgId( msg : String ) : Integer;
function GetMsgIdFromByteBit( byte, bit : String ) : Integer;
function ProcessMessage( msgId : Integer ): String;
procedure Trigger( msgId : Integer );
procedure QuittMsg( msgId : Integer );
procedure MakeMessage( _msgid : Integer; _fsms, _fmail : Boolean; _smsgl, _smsgs : String );
function CreateNewByteTrigger( byte, bit : String ) : Integer;
*)
public
Constructor Create( config : String );
Destructor Destroy; override;
//function Call( msg:String ) : Boolean;
end;
And the implementation of the constructor and the desctructor.
Constructor TLAConnect.Create( config : String );
begin
inherited.Create;
//self._InitAdo( config, 'lsraware ado' );
_mailHost := 'blabla';
_mailPort := 587;
_mailUsername := 'blabla_user';
_mailPassword := 'blabla_pass';
_mailAddress := 'blabal';
end;
Destructor TLAConnect.Destroy;
begin
self.connection.Free;
Inherited;
end;

Pascal understanding

So assume this code work.
{***Start declaration of TMakeProd ***}
TListMakeProd = class (TListNF)
procedure SortProcProdSeqNum;
procedure LoadFromRep(aFileRep, aNo : String);
function Find(aMakeProdID : Integer) : TMakeProd;
function FindObj(aMakeProd : TMakeProd) : TMakeProd;
end;
TMakeProd = class (TProduct)
private
FMakeProductID : Integer;
FProdLotSize : Longint;
public
LiProcProd : TListProcProd;
{Load from a database.}
{ procedure SortLiProcProdSeqNum; }
constructor Init(aMakeProductID: Integer; aProdLotSize: Longint);
destructor Done; override;
destructor Destroy; override;
property MakeProductID : Integer read FMakeProductID write FMakeProductID ;
property ProdLotSize : Longint read FProdLotSize write FProdLotSize ;
function findNextProcProd(aProcProd: TProcProd) : TProcProd;
{ create function with return if required. }
end;
What I don't understand is this declaration LiProcProd : TListProcProd;
I know that TListProcProd is a class, everything else I understand it but this part I don't also this is just a class declaration and assume all the class have been properly declared
type
TMakeProd = class(TProduct)
....
LiProcProd : TListProcProd;
....
end;
In this declaration, LiProcProd is a public field. This is described by the documentation.

Resources