Sign in Join
FPDoc Onlineexperiment

TMaskUTF8 class

In unit Masks

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

Declaration

pascal
TMaskUTF8 = class(TMaskBase)

Inheritance

  1. TMaskUTF8
  2. TMaskBase

Descends from it: TMask

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

Properties

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

Methods

IsSpecialCharprotectedIndicates if the specified character is a wildcard character, or used to represent set / range notation.
CompileOtherSpecialCharsprotectedHas an empty implementation in TMaskUTF8.
CompareUTF8SequencesprotectedIndicates the difference between UTF-8 codepoints in the specified values.
intfMatchesprotectedImplements the Matches method for the supported platform.
CreatepublicConstructor for the class instance.
CompilepublicExamines the mask expression and creates a list of op codes.
MatchespublicIndicates whether the specified value is a match for the Mask expression.

Fields

fOriginalMaskprotectedMember used for the mask expression passed to the constructor.

Inherited

From TMaskBase (16)

Add AutoReverseRange CaseSensitive DefaultSpecialChars EscapeChar Exception_IncompleteMask Exception_InternalError Exception_InvalidCharMask Exception_InvalidEscapeChar Exception_MissingCloseChar GROW_BY IncrementLastCounterBy MaskOpCodes PrepareCompile TMaskFailCause TMaskParsedCode

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.