unit Chilkat.StringTable;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TStringTable wraps CkStringTable via the C bridge layer. }
  TStringTable = 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  GetCount: 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 Count: Integer read GetCount;

    function  AppendFromFile(maxLineLen: Integer; const charset: string; const path: string): Boolean;
    function  Append(const value: string): Boolean;
    function  StringAt(index: Integer): string;
    function  SaveToFile(const charset: string; bCrlf: Boolean; const path: string): Boolean;
    function  SplitAndAppend(const inStr: string; const delimiterChar: string; exceptDoubleQuoted: Boolean; exceptEscaped: Boolean): Boolean;
    function  AppendFromSb(sb: TChilkatBase): Boolean;
    procedure Clear;
    function  IntAt(index: Integer): Integer;
    function  FindSubstring(startIndex: Integer; const substr: string; caseSensitive: Boolean): Integer;
    function  Sort(ascending: Boolean; caseSensitive: Boolean): Boolean;
    function  GetStrings(startIdx: Integer; count: Integer; crlf: Boolean): string;
    function  FindMatch(sb: TChilkatBase; caseSensitive: Boolean): Integer;
    function  WordFollowing(sb: TChilkatBase; captureEmailAddr: Boolean; sbWord: TChilkatBase): Integer;
    function  StringAtSb(index: Integer; sb: TChilkatBase): Boolean;
    function  ToSb(sb: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkStringTable_Create  = function(): Pointer; cdecl;
  TCkStringTable_Dispose = procedure(handle: Pointer); cdecl;
  TCkStringTable_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkStringTable_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkStringTable_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkStringTable_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkStringTable_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkStringTable_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkStringTable_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkStringTable_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkStringTable_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkStringTable_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkStringTable_get_Count = function(handle: Pointer): Integer; cdecl;
  TCkStringTable_AppendFromFile = function(handle: Pointer; maxLineLen: Integer; charset: PAnsiChar; path: PAnsiChar): LongBool; cdecl;
  TCkStringTable_Append = function(handle: Pointer; value: PAnsiChar): LongBool; cdecl;
  TCkStringTable_StringAt = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkStringTable_SaveToFile = function(handle: Pointer; charset: PAnsiChar; bCrlf: LongBool; path: PAnsiChar): LongBool; cdecl;
  TCkStringTable_SplitAndAppend = function(handle: Pointer; inStr: PAnsiChar; delimiterChar: PAnsiChar; exceptDoubleQuoted: LongBool; exceptEscaped: LongBool): LongBool; cdecl;
  TCkStringTable_AppendFromSb = function(handle: Pointer; sb: Pointer): LongBool; cdecl;
  TCkStringTable_Clear = procedure(handle: Pointer); cdecl;
  TCkStringTable_IntAt = function(handle: Pointer; index: Integer): Integer; cdecl;
  TCkStringTable_FindSubstring = function(handle: Pointer; startIndex: Integer; substr: PAnsiChar; caseSensitive: LongBool): Integer; cdecl;
  TCkStringTable_Sort = function(handle: Pointer; ascending: LongBool; caseSensitive: LongBool): LongBool; cdecl;
  TCkStringTable_GetStrings = function(handle: Pointer; startIdx: Integer; count: Integer; crlf: LongBool): PAnsiChar; cdecl;
  TCkStringTable_FindMatch = function(handle: Pointer; sb: Pointer; caseSensitive: LongBool): Integer; cdecl;
  TCkStringTable_WordFollowing = function(handle: Pointer; sb: Pointer; captureEmailAddr: LongBool; sbWord: Pointer): Integer; cdecl;
  TCkStringTable_StringAtSb = function(handle: Pointer; index: Integer; sb: Pointer): LongBool; cdecl;
  TCkStringTable_ToSb = function(handle: Pointer; sb: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkStringTable_Create:  TCkStringTable_Create  = nil;
  CkStringTable_Dispose: TCkStringTable_Dispose = nil;
  CkStringTable_get_LastErrorHtml: TCkStringTable_get_LastErrorHtml = nil;
  CkStringTable_get_LastErrorText: TCkStringTable_get_LastErrorText = nil;
  CkStringTable_get_LastErrorXml: TCkStringTable_get_LastErrorXml = nil;
  CkStringTable_get_Version: TCkStringTable_get_Version = nil;
  CkStringTable_get_DebugLogFilePath: TCkStringTable_get_DebugLogFilePath = nil;
  CkStringTable_put_DebugLogFilePath: TCkStringTable_put_DebugLogFilePath = nil;
  CkStringTable_get_VerboseLogging: TCkStringTable_get_VerboseLogging = nil;
  CkStringTable_put_VerboseLogging: TCkStringTable_put_VerboseLogging = nil;
  CkStringTable_get_LastMethodSuccess: TCkStringTable_get_LastMethodSuccess = nil;
  CkStringTable_put_LastMethodSuccess: TCkStringTable_put_LastMethodSuccess = nil;
  CkStringTable_get_Count: TCkStringTable_get_Count = nil;
  CkStringTable_AppendFromFile: TCkStringTable_AppendFromFile = nil;
  CkStringTable_Append: TCkStringTable_Append = nil;
  CkStringTable_StringAt: TCkStringTable_StringAt = nil;
  CkStringTable_SaveToFile: TCkStringTable_SaveToFile = nil;
  CkStringTable_SplitAndAppend: TCkStringTable_SplitAndAppend = nil;
  CkStringTable_AppendFromSb: TCkStringTable_AppendFromSb = nil;
  CkStringTable_Clear: TCkStringTable_Clear = nil;
  CkStringTable_IntAt: TCkStringTable_IntAt = nil;
  CkStringTable_FindSubstring: TCkStringTable_FindSubstring = nil;
  CkStringTable_Sort: TCkStringTable_Sort = nil;
  CkStringTable_GetStrings: TCkStringTable_GetStrings = nil;
  CkStringTable_FindMatch: TCkStringTable_FindMatch = nil;
  CkStringTable_WordFollowing: TCkStringTable_WordFollowing = nil;
  CkStringTable_StringAtSb: TCkStringTable_StringAtSb = nil;
  CkStringTable_ToSb: TCkStringTable_ToSb = nil;

constructor TStringTable.Create;
begin
  inherited Create;
  FHandle := CkStringTable_Create();
end;

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

function TStringTable.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkStringTable_get_LastErrorHtml(FHandle));
end;

function TStringTable.GetLastErrorText: string;
begin
  Result := CkToStr(CkStringTable_get_LastErrorText(FHandle));
end;

function TStringTable.GetLastErrorXml: string;
begin
  Result := CkToStr(CkStringTable_get_LastErrorXml(FHandle));
end;

function TStringTable.GetVersion: string;
begin
  Result := CkToStr(CkStringTable_get_Version(FHandle));
end;

function TStringTable.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkStringTable_get_DebugLogFilePath(FHandle));
end;

