unit Chilkat.Mailboxes;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TMailboxes wraps CkMailboxes via the C bridge layer. }
  TMailboxes = 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  GetFlags(index: Integer): string;
    function  GetMailboxIndex(const mbxName: string): Integer;
    function  GetName(index: Integer): string;
    function  GetNthFlag(index: Integer; flagIndex: Integer): string;
    function  GetNumFlags(index: Integer): Integer;
    function  HasFlag(index: Integer; const flagName: string): Boolean;
    function  HasInferiors(index: Integer): Boolean;
    function  IsMarked(index: Integer): Boolean;
    function  IsSelectable(index: Integer): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkMailboxes_Create  = function(): Pointer; cdecl;
  TCkMailboxes_Dispose = procedure(handle: Pointer); cdecl;
  TCkMailboxes_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkMailboxes_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkMailboxes_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkMailboxes_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkMailboxes_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkMailboxes_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkMailboxes_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkMailboxes_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkMailboxes_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkMailboxes_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkMailboxes_get_Count = function(handle: Pointer): Integer; cdecl;
  TCkMailboxes_GetFlags = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkMailboxes_GetMailboxIndex = function(handle: Pointer; mbxName: PAnsiChar): Integer; cdecl;
  TCkMailboxes_GetName = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkMailboxes_GetNthFlag = function(handle: Pointer; index: Integer; flagIndex: Integer): PAnsiChar; cdecl;
  TCkMailboxes_GetNumFlags = function(handle: Pointer; index: Integer): Integer; cdecl;
  TCkMailboxes_HasFlag = function(handle: Pointer; index: Integer; flagName: PAnsiChar): LongBool; cdecl;
  TCkMailboxes_HasInferiors = function(handle: Pointer; index: Integer): LongBool; cdecl;
  TCkMailboxes_IsMarked = function(handle: Pointer; index: Integer): LongBool; cdecl;
  TCkMailboxes_IsSelectable = function(handle: Pointer; index: Integer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkMailboxes_Create:  TCkMailboxes_Create  = nil;
  CkMailboxes_Dispose: TCkMailboxes_Dispose = nil;
  CkMailboxes_get_LastErrorHtml: TCkMailboxes_get_LastErrorHtml = nil;
  CkMailboxes_get_LastErrorText: TCkMailboxes_get_LastErrorText = nil;
  CkMailboxes_get_LastErrorXml: TCkMailboxes_get_LastErrorXml = nil;
  CkMailboxes_get_Version: TCkMailboxes_get_Version = nil;
  CkMailboxes_get_DebugLogFilePath: TCkMailboxes_get_DebugLogFilePath = nil;
  CkMailboxes_put_DebugLogFilePath: TCkMailboxes_put_DebugLogFilePath = nil;
  CkMailboxes_get_VerboseLogging: TCkMailboxes_get_VerboseLogging = nil;
  CkMailboxes_put_VerboseLogging: TCkMailboxes_put_VerboseLogging = nil;
  CkMailboxes_get_LastMethodSuccess: TCkMailboxes_get_LastMethodSuccess = nil;
  CkMailboxes_put_LastMethodSuccess: TCkMailboxes_put_LastMethodSuccess = nil;
  CkMailboxes_get_Count: TCkMailboxes_get_Count = nil;
  CkMailboxes_GetFlags: TCkMailboxes_GetFlags = nil;
  CkMailboxes_GetMailboxIndex: TCkMailboxes_GetMailboxIndex = nil;
  CkMailboxes_GetName: TCkMailboxes_GetName = nil;
  CkMailboxes_GetNthFlag: TCkMailboxes_GetNthFlag = nil;
  CkMailboxes_GetNumFlags: TCkMailboxes_GetNumFlags = nil;
  CkMailboxes_HasFlag: TCkMailboxes_HasFlag = nil;
  CkMailboxes_HasInferiors: TCkMailboxes_HasInferiors = nil;
  CkMailboxes_IsMarked: TCkMailboxes_IsMarked = nil;
  CkMailboxes_IsSelectable: TCkMailboxes_IsSelectable = nil;

constructor TMailboxes.Create;
begin
  inherited Create;
  FHandle := CkMailboxes_Create();
end;

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

function TMailboxes.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkMailboxes_get_LastErrorHtml(FHandle));
end;

function TMailboxes.GetLastErrorText: string;
begin
  Result := CkToStr(CkMailboxes_get_LastErrorText(FHandle));
end;

function TMailboxes.GetLastErrorXml: string;
begin
  Result := CkToStr(CkMailboxes_get_LastErrorXml(FHandle));
end;

