unit Chilkat.EmailBundle;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TEmailBundle wraps CkEmailBundle via the C bridge layer. }
  TEmailBundle = 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  GetMessageCount: 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 MessageCount: Integer read GetMessageCount;

    function  AddEmail(email: TChilkatBase): Boolean;
    function  GetXml: string;
    function  LoadXml(const path: string): Boolean;
    function  LoadXmlString(const xmlStr: string): Boolean;
    function  RemoveEmail(email: TChilkatBase): Boolean;
    function  RemoveEmailByIndex(index: Integer): Boolean;
    function  SaveXml(const path: string): Boolean;
    procedure SortByDate(ascending: Boolean);
    procedure SortByRecipient(ascending: Boolean);
    procedure SortBySender(ascending: Boolean);
    procedure SortBySubject(ascending: Boolean);
    function  FindEmail(json: TChilkatBase; email: TChilkatBase): Boolean;
    function  EmailAt(index: Integer; email: TChilkatBase): Boolean;
    procedure Clear;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkEmailBundle_Create  = function(): Pointer; cdecl;
  TCkEmailBundle_Dispose = procedure(handle: Pointer); cdecl;
  TCkEmailBundle_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkEmailBundle_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkEmailBundle_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkEmailBundle_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkEmailBundle_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkEmailBundle_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkEmailBundle_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkEmailBundle_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkEmailBundle_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkEmailBundle_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkEmailBundle_get_MessageCount = function(handle: Pointer): Integer; cdecl;
  TCkEmailBundle_AddEmail = function(handle: Pointer; email: Pointer): LongBool; cdecl;
  TCkEmailBundle_GetXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkEmailBundle_LoadXml = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkEmailBundle_LoadXmlString = function(handle: Pointer; xmlStr: PAnsiChar): LongBool; cdecl;
  TCkEmailBundle_RemoveEmail = function(handle: Pointer; email: Pointer): LongBool; cdecl;
  TCkEmailBundle_RemoveEmailByIndex = function(handle: Pointer; index: Integer): LongBool; cdecl;
  TCkEmailBundle_SaveXml = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkEmailBundle_SortByDate = procedure(handle: Pointer; ascending: LongBool); cdecl;
  TCkEmailBundle_SortByRecipient = procedure(handle: Pointer; ascending: LongBool); cdecl;
  TCkEmailBundle_SortBySender = procedure(handle: Pointer; ascending: LongBool); cdecl;
  TCkEmailBundle_SortBySubject = procedure(handle: Pointer; ascending: LongBool); cdecl;
  TCkEmailBundle_FindEmail = function(handle: Pointer; json: Pointer; email: Pointer): LongBool; cdecl;
  TCkEmailBundle_EmailAt = function(handle: Pointer; index: Integer; email: Pointer): LongBool; cdecl;
  TCkEmailBundle_Clear = procedure(handle: Pointer); cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkEmailBundle_Create:  TCkEmailBundle_Create  = nil;
  CkEmailBundle_Dispose: TCkEmailBundle_Dispose = nil;
  CkEmailBundle_get_LastErrorHtml: TCkEmailBundle_get_LastErrorHtml = nil;
  CkEmailBundle_get_LastErrorText: TCkEmailBundle_get_LastErrorText = nil;
  CkEmailBundle_get_LastErrorXml: TCkEmailBundle_get_LastErrorXml = nil;
  CkEmailBundle_get_Version: TCkEmailBundle_get_Version = nil;
  CkEmailBundle_get_DebugLogFilePath: TCkEmailBundle_get_DebugLogFilePath = nil;
  CkEmailBundle_put_DebugLogFilePath: TCkEmailBundle_put_DebugLogFilePath = nil;
  CkEmailBundle_get_VerboseLogging: TCkEmailBundle_get_VerboseLogging = nil;
  CkEmailBundle_put_VerboseLogging: TCkEmailBundle_put_VerboseLogging = nil;
  CkEmailBundle_get_LastMethodSuccess: TCkEmailBundle_get_LastMethodSuccess = nil;
  CkEmailBundle_put_LastMethodSuccess: TCkEmailBundle_put_LastMethodSuccess = nil;
  CkEmailBundle_get_MessageCount: TCkEmailBundle_get_MessageCount = nil;
  CkEmailBundle_AddEmail: TCkEmailBundle_AddEmail = nil;
  CkEmailBundle_GetXml: TCkEmailBundle_GetXml = nil;
  CkEmailBundle_LoadXml: TCkEmailBundle_LoadXml = nil;
  CkEmailBundle_LoadXmlString: TCkEmailBundle_LoadXmlString = nil;
  CkEmailBundle_RemoveEmail: TCkEmailBundle_RemoveEmail = nil;
  CkEmailBundle_RemoveEmailByIndex: TCkEmailBundle_RemoveEmailByIndex = nil;
  CkEmailBundle_SaveXml: TCkEmailBundle_SaveXml = nil;
  CkEmailBundle_SortByDate: TCkEmailBundle_SortByDate = nil;
  CkEmailBundle_SortByRecipient: TCkEmailBundle_SortByRecipient = nil;
  CkEmailBundle_SortBySender: TCkEmailBundle_SortBySender = nil;
  CkEmailBundle_SortBySubject: TCkEmailBundle_SortBySubject = nil;
  CkEmailBundle_FindEmail: TCkEmailBundle_FindEmail = nil;
  CkEmailBundle_EmailAt: TCkEmailBundle_EmailAt = nil;
  CkEmailBundle_Clear: TCkEmailBundle_Clear = nil;

