unit Chilkat.SecureString;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TSecureString wraps CkSecureString via the C bridge layer. }
  TSecureString = 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  GetMaintainHash: string;
    procedure SetMaintainHash(AValue: string);
    function  GetReadOnly: Boolean;
    procedure SetReadOnly(AValue: Boolean);
  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 MaintainHash: string read GetMaintainHash write SetMaintainHash;
    property ReadOnly: Boolean read GetReadOnly write SetReadOnly;

    function  Access: string;
    function  Append(const str: string): Boolean;
    function  AppendSecure(secStr: TChilkatBase): Boolean;
    function  VerifyHash(const hashVal: string; const encoding: string): Boolean;
    function  SecStrEquals(secStr: TChilkatBase): Boolean;
    function  HashVal(const encoding: string): string;
    function  AppendSb(sb: TChilkatBase): Boolean;
    function  LoadFile(const path: string; const charset: string): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkSecureString_Create  = function(): Pointer; cdecl;
  TCkSecureString_Dispose = procedure(handle: Pointer); cdecl;
  TCkSecureString_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSecureString_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkSecureString_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSecureString_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkSecureString_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSecureString_get_MaintainHash = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_put_MaintainHash = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkSecureString_get_ReadOnly = function(handle: Pointer): LongBool; cdecl;
  TCkSecureString_put_ReadOnly = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkSecureString_Access = function(handle: Pointer): PAnsiChar; cdecl;
  TCkSecureString_Append = function(handle: Pointer; str: PAnsiChar): LongBool; cdecl;
  TCkSecureString_AppendSecure = function(handle: Pointer; secStr: Pointer): LongBool; cdecl;
  TCkSecureString_VerifyHash = function(handle: Pointer; hashVal: PAnsiChar; encoding: PAnsiChar): LongBool; cdecl;
  TCkSecureString_SecStrEquals = function(handle: Pointer; secStr: Pointer): LongBool; cdecl;
  TCkSecureString_HashVal = function(handle: Pointer; encoding: PAnsiChar): PAnsiChar; cdecl;
  TCkSecureString_AppendSb = function(handle: Pointer; sb: Pointer): LongBool; cdecl;
  TCkSecureString_LoadFile = function(handle: Pointer; path: PAnsiChar; charset: PAnsiChar): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkSecureString_Create:  TCkSecureString_Create  = nil;
  CkSecureString_Dispose: TCkSecureString_Dispose = nil;
  CkSecureString_get_LastErrorHtml: TCkSecureString_get_LastErrorHtml = nil;
  CkSecureString_get_LastErrorText: TCkSecureString_get_LastErrorText = nil;
  CkSecureString_get_LastErrorXml: TCkSecureString_get_LastErrorXml = nil;
  CkSecureString_get_Version: TCkSecureString_get_Version = nil;
  CkSecureString_get_DebugLogFilePath: TCkSecureString_get_DebugLogFilePath = nil;
  CkSecureString_put_DebugLogFilePath: TCkSecureString_put_DebugLogFilePath = nil;
  CkSecureString_get_VerboseLogging: TCkSecureString_get_VerboseLogging = nil;
  CkSecureString_put_VerboseLogging: TCkSecureString_put_VerboseLogging = nil;
  CkSecureString_get_LastMethodSuccess: TCkSecureString_get_LastMethodSuccess = nil;
  CkSecureString_put_LastMethodSuccess: TCkSecureString_put_LastMethodSuccess = nil;
  CkSecureString_get_MaintainHash: TCkSecureString_get_MaintainHash = nil;
  CkSecureString_put_MaintainHash: TCkSecureString_put_MaintainHash = nil;
  CkSecureString_get_ReadOnly: TCkSecureString_get_ReadOnly = nil;
  CkSecureString_put_ReadOnly: TCkSecureString_put_ReadOnly = nil;
  CkSecureString_Access: TCkSecureString_Access = nil;
  CkSecureString_Append: TCkSecureString_Append = nil;
  CkSecureString_AppendSecure: TCkSecureString_AppendSecure = nil;
  CkSecureString_VerifyHash: TCkSecureString_VerifyHash = nil;
  CkSecureString_SecStrEquals: TCkSecureString_SecStrEquals = nil;
  CkSecureString_HashVal: TCkSecureString_HashVal = nil;
  CkSecureString_AppendSb: TCkSecureString_AppendSb = nil;
  CkSecureString_LoadFile: TCkSecureString_LoadFile = nil;

constructor TSecureString.Create;
begin
  inherited Create;
  FHandle := CkSecureString_Create();
end;

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

function TSecureString.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkSecureString_get_LastErrorHtml(FHandle));
end;

function TSecureString.GetLastErrorText: string;
begin
  Result := CkToStr(CkSecureString_get_LastErrorText(FHandle));
end;

function TSecureString.GetLastErrorXml: string;
begin
  Result := CkToStr(CkSecureString_get_LastErrorXml(FHandle));
end;

