unit Chilkat.SFtpDir;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TSFtpDir wraps CkSFtpDir via the C bridge layer. }
  TSFtpDir = 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  GetNumFilesAndDirs: Integer;
    function  GetOriginalPath: string;
  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 NumFilesAndDirs: Integer read GetNumFilesAndDirs;
    property OriginalPath: string read GetOriginalPath;

    function  GetFilename(index: Integer): string;
    procedure Sort(const field: string; ascending: Boolean);
    function  FileAt(index: Integer; fileObj: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkSFtpDir_Create  = function(): Pointer; cdecl;
  TCkSFtpDir_Dispose = procedure(handle: Pointer); cdecl;
  TCkSFtpDir_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSFtpDir_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSFtpDir_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSFtpDir_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSFtpDir_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSFtpDir_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSFtpDir_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkSFtpDir_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSFtpDir_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkSFtpDir_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSFtpDir_get_NumFilesAndDirs = function(handle: Pointer): Integer; cdecl;
  TCkSFtpDir_get_OriginalPath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSFtpDir_GetFilename = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkSFtpDir_Sort = procedure(handle: Pointer; field: PAnsiChar; ascending: LongBool); cdecl;
  TCkSFtpDir_FileAt = function(handle: Pointer; index: Integer; fileObj: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkSFtpDir_Create:  TCkSFtpDir_Create  = nil;
  CkSFtpDir_Dispose: TCkSFtpDir_Dispose = nil;
  CkSFtpDir_get_LastErrorHtml: TCkSFtpDir_get_LastErrorHtml = nil;
  CkSFtpDir_get_LastErrorText: TCkSFtpDir_get_LastErrorText = nil;
  CkSFtpDir_get_LastErrorXml: TCkSFtpDir_get_LastErrorXml = nil;
  CkSFtpDir_get_Version: TCkSFtpDir_get_Version = nil;
  CkSFtpDir_get_DebugLogFilePath: TCkSFtpDir_get_DebugLogFilePath = nil;
  CkSFtpDir_put_DebugLogFilePath: TCkSFtpDir_put_DebugLogFilePath = nil;
  CkSFtpDir_get_VerboseLogging: TCkSFtpDir_get_VerboseLogging = nil;
  CkSFtpDir_put_VerboseLogging: TCkSFtpDir_put_VerboseLogging = nil;
  CkSFtpDir_get_LastMethodSuccess: TCkSFtpDir_get_LastMethodSuccess = nil;
  CkSFtpDir_put_LastMethodSuccess: TCkSFtpDir_put_LastMethodSuccess = nil;
  CkSFtpDir_get_NumFilesAndDirs: TCkSFtpDir_get_NumFilesAndDirs = nil;
  CkSFtpDir_get_OriginalPath: TCkSFtpDir_get_OriginalPath = nil;
  CkSFtpDir_GetFilename: TCkSFtpDir_GetFilename = nil;
  CkSFtpDir_Sort: TCkSFtpDir_Sort = nil;
  CkSFtpDir_FileAt: TCkSFtpDir_FileAt = nil;

constructor TSFtpDir.Create;
begin
  inherited Create;
  FHandle := CkSFtpDir_Create();
end;

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

function TSFtpDir.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkSFtpDir_get_LastErrorHtml(FHandle));
end;

function TSFtpDir.GetLastErrorText: string;
begin
  Result := CkToStr(CkSFtpDir_get_LastErrorText(FHandle));
end;

function TSFtpDir.GetLastErrorXml: string;
begin
  Result := CkToStr(CkSFtpDir_get_LastErrorXml(FHandle));
end;

function TSFtpDir.GetVersion: string;
begin
  Result := CkToStr(CkSFtpDir_get_Version(FHandle));
end;

function TSFtpDir.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkSFtpDir_get_DebugLogFilePath(FHandle));
end;

procedure TSFtpDir.SetDebugLogFilePath(AValue: string);
begin
  CkSFtpDir_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSFtpDir.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkSFtpDir_get_VerboseLogging(FHandle));
end;

procedure TSFtpDir.SetVerboseLogging(AValue: Boolean);
begin
  CkSFtpDir_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TSFtpDir.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkSFtpDir_get_LastMethodSuccess(FHandle));
end;

procedure TSFtpDir.SetLastMethodSuccess(AValue: Boolean);
begin
  CkSFtpDir_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TSFtpDir.GetNumFilesAndDirs: Integer;
begin
  Result := CkSFtpDir_get_NumFilesAndDirs(FHandle);
end;

function TSFtpDir.GetOriginalPath: string;
begin
  Result := CkToStr(CkSFtpDir_get_OriginalPath(FHandle));
end;

function TSFtpDir.GetFilename(index: Integer): string;
begin
  Result := CkToStr(CkSFtpDir_GetFilename(FHandle, index));
end;

procedure TSFtpDir.Sort(const field: string; ascending: Boolean);
begin
  CkSFtpDir_Sort(FHandle, PAnsiChar(StrToCk(field)), LongBool(ascending));
end;

function TSFtpDir.FileAt(index: Integer; fileObj: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSFtpDir_FileAt(FHandle, index, fileObj.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkSFtpDir_Create,  'CkSFtpDir_Create');
  Chilkat_GetProcedureAddress(CkSFtpDir_Dispose, 'CkSFtpDir_Dispose');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_LastErrorHtml, 'CkSFtpDir_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_LastErrorText, 'CkSFtpDir_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_LastErrorXml, 'CkSFtpDir_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_Version, 'CkSFtpDir_get_Version');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_DebugLogFilePath, 'CkSFtpDir_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSFtpDir_put_DebugLogFilePath, 'CkSFtpDir_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_VerboseLogging, 'CkSFtpDir_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSFtpDir_put_VerboseLogging, 'CkSFtpDir_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_LastMethodSuccess, 'CkSFtpDir_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSFtpDir_put_LastMethodSuccess, 'CkSFtpDir_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_NumFilesAndDirs, 'CkSFtpDir_get_NumFilesAndDirs');
  Chilkat_GetProcedureAddress(CkSFtpDir_get_OriginalPath, 'CkSFtpDir_get_OriginalPath');
  Chilkat_GetProcedureAddress(CkSFtpDir_GetFilename, 'CkSFtpDir_GetFilename');
  Chilkat_GetProcedureAddress(CkSFtpDir_Sort, 'CkSFtpDir_Sort');
  Chilkat_GetProcedureAddress(CkSFtpDir_FileAt, 'CkSFtpDir_FileAt');

end.