constructor TEmailBundle.Create;
begin
  inherited Create;
  FHandle := CkEmailBundle_Create();
end;

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

function TEmailBundle.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkEmailBundle_get_LastErrorHtml(FHandle));
end;

function TEmailBundle.GetLastErrorText: string;
begin
  Result := CkToStr(CkEmailBundle_get_LastErrorText(FHandle));
end;

function TEmailBundle.GetLastErrorXml: string;
begin
  Result := CkToStr(CkEmailBundle_get_LastErrorXml(FHandle));
end;

function TEmailBundle.GetVersion: string;
begin
  Result := CkToStr(CkEmailBundle_get_Version(FHandle));
end;

function TEmailBundle.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkEmailBundle_get_DebugLogFilePath(FHandle));
end;

procedure TEmailBundle.SetDebugLogFilePath(AValue: string);
begin
  CkEmailBundle_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TEmailBundle.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkEmailBundle_get_VerboseLogging(FHandle));
end;

procedure TEmailBundle.SetVerboseLogging(AValue: Boolean);
begin
  CkEmailBundle_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TEmailBundle.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkEmailBundle_get_LastMethodSuccess(FHandle));
end;

procedure TEmailBundle.SetLastMethodSuccess(AValue: Boolean);
begin
  CkEmailBundle_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TEmailBundle.GetMessageCount: Integer;
begin
  Result := CkEmailBundle_get_MessageCount(FHandle);
end;

function TEmailBundle.AddEmail(email: TChilkatBase): Boolean;
begin
  Result := Boolean(CkEmailBundle_AddEmail(FHandle, email.Handle));
end;

function TEmailBundle.GetXml: string;
begin
  Result := CkToStr(CkEmailBundle_GetXml(FHandle));
end;

function TEmailBundle.LoadXml(const path: string): Boolean;
begin
  Result := Boolean(CkEmailBundle_LoadXml(FHandle, PAnsiChar(StrToCk(path))));
end;

function TEmailBundle.LoadXmlString(const xmlStr: string): Boolean;
begin
  Result := Boolean(CkEmailBundle_LoadXmlString(FHandle, PAnsiChar(StrToCk(xmlStr))));
end;

function TEmailBundle.RemoveEmail(email: TChilkatBase): Boolean;
begin
  Result := Boolean(CkEmailBundle_RemoveEmail(FHandle, email.Handle));
end;

function TEmailBundle.RemoveEmailByIndex(index: Integer): Boolean;
begin
  Result := Boolean(CkEmailBundle_RemoveEmailByIndex(FHandle, index));
end;

