Class TPathWatcher

Unit

Declaration

type TPathWatcher = class(TInterfacedObject, IPathWatcher)

Description

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public class function New: IPathWatcher;
Public function Path(const APath: string): IPathWatcher;
Public function Ignore(const AIgnoreKind: TIgnoreKind; AItems: TArray<string>): IPathWatcher;
Public function Timeout(const ATime: Longint): IPathWatcher;
Public function Run(const AWatcherRun: TWatcherRunCallback): IPathWatcher;
Public function Start: IPathWatcher;

Description

Methods

Public constructor Create;

Default class constructor. Initialize interanal arrays and dictionaries. Use new method for as default class factory. instantiation.

Public destructor Destroy; override;

Default class destructor. Release resources.

Public class function New: IPathWatcher;

Factory method for TPathWatcher, this is the recommended method to create a new instance of the class.

Public function Path(const APath: string): IPathWatcher;

Sets the path to watch for changes. Returns self to allow chained watcher calls.

Parameters
APath
Path that will be monitored
Public function Ignore(const AIgnoreKind: TIgnoreKind; AItems: TArray<string>): IPathWatcher;

Defines a set of values to be ignored according to the type provided as a parameter. Ex: to ignore all items, folders or files that start with "." just call the function as follows: Watcher.Ignore(ikStartsText, ['.']); Ex: to ignore all folders with specific names, call the function as follows: Watcher.Ignore(ikFolder, ['bin', 'lib', 'modules']);

Returns self to allow chained watcher calls.

Parameters
AIgnoreKind
Kind of item to be ignored by the watcher
AItems
An array containing strings to be ignored according to AIgnoreKind
Public function Timeout(const ATime: Longint): IPathWatcher;

Sets maximum timeout in milliseconds to call the watcher run callback. Every time run is called this timer is reset. If the maximum timeout is reached TPathWatcher is terminated. Default value is 3600 seconds or 3,600,000 milliseconds.

Parameters
ATime
Number of milliseconds to set the maximum timeout.
Public function Run(const AWatcherRun: TWatcherRunCallback): IPathWatcher;

Defines the callback procedure that should be executed when a change is detected.

)

Parameters
AProc
A procedure that will be called after a change
Public function Start: IPathWatcher;

Start watching the path considering the ignore parameters that have been configured. As soon as a change is detected the callback routine will be called.


Generated by PasDoc 0.16.0.