unit Chilkat.Url;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TUrl wraps CkUrl via the C bridge layer. }
  TUrl = 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  GetFrag: string;
    function  GetHost: string;
    function  GetHostType: string;
    function  GetLogin: string;
    function  GetPassword: string;
    function  GetPath: string;
    function  GetPort: Integer;
    function  GetQuery: string;
    function  GetSsl: Boolean;
    function  GetPathWithQueryParams: string;
    function  GetScheme: 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 Frag: string read GetFrag;
    property Host: string read GetHost;
    property HostType: string read GetHostType;
    property Login: string read GetLogin;
    property Password: string read GetPassword;
    property Path: string read GetPath;
    property Port: Integer read GetPort;
    property Query: string read GetQuery;
    property Ssl: Boolean read GetSsl;
    property PathWithQueryParams: string read GetPathWithQueryParams;
    property Scheme: string read GetScheme;

    function  ParseUrl(const url: string): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkUrl_Create  = function(): Pointer; cdecl;
  TCkUrl_Dispose = procedure(handle: Pointer); cdecl;
  TCkUrl_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUrl_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkUrl_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUrl_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkUrl_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUrl_get_Frag = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Host = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_HostType = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Login = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Password = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Path = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Port = function(handle: Pointer): Integer; cdecl;
  TCkUrl_get_Query = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Ssl = function(handle: Pointer): LongBool; cdecl;
  TCkUrl_get_PathWithQueryParams = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_get_Scheme = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUrl_ParseUrl = function(handle: Pointer; url: PAnsiChar): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkUrl_Create:  TCkUrl_Create  = nil;
  CkUrl_Dispose: TCkUrl_Dispose = nil;
  CkUrl_get_LastErrorHtml: TCkUrl_get_LastErrorHtml = nil;
  CkUrl_get_LastErrorText: TCkUrl_get_LastErrorText = nil;
  CkUrl_get_LastErrorXml: TCkUrl_get_LastErrorXml = nil;
  CkUrl_get_Version: TCkUrl_get_Version = nil;
  CkUrl_get_DebugLogFilePath: TCkUrl_get_DebugLogFilePath = nil;
  CkUrl_put_DebugLogFilePath: TCkUrl_put_DebugLogFilePath = nil;
  CkUrl_get_VerboseLogging: TCkUrl_get_VerboseLogging = nil;
  CkUrl_put_VerboseLogging: TCkUrl_put_VerboseLogging = nil;
  CkUrl_get_LastMethodSuccess: TCkUrl_get_LastMethodSuccess = nil;
  CkUrl_put_LastMethodSuccess: TCkUrl_put_LastMethodSuccess = nil;
  CkUrl_get_Frag: TCkUrl_get_Frag = nil;
  CkUrl_get_Host: TCkUrl_get_Host = nil;
  CkUrl_get_HostType: TCkUrl_get_HostType = nil;
  CkUrl_get_Login: TCkUrl_get_Login = nil;
  CkUrl_get_Password: TCkUrl_get_Password = nil;
  CkUrl_get_Path: TCkUrl_get_Path = nil;
  CkUrl_get_Port: TCkUrl_get_Port = nil;
  CkUrl_get_Query: TCkUrl_get_Query = nil;
  CkUrl_get_Ssl: TCkUrl_get_Ssl = nil;
  CkUrl_get_PathWithQueryParams: TCkUrl_get_PathWithQueryParams = nil;
  CkUrl_get_Scheme: TCkUrl_get_Scheme = nil;
  CkUrl_ParseUrl: TCkUrl_ParseUrl = nil;

constructor TUrl.Create;
begin
  inherited Create;
  FHandle := CkUrl_Create();
end;

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

function TUrl.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkUrl_get_LastErrorHtml(FHandle));
end;

function TUrl.GetLastErrorText: string;
begin
  Result := CkToStr(CkUrl_get_LastErrorText(FHandle));
end;

function TUrl.GetLastErrorXml: string;
begin
  Result := CkToStr(CkUrl_get_LastErrorXml(FHandle));
end;

function TUrl.GetVersion: string;
begin
  Result := CkToStr(CkUrl_get_Version(FHandle));
end;

function TUrl.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkUrl_get_DebugLogFilePath(FHandle));
end;