function TSecureString.GetVersion: string;
begin
  Result := CkToStr(CkSecureString_get_Version(FHandle));
end;

function TSecureString.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkSecureString_get_DebugLogFilePath(FHandle));
end;

procedure TSecureString.SetDebugLogFilePath(AValue: string);
begin
  CkSecureString_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSecureString.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkSecureString_get_VerboseLogging(FHandle));
end;

procedure TSecureString.SetVerboseLogging(AValue: Boolean);
begin
  CkSecureString_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TSecureString.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkSecureString_get_LastMethodSuccess(FHandle));
end;

procedure TSecureString.SetLastMethodSuccess(AValue: Boolean);
begin
  CkSecureString_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TSecureString.GetMaintainHash: string;
begin
  Result := CkToStr(CkSecureString_get_MaintainHash(FHandle));
end;

procedure TSecureString.SetMaintainHash(AValue: string);
begin
  CkSecureString_put_MaintainHash(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TSecureString.GetReadOnly: Boolean;
begin
  Result := Boolean(CkSecureString_get_ReadOnly(FHandle));
end;

procedure TSecureString.SetReadOnly(AValue: Boolean);
begin
  CkSecureString_put_ReadOnly(FHandle, LongBool(AValue));
end;

function TSecureString.Access: string;
begin
  Result := CkToStr(CkSecureString_Access(FHandle));
end;

function TSecureString.Append(const str: string): Boolean;
begin
  Result := Boolean(CkSecureString_Append(FHandle, PAnsiChar(StrToCk(str))));
end;

function TSecureString.AppendSecure(secStr: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSecureString_AppendSecure(FHandle, secStr.Handle));
end;

function TSecureString.VerifyHash(const hashVal: string; const encoding: string): Boolean;
begin
  Result := Boolean(CkSecureString_VerifyHash(FHandle, PAnsiChar(StrToCk(hashVal)), PAnsiChar(StrToCk(encoding))));
end;

function TSecureString.SecStrEquals(secStr: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSecureString_SecStrEquals(FHandle, secStr.Handle));
end;

function TSecureString.HashVal(const encoding: string): string;
begin
  Result := CkToStr(CkSecureString_HashVal(FHandle, PAnsiChar(StrToCk(encoding))));
end;

function TSecureString.AppendSb(sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkSecureString_AppendSb(FHandle, sb.Handle));
end;

function TSecureString.LoadFile(const path: string; const charset: string): Boolean;
begin
  Result := Boolean(CkSecureString_LoadFile(FHandle, PAnsiChar(StrToCk(path)), PAnsiChar(StrToCk(charset))));
end;

initialization
  Chilkat_GetProcedureAddress(CkSecureString_Create,  'CkSecureString_Create');
  Chilkat_GetProcedureAddress(CkSecureString_Dispose, 'CkSecureString_Dispose');
  Chilkat_GetProcedureAddress(CkSecureString_get_LastErrorHtml, 'CkSecureString_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkSecureString_get_LastErrorText, 'CkSecureString_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkSecureString_get_LastErrorXml, 'CkSecureString_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkSecureString_get_Version, 'CkSecureString_get_Version');
  Chilkat_GetProcedureAddress(CkSecureString_get_DebugLogFilePath, 'CkSecureString_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSecureString_put_DebugLogFilePath, 'CkSecureString_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkSecureString_get_VerboseLogging, 'CkSecureString_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSecureString_put_VerboseLogging, 'CkSecureString_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkSecureString_get_LastMethodSuccess, 'CkSecureString_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSecureString_put_LastMethodSuccess, 'CkSecureString_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkSecureString_get_MaintainHash, 'CkSecureString_get_MaintainHash');
  Chilkat_GetProcedureAddress(CkSecureString_put_MaintainHash, 'CkSecureString_put_MaintainHash');
  Chilkat_GetProcedureAddress(CkSecureString_get_ReadOnly, 'CkSecureString_get_ReadOnly');
  Chilkat_GetProcedureAddress(CkSecureString_put_ReadOnly, 'CkSecureString_put_ReadOnly');
  Chilkat_GetProcedureAddress(CkSecureString_Access, 'CkSecureString_Access');
  Chilkat_GetProcedureAddress(CkSecureString_Append, 'CkSecureString_Append');
  Chilkat_GetProcedureAddress(CkSecureString_AppendSecure, 'CkSecureString_AppendSecure');
  Chilkat_GetProcedureAddress(CkSecureString_VerifyHash, 'CkSecureString_VerifyHash');
  Chilkat_GetProcedureAddress(CkSecureString_SecStrEquals, 'CkSecureString_SecStrEquals');
  Chilkat_GetProcedureAddress(CkSecureString_HashVal, 'CkSecureString_HashVal');
  Chilkat_GetProcedureAddress(CkSecureString_AppendSb, 'CkSecureString_AppendSb');
  Chilkat_GetProcedureAddress(CkSecureString_LoadFile, 'CkSecureString_LoadFile');

end.