function TMailboxes.GetVersion: string;
begin
  Result := CkToStr(CkMailboxes_get_Version(FHandle));
end;

function TMailboxes.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkMailboxes_get_DebugLogFilePath(FHandle));
end;

procedure TMailboxes.SetDebugLogFilePath(AValue: string);
begin
  CkMailboxes_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TMailboxes.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkMailboxes_get_VerboseLogging(FHandle));
end;

procedure TMailboxes.SetVerboseLogging(AValue: Boolean);
begin
  CkMailboxes_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TMailboxes.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkMailboxes_get_LastMethodSuccess(FHandle));
end;

procedure TMailboxes.SetLastMethodSuccess(AValue: Boolean);
begin
  CkMailboxes_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TMailboxes.GetCount: Integer;
begin
  Result := CkMailboxes_get_Count(FHandle);
end;

function TMailboxes.GetFlags(index: Integer): string;
begin
  Result := CkToStr(CkMailboxes_GetFlags(FHandle, index));
end;

function TMailboxes.GetMailboxIndex(const mbxName: string): Integer;
begin
  Result := CkMailboxes_GetMailboxIndex(FHandle, PAnsiChar(StrToCk(mbxName)));
end;

function TMailboxes.GetName(index: Integer): string;
begin
  Result := CkToStr(CkMailboxes_GetName(FHandle, index));
end;

function TMailboxes.GetNthFlag(index: Integer; flagIndex: Integer): string;
begin
  Result := CkToStr(CkMailboxes_GetNthFlag(FHandle, index, flagIndex));
end;

function TMailboxes.GetNumFlags(index: Integer): Integer;
begin
  Result := CkMailboxes_GetNumFlags(FHandle, index);
end;

function TMailboxes.HasFlag(index: Integer; const flagName: string): Boolean;
begin
  Result := Boolean(CkMailboxes_HasFlag(FHandle, index, PAnsiChar(StrToCk(flagName))));
end;

function TMailboxes.HasInferiors(index: Integer): Boolean;
begin
  Result := Boolean(CkMailboxes_HasInferiors(FHandle, index));
end;

function TMailboxes.IsMarked(index: Integer): Boolean;
begin
  Result := Boolean(CkMailboxes_IsMarked(FHandle, index));
end;

function TMailboxes.IsSelectable(index: Integer): Boolean;
begin
  Result := Boolean(CkMailboxes_IsSelectable(FHandle, index));
end;

initialization
  Chilkat_GetProcedureAddress(CkMailboxes_Create,  'CkMailboxes_Create');
  Chilkat_GetProcedureAddress(CkMailboxes_Dispose, 'CkMailboxes_Dispose');
  Chilkat_GetProcedureAddress(CkMailboxes_get_LastErrorHtml, 'CkMailboxes_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkMailboxes_get_LastErrorText, 'CkMailboxes_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkMailboxes_get_LastErrorXml, 'CkMailboxes_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkMailboxes_get_Version, 'CkMailboxes_get_Version');
  Chilkat_GetProcedureAddress(CkMailboxes_get_DebugLogFilePath, 'CkMailboxes_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkMailboxes_put_DebugLogFilePath, 'CkMailboxes_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkMailboxes_get_VerboseLogging, 'CkMailboxes_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkMailboxes_put_VerboseLogging, 'CkMailboxes_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkMailboxes_get_LastMethodSuccess, 'CkMailboxes_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkMailboxes_put_LastMethodSuccess, 'CkMailboxes_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkMailboxes_get_Count, 'CkMailboxes_get_Count');
  Chilkat_GetProcedureAddress(CkMailboxes_GetFlags, 'CkMailboxes_GetFlags');
  Chilkat_GetProcedureAddress(CkMailboxes_GetMailboxIndex, 'CkMailboxes_GetMailboxIndex');
  Chilkat_GetProcedureAddress(CkMailboxes_GetName, 'CkMailboxes_GetName');
  Chilkat_GetProcedureAddress(CkMailboxes_GetNthFlag, 'CkMailboxes_GetNthFlag');
  Chilkat_GetProcedureAddress(CkMailboxes_GetNumFlags, 'CkMailboxes_GetNumFlags');
  Chilkat_GetProcedureAddress(CkMailboxes_HasFlag, 'CkMailboxes_HasFlag');
  Chilkat_GetProcedureAddress(CkMailboxes_HasInferiors, 'CkMailboxes_HasInferiors');
  Chilkat_GetProcedureAddress(CkMailboxes_IsMarked, 'CkMailboxes_IsMarked');
  Chilkat_GetProcedureAddress(CkMailboxes_IsSelectable, 'CkMailboxes_IsSelectable');

end.