procedure TStringTable.SetDebugLogFilePath(AValue: string);
begin
  CkStringTable_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TStringTable.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkStringTable_get_VerboseLogging(FHandle));
end;

procedure TStringTable.SetVerboseLogging(AValue: Boolean);
begin
  CkStringTable_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TStringTable.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkStringTable_get_LastMethodSuccess(FHandle));
end;

procedure TStringTable.SetLastMethodSuccess(AValue: Boolean);
begin
  CkStringTable_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TStringTable.GetCount: Integer;
begin
  Result := CkStringTable_get_Count(FHandle);
end;

function TStringTable.AppendFromFile(maxLineLen: Integer; const charset: string; const path: string): Boolean;
begin
  Result := Boolean(CkStringTable_AppendFromFile(FHandle, maxLineLen, PAnsiChar(StrToCk(charset)), PAnsiChar(StrToCk(path))));
end;

function TStringTable.Append(const value: string): Boolean;
begin
  Result := Boolean(CkStringTable_Append(FHandle, PAnsiChar(StrToCk(value))));
end;

function TStringTable.StringAt(index: Integer): string;
begin
  Result := CkToStr(CkStringTable_StringAt(FHandle, index));
end;

function TStringTable.SaveToFile(const charset: string; bCrlf: Boolean; const path: string): Boolean;
begin
  Result := Boolean(CkStringTable_SaveToFile(FHandle, PAnsiChar(StrToCk(charset)), LongBool(bCrlf), PAnsiChar(StrToCk(path))));
end;

function TStringTable.SplitAndAppend(const inStr: string; const delimiterChar: string; exceptDoubleQuoted: Boolean; exceptEscaped: Boolean): Boolean;
begin
  Result := Boolean(CkStringTable_SplitAndAppend(FHandle, PAnsiChar(StrToCk(inStr)), PAnsiChar(StrToCk(delimiterChar)), LongBool(exceptDoubleQuoted), LongBool(exceptEscaped)));
end;

function TStringTable.AppendFromSb(sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkStringTable_AppendFromSb(FHandle, sb.Handle));
end;

