unit Chilkat.HtmlToText;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { THtmlToText wraps CkHtmlToText via the C bridge layer. }
  THtmlToText = 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  GetDecodeHtmlEntities: Boolean;
    procedure SetDecodeHtmlEntities(AValue: Boolean);
    function  GetRightMargin: Integer;
    procedure SetRightMargin(AValue: Integer);
    function  GetSuppressLinks: Boolean;
    procedure SetSuppressLinks(AValue: Boolean);
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: 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 DecodeHtmlEntities: Boolean read GetDecodeHtmlEntities write SetDecodeHtmlEntities;
    property RightMargin: Integer read GetRightMargin write SetRightMargin;
    property SuppressLinks: Boolean read GetSuppressLinks write SetSuppressLinks;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;

    function  ToText(const html: string): string;
    function  ToTextSb(sb: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkHtmlToText_Create  = function(): Pointer; cdecl;
  TCkHtmlToText_Dispose = procedure(handle: Pointer); cdecl;
  TCkHtmlToText_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHtmlToText_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHtmlToText_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHtmlToText_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHtmlToText_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHtmlToText_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHtmlToText_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkHtmlToText_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHtmlToText_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkHtmlToText_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHtmlToText_get_DecodeHtmlEntities = function(handle: Pointer): LongBool; cdecl;
  TCkHtmlToText_put_DecodeHtmlEntities = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHtmlToText_get_RightMargin = function(handle: Pointer): Integer; cdecl;
  TCkHtmlToText_put_RightMargin = procedure(handle: Pointer; value: Integer); cdecl;
  TCkHtmlToText_get_SuppressLinks = function(handle: Pointer): LongBool; cdecl;
  TCkHtmlToText_put_SuppressLinks = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHtmlToText_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHtmlToText_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHtmlToText_ToText = function(handle: Pointer; html: PAnsiChar): PAnsiChar; cdecl;
  TCkHtmlToText_ToTextSb = function(handle: Pointer; sb: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkHtmlToText_Create:  TCkHtmlToText_Create  = nil;
  CkHtmlToText_Dispose: TCkHtmlToText_Dispose = nil;
  CkHtmlToText_get_LastErrorHtml: TCkHtmlToText_get_LastErrorHtml = nil;
  CkHtmlToText_get_LastErrorText: TCkHtmlToText_get_LastErrorText = nil;
  CkHtmlToText_get_LastErrorXml: TCkHtmlToText_get_LastErrorXml = nil;
  CkHtmlToText_get_Version: TCkHtmlToText_get_Version = nil;
  CkHtmlToText_get_DebugLogFilePath: TCkHtmlToText_get_DebugLogFilePath = nil;
  CkHtmlToText_put_DebugLogFilePath: TCkHtmlToText_put_DebugLogFilePath = nil;
  CkHtmlToText_get_VerboseLogging: TCkHtmlToText_get_VerboseLogging = nil;
  CkHtmlToText_put_VerboseLogging: TCkHtmlToText_put_VerboseLogging = nil;
  CkHtmlToText_get_LastMethodSuccess: TCkHtmlToText_get_LastMethodSuccess = nil;
  CkHtmlToText_put_LastMethodSuccess: TCkHtmlToText_put_LastMethodSuccess = nil;
  CkHtmlToText_get_DecodeHtmlEntities: TCkHtmlToText_get_DecodeHtmlEntities = nil;
  CkHtmlToText_put_DecodeHtmlEntities: TCkHtmlToText_put_DecodeHtmlEntities = nil;
  CkHtmlToText_get_RightMargin: TCkHtmlToText_get_RightMargin = nil;
  CkHtmlToText_put_RightMargin: TCkHtmlToText_put_RightMargin = nil;
  CkHtmlToText_get_SuppressLinks: TCkHtmlToText_get_SuppressLinks = nil;
  CkHtmlToText_put_SuppressLinks: TCkHtmlToText_put_SuppressLinks = nil;
  CkHtmlToText_get_UncommonOptions: TCkHtmlToText_get_UncommonOptions = nil;
  CkHtmlToText_put_UncommonOptions: TCkHtmlToText_put_UncommonOptions = nil;
  CkHtmlToText_ToText: TCkHtmlToText_ToText = nil;
  CkHtmlToText_ToTextSb: TCkHtmlToText_ToTextSb = nil;

constructor THtmlToText.Create;
begin
  inherited Create;
  FHandle := CkHtmlToText_Create();
end;

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

function THtmlToText.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkHtmlToText_get_LastErrorHtml(FHandle));
end;

function THtmlToText.GetLastErrorText: string;
begin
  Result := CkToStr(CkHtmlToText_get_LastErrorText(FHandle));
end;

function THtmlToText.GetLastErrorXml: string;
begin
  Result := CkToStr(CkHtmlToText_get_LastErrorXml(FHandle));
end;

function THtmlToText.GetVersion: string;
begin
  Result := CkToStr(CkHtmlToText_get_Version(FHandle));
end;

function THtmlToText.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkHtmlToText_get_DebugLogFilePath(FHandle));
end;

