unit Chilkat.ServerSentEvent;

{
  Pascal wrapper for Chilkat ServerSentEvent.
  Auto-generated by PascalWrapperGenerator -- do not edit manually.
}

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TServerSentEvent wraps CkServerSentEvent via the C bridge layer. }
  TServerSentEvent = class(TChilkatBase)
  private
    function  GetLastErrorHtml: string;
    function  GetLastErrorText: string;
    function  GetLastErrorXml: string;
    function  GetVersion: string;
    function  GetDebugLogFilePath: string;
    procedure SetDebugLogFilePath(AValue: string);
    function  GetVerboseLogging: Boolean;
    procedure SetVerboseLogging(AValue: Boolean);
    function  GetLastMethodSuccess: Boolean;
    procedure SetLastMethodSuccess(AValue: Boolean);
    function  GetData: string;
    function  GetEventName: string;
    function  GetLastEventId: string;
    function  GetRetry: Integer;
  public
    constructor Create;
    destructor  Destroy; override;

    property LastErrorHtml: string read GetLastErrorHtml;
    property LastErrorText: string read GetLastErrorText;
    property LastErrorXml: string read GetLastErrorXml;
    property Version: string read GetVersion;
    property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;
    property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;
    property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;
    property Data: string read GetData;
    property EventName: string read GetEventName;
    property LastEventId: string read GetLastEventId;
    property Retry: Integer read GetRetry;

    function  LoadEvent(const eventText: string): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkServerSentEvent_Create  = function(): Pointer; cdecl;
  TCkServerSentEvent_Dispose = procedure(handle: Pointer); cdecl;
  TCkServerSentEvent_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkServerSentEvent_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkServerSentEvent_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkServerSentEvent_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkServerSentEvent_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkServerSentEvent_get_Data = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_EventName = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_LastEventId = function(handle: Pointer): PAnsiChar; cdecl;
  TCkServerSentEvent_get_Retry = function(handle: Pointer): Integer; cdecl;
  TCkServerSentEvent_LoadEvent = function(handle: Pointer; eventText: PAnsiChar): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkServerSentEvent_Create:  TCkServerSentEvent_Create  = nil;
  CkServerSentEvent_Dispose: TCkServerSentEvent_Dispose = nil;
  CkServerSentEvent_get_LastErrorHtml: TCkServerSentEvent_get_LastErrorHtml = nil;
  CkServerSentEvent_get_LastErrorText: TCkServerSentEvent_get_LastErrorText = nil;
  CkServerSentEvent_get_LastErrorXml: TCkServerSentEvent_get_LastErrorXml = nil;
  CkServerSentEvent_get_Version: TCkServerSentEvent_get_Version = nil;
  CkServerSentEvent_get_DebugLogFilePath: TCkServerSentEvent_get_DebugLogFilePath = nil;
  CkServerSentEvent_put_DebugLogFilePath: TCkServerSentEvent_put_DebugLogFilePath = nil;
  CkServerSentEvent_get_VerboseLogging: TCkServerSentEvent_get_VerboseLogging = nil;
  CkServerSentEvent_put_VerboseLogging: TCkServerSentEvent_put_VerboseLogging = nil;
  CkServerSentEvent_get_LastMethodSuccess: TCkServerSentEvent_get_LastMethodSuccess = nil;
  CkServerSentEvent_put_LastMethodSuccess: TCkServerSentEvent_put_LastMethodSuccess = nil;
  CkServerSentEvent_get_Data: TCkServerSentEvent_get_Data = nil;
  CkServerSentEvent_get_EventName: TCkServerSentEvent_get_EventName = nil;
  CkServerSentEvent_get_LastEventId: TCkServerSentEvent_get_LastEventId = nil;
  CkServerSentEvent_get_Retry: TCkServerSentEvent_get_Retry = nil;
  CkServerSentEvent_LoadEvent: TCkServerSentEvent_LoadEvent = nil;

constructor TServerSentEvent.Create;
begin
  inherited Create;
  FHandle := CkServerSentEvent_Create();
end;

destructor TServerSentEvent.Destroy;
begin
  if FHandle <> nil then
    CkServerSentEvent_Dispose(FHandle);
  FHandle := nil;
  inherited;
end;

function TServerSentEvent.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkServerSentEvent_get_LastErrorHtml(FHandle));
end;

function TServerSentEvent.GetLastErrorText: string;
begin
  Result := CkToStr(CkServerSentEvent_get_LastErrorText(FHandle));
end;

function TServerSentEvent.GetLastErrorXml: string;
begin
  Result := CkToStr(CkServerSentEvent_get_LastErrorXml(FHandle));
end;

function TServerSentEvent.GetVersion: string;
begin
  Result := CkToStr(CkServerSentEvent_get_Version(FHandle));
end;

function TServerSentEvent.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkServerSentEvent_get_DebugLogFilePath(FHandle));
end;

procedure TServerSentEvent.SetDebugLogFilePath(AValue: string);
begin
  CkServerSentEvent_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TServerSentEvent.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkServerSentEvent_get_VerboseLogging(FHandle));
end;

procedure TServerSentEvent.SetVerboseLogging(AValue: Boolean);
begin
  CkServerSentEvent_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TServerSentEvent.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkServerSentEvent_get_LastMethodSuccess(FHandle));
end;

procedure TServerSentEvent.SetLastMethodSuccess(AValue: Boolean);
begin
  CkServerSentEvent_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TServerSentEvent.GetData: string;
begin
  Result := CkToStr(CkServerSentEvent_get_Data(FHandle));
end;

function TServerSentEvent.GetEventName: string;
begin
  Result := CkToStr(CkServerSentEvent_get_EventName(FHandle));
end;

function TServerSentEvent.GetLastEventId: string;
begin
  Result := CkToStr(CkServerSentEvent_get_LastEventId(FHandle));
end;

function TServerSentEvent.GetRetry: Integer;
begin
  Result := CkServerSentEvent_get_Retry(FHandle);
end;

function TServerSentEvent.LoadEvent(const eventText: string): Boolean;
begin
  Result := Boolean(CkServerSentEvent_LoadEvent(FHandle, PAnsiChar(StrToCk(eventText))));
end;

initialization
  Chilkat_GetProcedureAddress(CkServerSentEvent_Create,  'CkServerSentEvent_Create');
  Chilkat_GetProcedureAddress(CkServerSentEvent_Dispose, 'CkServerSentEvent_Dispose');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_LastErrorHtml, 'CkServerSentEvent_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_LastErrorText, 'CkServerSentEvent_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_LastErrorXml, 'CkServerSentEvent_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_Version, 'CkServerSentEvent_get_Version');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_DebugLogFilePath, 'CkServerSentEvent_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkServerSentEvent_put_DebugLogFilePath, 'CkServerSentEvent_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_VerboseLogging, 'CkServerSentEvent_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkServerSentEvent_put_VerboseLogging, 'CkServerSentEvent_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_LastMethodSuccess, 'CkServerSentEvent_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkServerSentEvent_put_LastMethodSuccess, 'CkServerSentEvent_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_Data, 'CkServerSentEvent_get_Data');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_EventName, 'CkServerSentEvent_get_EventName');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_LastEventId, 'CkServerSentEvent_get_LastEventId');
  Chilkat_GetProcedureAddress(CkServerSentEvent_get_Retry, 'CkServerSentEvent_get_Retry');
  Chilkat_GetProcedureAddress(CkServerSentEvent_LoadEvent, 'CkServerSentEvent_LoadEvent');

end.