procedure TStringTable.Clear;
begin
  CkStringTable_Clear(FHandle);
end;

function TStringTable.IntAt(index: Integer): Integer;
begin
  Result := CkStringTable_IntAt(FHandle, index);
end;

function TStringTable.FindSubstring(startIndex: Integer; const substr: string; caseSensitive: Boolean): Integer;
begin
  Result := CkStringTable_FindSubstring(FHandle, startIndex, PAnsiChar(StrToCk(substr)), LongBool(caseSensitive));
end;

function TStringTable.Sort(ascending: Boolean; caseSensitive: Boolean): Boolean;
begin
  Result := Boolean(CkStringTable_Sort(FHandle, LongBool(ascending), LongBool(caseSensitive)));
end;

function TStringTable.GetStrings(startIdx: Integer; count: Integer; crlf: Boolean): string;
begin
  Result := CkToStr(CkStringTable_GetStrings(FHandle, startIdx, count, LongBool(crlf)));
end;

function TStringTable.FindMatch(sb: TChilkatBase; caseSensitive: Boolean): Integer;
begin
  Result := CkStringTable_FindMatch(FHandle, sb.Handle, LongBool(caseSensitive));
end;

function TStringTable.WordFollowing(sb: TChilkatBase; captureEmailAddr: Boolean; sbWord: TChilkatBase): Integer;
begin
  Result := CkStringTable_WordFollowing(FHandle, sb.Handle, LongBool(captureEmailAddr), sbWord.Handle);
end;

function TStringTable.StringAtSb(index: Integer; sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkStringTable_StringAtSb(FHandle, index, sb.Handle));
end;

function TStringTable.ToSb(sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkStringTable_ToSb(FHandle, sb.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkStringTable_Create,  'CkStringTable_Create');
  Chilkat_GetProcedureAddress(CkStringTable_Dispose, 'CkStringTable_Dispose');
  Chilkat_GetProcedureAddress(CkStringTable_get_LastErrorHtml, 'CkStringTable_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkStringTable_get_LastErrorText, 'CkStringTable_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkStringTable_get_LastErrorXml, 'CkStringTable_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkStringTable_get_Version, 'CkStringTable_get_Version');
  Chilkat_GetProcedureAddress(CkStringTable_get_DebugLogFilePath, 'CkStringTable_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkStringTable_put_DebugLogFilePath, 'CkStringTable_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkStringTable_get_VerboseLogging, 'CkStringTable_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkStringTable_put_VerboseLogging, 'CkStringTable_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkStringTable_get_LastMethodSuccess, 'CkStringTable_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkStringTable_put_LastMethodSuccess, 'CkStringTable_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkStringTable_get_Count, 'CkStringTable_get_Count');
  Chilkat_GetProcedureAddress(CkStringTable_AppendFromFile, 'CkStringTable_AppendFromFile');
  Chilkat_GetProcedureAddress(CkStringTable_Append, 'CkStringTable_Append');
  Chilkat_GetProcedureAddress(CkStringTable_StringAt, 'CkStringTable_StringAt');
  Chilkat_GetProcedureAddress(CkStringTable_SaveToFile, 'CkStringTable_SaveToFile');
  Chilkat_GetProcedureAddress(CkStringTable_SplitAndAppend, 'CkStringTable_SplitAndAppend');
  Chilkat_GetProcedureAddress(CkStringTable_AppendFromSb, 'CkStringTable_AppendFromSb');
  Chilkat_GetProcedureAddress(CkStringTable_Clear, 'CkStringTable_Clear');
  Chilkat_GetProcedureAddress(CkStringTable_IntAt, 'CkStringTable_IntAt');
  Chilkat_GetProcedureAddress(CkStringTable_FindSubstring, 'CkStringTable_FindSubstring');
  Chilkat_GetProcedureAddress(CkStringTable_Sort, 'CkStringTable_Sort');
  Chilkat_GetProcedureAddress(CkStringTable_GetStrings, 'CkStringTable_GetStrings');
  Chilkat_GetProcedureAddress(CkStringTable_FindMatch, 'CkStringTable_FindMatch');
  Chilkat_GetProcedureAddress(CkStringTable_WordFollowing, 'CkStringTable_WordFollowing');
  Chilkat_GetProcedureAddress(CkStringTable_StringAtSb, 'CkStringTable_StringAtSb');
  Chilkat_GetProcedureAddress(CkStringTable_ToSb, 'CkStringTable_ToSb');

end.
