mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-17 17:28:15 +02:00
LazUtils: Implement TMask.MatchesWindowsMask for backwards compatibility.
This commit is contained in:
parent
370e42c4e4
commit
c28cc988ec
@ -234,10 +234,12 @@ type
|
|||||||
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed);
|
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed);
|
||||||
constructor CreateLegacy(const aMask: String; aCaseSensitive: Boolean);
|
constructor CreateLegacy(const aMask: String; aCaseSensitive: Boolean);
|
||||||
constructor Create(const aMask: String; aOptions: TMaskOptions);
|
constructor Create(const aMask: String; aOptions: TMaskOptions);
|
||||||
deprecated 'Use CreateLegacy or Create with other params.'; // in Lazarus 2.3.
|
deprecated 'Use CreateLegacy or Create with other params.'; // in Lazarus 2.3, remove in 2.5.
|
||||||
|
|
||||||
procedure Compile; override;
|
procedure Compile; override;
|
||||||
function Matches(const aStringToMatch: String): Boolean; virtual;
|
function Matches(const aStringToMatch: String): Boolean; virtual;
|
||||||
|
function MatchesWindowsMask(const AFileName: String): Boolean;
|
||||||
|
deprecated 'Create with TMaskWindows.Create, then call Matches.'; // in Lazarus 2.3, remove in 2.5.
|
||||||
public
|
public
|
||||||
property Mask: String read cOriginalMask write cOriginalMask;
|
property Mask: String read cOriginalMask write cOriginalMask;
|
||||||
property OPCodesAllowed: TMaskOpcodesSet read cMaskOpcodesAllowed;// write cMaskOpcodesAllowed;
|
property OPCodesAllowed: TMaskOpcodesSet read cMaskOpcodesAllowed;// write cMaskOpcodesAllowed;
|
||||||
@ -307,7 +309,7 @@ function MatchesMask(const FileName, Mask: String; CaseSensitive: Boolean=False;
|
|||||||
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed): Boolean;
|
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed): Boolean;
|
||||||
function MatchesMaskLegacy(const FileName, Mask: String; CaseSensitive: Boolean=False): Boolean;
|
function MatchesMaskLegacy(const FileName, Mask: String; CaseSensitive: Boolean=False): Boolean;
|
||||||
function MatchesMask(const FileName, Mask: String; Options: TMaskOptions): Boolean;
|
function MatchesMask(const FileName, Mask: String; Options: TMaskOptions): Boolean;
|
||||||
deprecated 'Use MatchesMaskLegacy or MatchesMask with other params.'; // in Lazarus 2.3.
|
deprecated 'Use MatchesMaskLegacy or MatchesMask with other params.'; // in Lazarus 2.3, remove in 2.5.
|
||||||
|
|
||||||
function MatchesWindowsMask(const FileName, Mask: String; CaseSensitive: Boolean=False;
|
function MatchesWindowsMask(const FileName, Mask: String; CaseSensitive: Boolean=False;
|
||||||
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed;
|
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed;
|
||||||
@ -319,14 +321,14 @@ function MatchesMaskList(const FileName, Mask: String; Separator: Char=';';
|
|||||||
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed): Boolean;
|
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed): Boolean;
|
||||||
function MatchesMaskList(const FileName, Mask: String; Separator: Char;
|
function MatchesMaskList(const FileName, Mask: String; Separator: Char;
|
||||||
Options: TMaskOptions): Boolean;
|
Options: TMaskOptions): Boolean;
|
||||||
deprecated 'Use MatchesMaskList with other params.'; // in Lazarus 2.3.
|
deprecated 'Use MatchesMaskList with other params.'; // in Lazarus 2.3, remove in 2.5.
|
||||||
|
|
||||||
function MatchesWindowsMaskList(const FileName, Mask: String; Separator: Char=';';
|
function MatchesWindowsMaskList(const FileName, Mask: String; Separator: Char=';';
|
||||||
CaseSensitive: Boolean=False;
|
CaseSensitive: Boolean=False;
|
||||||
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed): Boolean;
|
aOpcodesAllowed: TMaskOpcodesSet=MaskOpCodesDefaultAllowed): Boolean;
|
||||||
function MatchesWindowsMaskList(const FileName, Mask: String; Separator: Char;
|
function MatchesWindowsMaskList(const FileName, Mask: String; Separator: Char;
|
||||||
Options: TMaskOptions): Boolean;
|
Options: TMaskOptions): Boolean;
|
||||||
deprecated 'Use MatchesWindowsMaskList with other params.'; // in Lazarus 2.3.
|
deprecated 'Use MatchesWindowsMaskList with other params.'; // in Lazarus 2.3, remove in 2.5.
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -944,6 +946,18 @@ begin
|
|||||||
Result:=false; // There are too many or not enough bytes to match the string
|
Result:=false; // There are too many or not enough bytes to match the string
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMaskUTF8.MatchesWindowsMask(const AFileName: String): Boolean;
|
||||||
|
var
|
||||||
|
WinMask: TMaskUTF8Windows;
|
||||||
|
begin
|
||||||
|
WinMask:=TMaskUTF8Windows.Create(cOriginalMask, CaseSensitive, OPCodesAllowed);
|
||||||
|
try
|
||||||
|
Result:=WinMask.Matches(AFileName);
|
||||||
|
finally
|
||||||
|
WinMask.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TMaskWindows }
|
{ TMaskWindows }
|
||||||
|
|
||||||
class procedure TMaskUTF8Windows.SplitFileNameExtension(
|
class procedure TMaskUTF8Windows.SplitFileNameExtension(
|
||||||
|
Loading…
Reference in New Issue
Block a user