function TEmailBundle.SaveXml(const path: string): Boolean;
begin
  Result := Boolean(CkEmailBundle_SaveXml(FHandle, PAnsiChar(StrToCk(path))));
end;

procedure TEmailBundle.SortByDate(ascending: Boolean);
begin
  CkEmailBundle_SortByDate(FHandle, LongBool(ascending));
end;

procedure TEmailBundle.SortByRecipient(ascending: Boolean);
begin
  CkEmailBundle_SortByRecipient(FHandle, LongBool(ascending));
end;

procedure TEmailBundle.SortBySender(ascending: Boolean);
begin
  CkEmailBundle_SortBySender(FHandle, LongBool(ascending));
end;

procedure TEmailBundle.SortBySubject(ascending: Boolean);
begin
  CkEmailBundle_SortBySubject(FHandle, LongBool(ascending));
end;

function TEmailBundle.FindEmail(json: TChilkatBase; email: TChilkatBase): Boolean;
begin
  Result := Boolean(CkEmailBundle_FindEmail(FHandle, json.Handle, email.Handle));
end;

function TEmailBundle.EmailAt(index: Integer; email: TChilkatBase): Boolean;
begin
  Result := Boolean(CkEmailBundle_EmailAt(FHandle, index, email.Handle));
end;

procedure TEmailBundle.Clear;
begin
  CkEmailBundle_Clear(FHandle);
end;

initialization
  Chilkat_GetProcedureAddress(CkEmailBundle_Create,  'CkEmailBundle_Create');
  Chilkat_GetProcedureAddress(CkEmailBundle_Dispose, 'CkEmailBundle_Dispose');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_LastErrorHtml, 'CkEmailBundle_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_LastErrorText, 'CkEmailBundle_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_LastErrorXml, 'CkEmailBundle_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_Version, 'CkEmailBundle_get_Version');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_DebugLogFilePath, 'CkEmailBundle_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkEmailBundle_put_DebugLogFilePath, 'CkEmailBundle_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_VerboseLogging, 'CkEmailBundle_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkEmailBundle_put_VerboseLogging, 'CkEmailBundle_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_LastMethodSuccess, 'CkEmailBundle_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkEmailBundle_put_LastMethodSuccess, 'CkEmailBundle_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkEmailBundle_get_MessageCount, 'CkEmailBundle_get_MessageCount');
  Chilkat_GetProcedureAddress(CkEmailBundle_AddEmail, 'CkEmailBundle_AddEmail');
  Chilkat_GetProcedureAddress(CkEmailBundle_GetXml, 'CkEmailBundle_GetXml');
  Chilkat_GetProcedureAddress(CkEmailBundle_LoadXml, 'CkEmailBundle_LoadXml');
  Chilkat_GetProcedureAddress(CkEmailBundle_LoadXmlString, 'CkEmailBundle_LoadXmlString');
  Chilkat_GetProcedureAddress(CkEmailBundle_RemoveEmail, 'CkEmailBundle_RemoveEmail');
  Chilkat_GetProcedureAddress(CkEmailBundle_RemoveEmailByIndex, 'CkEmailBundle_RemoveEmailByIndex');
  Chilkat_GetProcedureAddress(CkEmailBundle_SaveXml, 'CkEmailBundle_SaveXml');
  Chilkat_GetProcedureAddress(CkEmailBundle_SortByDate, 'CkEmailBundle_SortByDate');
  Chilkat_GetProcedureAddress(CkEmailBundle_SortByRecipient, 'CkEmailBundle_SortByRecipient');
  Chilkat_GetProcedureAddress(CkEmailBundle_SortBySender, 'CkEmailBundle_SortBySender');
  Chilkat_GetProcedureAddress(CkEmailBundle_SortBySubject, 'CkEmailBundle_SortBySubject');
  Chilkat_GetProcedureAddress(CkEmailBundle_FindEmail, 'CkEmailBundle_FindEmail');
  Chilkat_GetProcedureAddress(CkEmailBundle_EmailAt, 'CkEmailBundle_EmailAt');
  Chilkat_GetProcedureAddress(CkEmailBundle_Clear, 'CkEmailBundle_Clear');

end.