procedure THtmlToText.SetDebugLogFilePath(AValue: string);
begin
  CkHtmlToText_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THtmlToText.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkHtmlToText_get_VerboseLogging(FHandle));
end;

procedure THtmlToText.SetVerboseLogging(AValue: Boolean);
begin
  CkHtmlToText_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function THtmlToText.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkHtmlToText_get_LastMethodSuccess(FHandle));
end;

procedure THtmlToText.SetLastMethodSuccess(AValue: Boolean);
begin
  CkHtmlToText_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function THtmlToText.GetDecodeHtmlEntities: Boolean;
begin
  Result := Boolean(CkHtmlToText_get_DecodeHtmlEntities(FHandle));
end;

procedure THtmlToText.SetDecodeHtmlEntities(AValue: Boolean);
begin
  CkHtmlToText_put_DecodeHtmlEntities(FHandle, LongBool(AValue));
end;

function THtmlToText.GetRightMargin: Integer;
begin
  Result := CkHtmlToText_get_RightMargin(FHandle);
end;

procedure THtmlToText.SetRightMargin(AValue: Integer);
begin
  CkHtmlToText_put_RightMargin(FHandle, AValue);
end;

function THtmlToText.GetSuppressLinks: Boolean;
begin
  Result := Boolean(CkHtmlToText_get_SuppressLinks(FHandle));
end;

procedure THtmlToText.SetSuppressLinks(AValue: Boolean);
begin
  CkHtmlToText_put_SuppressLinks(FHandle, LongBool(AValue));
end;

function THtmlToText.GetUncommonOptions: string;
begin
  Result := CkToStr(CkHtmlToText_get_UncommonOptions(FHandle));
end;

procedure THtmlToText.SetUncommonOptions(AValue: string);
begin
  CkHtmlToText_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THtmlToText.ToText(const html: string): string;
begin
  Result := CkToStr(CkHtmlToText_ToText(FHandle, PAnsiChar(StrToCk(html))));
end;

function THtmlToText.ToTextSb(sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkHtmlToText_ToTextSb(FHandle, sb.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkHtmlToText_Create,  'CkHtmlToText_Create');
  Chilkat_GetProcedureAddress(CkHtmlToText_Dispose, 'CkHtmlToText_Dispose');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_LastErrorHtml, 'CkHtmlToText_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_LastErrorText, 'CkHtmlToText_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_LastErrorXml, 'CkHtmlToText_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_Version, 'CkHtmlToText_get_Version');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_DebugLogFilePath, 'CkHtmlToText_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_DebugLogFilePath, 'CkHtmlToText_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_VerboseLogging, 'CkHtmlToText_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_VerboseLogging, 'CkHtmlToText_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_LastMethodSuccess, 'CkHtmlToText_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_LastMethodSuccess, 'CkHtmlToText_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_DecodeHtmlEntities, 'CkHtmlToText_get_DecodeHtmlEntities');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_DecodeHtmlEntities, 'CkHtmlToText_put_DecodeHtmlEntities');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_RightMargin, 'CkHtmlToText_get_RightMargin');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_RightMargin, 'CkHtmlToText_put_RightMargin');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_SuppressLinks, 'CkHtmlToText_get_SuppressLinks');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_SuppressLinks, 'CkHtmlToText_put_SuppressLinks');
  Chilkat_GetProcedureAddress(CkHtmlToText_get_UncommonOptions, 'CkHtmlToText_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkHtmlToText_put_UncommonOptions, 'CkHtmlToText_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkHtmlToText_ToText, 'CkHtmlToText_ToText');
  Chilkat_GetProcedureAddress(CkHtmlToText_ToTextSb, 'CkHtmlToText_ToTextSb');

end.