procedure TUrl.SetDebugLogFilePath(AValue: string);
begin
  CkUrl_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUrl.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkUrl_get_VerboseLogging(FHandle));
end;

procedure TUrl.SetVerboseLogging(AValue: Boolean);
begin
  CkUrl_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TUrl.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkUrl_get_LastMethodSuccess(FHandle));
end;

procedure TUrl.SetLastMethodSuccess(AValue: Boolean);
begin
  CkUrl_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TUrl.GetFrag: string;
begin
  Result := CkToStr(CkUrl_get_Frag(FHandle));
end;

function TUrl.GetHost: string;
begin
  Result := CkToStr(CkUrl_get_Host(FHandle));
end;

function TUrl.GetHostType: string;
begin
  Result := CkToStr(CkUrl_get_HostType(FHandle));
end;

function TUrl.GetLogin: string;
begin
  Result := CkToStr(CkUrl_get_Login(FHandle));
end;

function TUrl.GetPassword: string;
begin
  Result := CkToStr(CkUrl_get_Password(FHandle));
end;

function TUrl.GetPath: string;
begin
  Result := CkToStr(CkUrl_get_Path(FHandle));
end;

function TUrl.GetPort: Integer;
begin
  Result := CkUrl_get_Port(FHandle);
end;

function TUrl.GetQuery: string;
begin
  Result := CkToStr(CkUrl_get_Query(FHandle));
end;

function TUrl.GetSsl: Boolean;
begin
  Result := Boolean(CkUrl_get_Ssl(FHandle));
end;

function TUrl.GetPathWithQueryParams: string;
begin
  Result := CkToStr(CkUrl_get_PathWithQueryParams(FHandle));
end;

function TUrl.GetScheme: string;
begin
  Result := CkToStr(CkUrl_get_Scheme(FHandle));
end;

function TUrl.ParseUrl(const url: string): Boolean;
begin
  Result := Boolean(CkUrl_ParseUrl(FHandle, PAnsiChar(StrToCk(url))));
end;

initialization
  Chilkat_GetProcedureAddress(CkUrl_Create,  'CkUrl_Create');
  Chilkat_GetProcedureAddress(CkUrl_Dispose, 'CkUrl_Dispose');
  Chilkat_GetProcedureAddress(CkUrl_get_LastErrorHtml, 'CkUrl_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkUrl_get_LastErrorText, 'CkUrl_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkUrl_get_LastErrorXml, 'CkUrl_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkUrl_get_Version, 'CkUrl_get_Version');
  Chilkat_GetProcedureAddress(CkUrl_get_DebugLogFilePath, 'CkUrl_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkUrl_put_DebugLogFilePath, 'CkUrl_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkUrl_get_VerboseLogging, 'CkUrl_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkUrl_put_VerboseLogging, 'CkUrl_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkUrl_get_LastMethodSuccess, 'CkUrl_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkUrl_put_LastMethodSuccess, 'CkUrl_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkUrl_get_Frag, 'CkUrl_get_Frag');
  Chilkat_GetProcedureAddress(CkUrl_get_Host, 'CkUrl_get_Host');
  Chilkat_GetProcedureAddress(CkUrl_get_HostType, 'CkUrl_get_HostType');
  Chilkat_GetProcedureAddress(CkUrl_get_Login, 'CkUrl_get_Login');
  Chilkat_GetProcedureAddress(CkUrl_get_Password, 'CkUrl_get_Password');
  Chilkat_GetProcedureAddress(CkUrl_get_Path, 'CkUrl_get_Path');
  Chilkat_GetProcedureAddress(CkUrl_get_Port, 'CkUrl_get_Port');
  Chilkat_GetProcedureAddress(CkUrl_get_Query, 'CkUrl_get_Query');
  Chilkat_GetProcedureAddress(CkUrl_get_Ssl, 'CkUrl_get_Ssl');
  Chilkat_GetProcedureAddress(CkUrl_get_PathWithQueryParams, 'CkUrl_get_PathWithQueryParams');
  Chilkat_GetProcedureAddress(CkUrl_get_Scheme, 'CkUrl_get_Scheme');
  Chilkat_GetProcedureAddress(CkUrl_ParseUrl, 'CkUrl_ParseUrl');

end.
