[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'Masks' (#lazutils)

TMaskUTF8

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a class used to define, evaluate, and compare a mask expression using UNIX file system mask conventions.

Declaration

Source position: masks.pas line 218

type TMaskUTF8 = class(TMaskBase)

protected

  fOriginalMask: string;

  

Member used for the mask expression passed to the constructor.

  function IsSpecialChar(); virtual;

  

Indicates if the specified character is a wildcard character, or used to represent set / range notation.

  procedure CompileOtherSpecialChars; virtual;

  

Has an empty implementation in TMaskUTF8.

  class function CompareUTF8Sequences();

  

Indicates the difference between UTF-8 codepoints in the specified values.

  function intfMatches();

  

Implements the Matches method for the supported platform.

public

  constructor Create();

  

Constructor for the class instance.

  procedure Compile; virtual;

  

Examines the mask expression and creates a list of op codes.

  function Matches(); virtual;

  

Indicates whether the specified value is a match for the Mask expression.

  function MatchesWindowsMask(); deprecated ;

  

Indicates whether the specified value is a match for the Windows-specific Mask expression.

  property Mask: string; [rw]

  

Mask expression used to match files or directories in the class instance.

end;

Inheritance

TMaskUTF8

  

Implements a class used to define, evaluate, and compare a mask expression using UNIX file system mask conventions.

|

TMaskBase

  

Implements the base class used to define and evaluate a mask expression.

|

TObject

Description

TMaskUTF8 is a TMaskBase descendant which implements a class used for mask expressions using UNIX file system conventions. It extends the ancestor class with support for a UTF-8-encoded Mask expression. The mask expression uses wildcards and other notation specific to UNIX-like file systems, including:

'?'
Represents any single required character in a file or directory name. For instance, 'c?t' matches 'cat' and 'cut', but not 'coat' or 'cult'. An expression like 'cl??' would matches values like 'clap' and 'clot', but not 'clean' or 'clt'.
'*'
Matches all entries in a directory. This includes entries with or without a file extension, and does not differentiate between files and directories. This is commonly referred to as the "all files" mask.
'*.*'
Matches all entries which have any given file extension. The file extension is required though. Please note that this notation is different than the one implemented for the Windows file system.
'*.ext'
Matches all entries which have a '.ext' file extension.
'file*
Matches all entries that start with 'file' and may contain any number of additional optional characters or a file extension. Matches 'file', 'filename' and 'filename.ext'.
'[]' (square brackets)
Represents a choice of characters that may represent a match on the file system. They are used in both set and range expressions. A set is expressed using notation like 'c[au]t'. This would match entries like 'cat' or 'cut', but not 'cot'. A range uses notation like 'g[a-f]z'. This would match values like 'gaz', 'gbz', and 'gcz'. It would not match 'ggz', 'gxz', or 'gz'.
'[!]'
Used to negate a set or range expression. It matches any character value which is NOT in the set or range.
'\' (Backslash)
The default escape character which forces the following character to be interpreted as a literal and not a wildcard. The escape character is configurable in the class instance using the EscapeChar property.

TMaskUTF8 provides an overridden Compile method which examines and converts the Mask expression into a list of op codes needed in Matches and MatchesWindowsMask.

See also

TMaskBase

  

Implements the base class used to define and evaluate a mask expression.

TMask

  

The TMask class represents a mask expression and performs comparisons.

TWindowsMaskUTF8

  

Implements a class used to define and evaluate a mask expression using Windows file system mask conventions.

TWindowsMask

  

Implements the class type used to evaluate and compare Windows-specific mask expressions.

Masks Overview

  

Masks Overview.


Version 4.0 Generated 2025-05-03 Home