mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 22:09:28 +02:00
BuildIntf, IdeIntf, LazUtils: Use a faster compare method for case-insensitive strings and StringLists.
git-svn-id: trunk@64464 -
This commit is contained in:
parent
6a07271f31
commit
e6d96156ec
@ -18,7 +18,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
// LazUtils
|
||||
LazMethodList,
|
||||
LazMethodList, LazUTF8,
|
||||
// BuildIntf
|
||||
IDEOptionsIntf;
|
||||
|
||||
@ -479,7 +479,7 @@ constructor TLazCompilationToolOptions.Create(TheOwner: TLazCompilerOptions);
|
||||
begin
|
||||
FOwner:=TheOwner;
|
||||
FCompileReasons:=crAll; // This default can be used in some comparisons.
|
||||
FParsers:=TStringList.Create;
|
||||
FParsers:=TStringListUTF8Fast.Create;
|
||||
end;
|
||||
|
||||
destructor TLazCompilationToolOptions.Destroy;
|
||||
|
@ -681,12 +681,12 @@ type
|
||||
FHint: string;
|
||||
FQuiet: boolean;
|
||||
FResolveMacros: boolean;
|
||||
FParsers: TStrings;
|
||||
FParserNames: TStrings;
|
||||
FShowConsole: boolean;
|
||||
fTitle: string;
|
||||
fWorkingDirectory: string;
|
||||
procedure SetEnvironmentOverrides(AValue: TStringList);
|
||||
procedure SetParsers(AValue: TStrings);
|
||||
procedure SetParserNames(AValue: TStrings);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -701,8 +701,7 @@ type
|
||||
property CmdLineParams: string read fCmdLineParams write fCmdLineParams;
|
||||
property WorkingDirectory: string read fWorkingDirectory write fWorkingDirectory;
|
||||
property EnvironmentOverrides: TStringList read FEnvironmentOverrides write SetEnvironmentOverrides;
|
||||
property Scanners: TStrings read FParsers; deprecated 'use Parsers';
|
||||
property Parsers: TStrings read FParsers write SetParsers;
|
||||
property Parsers: TStrings read FParserNames write SetParserNames;
|
||||
property ShowConsole: boolean read FShowConsole write FShowConsole default false; // sets poNoConsole/poNewConsole, works only on MSWindows
|
||||
property HideWindow: boolean read FHideWindow write FHideWindow default true; // sets/unsets swoHide/swoShow, works only on MSWindows
|
||||
property ResolveMacros: boolean read FResolveMacros write FResolveMacros default true;
|
||||
@ -819,24 +818,24 @@ begin
|
||||
FEnvironmentOverrides.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.SetParsers(AValue: TStrings);
|
||||
procedure TIDEExternalToolOptions.SetParserNames(AValue: TStrings);
|
||||
begin
|
||||
if FParsers.Equals(AValue) then Exit;
|
||||
FParsers.Assign(AValue);
|
||||
if FParserNames.Equals(AValue) then Exit;
|
||||
FParserNames.Assign(AValue);
|
||||
end;
|
||||
|
||||
constructor TIDEExternalToolOptions.Create;
|
||||
begin
|
||||
ResolveMacros:=true;
|
||||
FEnvironmentOverrides:=TStringList.Create;
|
||||
FParsers:=TStringList.Create;
|
||||
FParserNames:=TStringList.Create;
|
||||
FHideWindow:=true;
|
||||
end;
|
||||
|
||||
destructor TIDEExternalToolOptions.Destroy;
|
||||
begin
|
||||
FreeAndNil(FEnvironmentOverrides);
|
||||
FreeAndNil(FParsers);
|
||||
FreeAndNil(FParserNames);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -886,7 +885,7 @@ begin
|
||||
FShowConsole:=false;
|
||||
FHideWindow:=true;
|
||||
FResolveMacros:=true;
|
||||
FParsers.Clear;
|
||||
FParserNames.Clear;
|
||||
fTitle:='';
|
||||
fWorkingDirectory:='';
|
||||
FQuiet:=false;
|
||||
|
@ -28,6 +28,8 @@ uses
|
||||
// LCL
|
||||
LCLType, LCLProc, Forms, Controls, Dialogs, ExtCtrls, StdCtrls,
|
||||
Graphics, Menus, ComCtrls, DBActns, StdActns, ActnList, ImgList,
|
||||
// LazUtils
|
||||
LazLoggerBase, LazUTF8,
|
||||
// IDEIntf
|
||||
ObjInspStrConsts, ComponentEditors, PropEdits, PropEditUtils, IDEWindowIntf,
|
||||
IDEImagesIntf;
|
||||
@ -1334,17 +1336,17 @@ end;
|
||||
procedure TActionCategoryProperty.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
Values: TStringList;
|
||||
Act:TContainedAction;
|
||||
ActLst:TCustomActionList;
|
||||
S:string;
|
||||
Values: TStringListUTF8Fast;
|
||||
Act: TContainedAction;
|
||||
ActLst: TCustomActionList;
|
||||
S: string;
|
||||
begin
|
||||
ActLst:=nil;
|
||||
Act:=GetComponent(0) as TContainedAction;
|
||||
if Assigned(Act) then
|
||||
ActLst:=Act.ActionList;
|
||||
if not Assigned(ActLst) then exit;
|
||||
Values := TStringList.Create;
|
||||
Values := TStringListUTF8Fast.Create;
|
||||
try
|
||||
for i:=0 to ActLst.ActionCount-1 do
|
||||
begin
|
||||
|
@ -5,7 +5,9 @@ unit bufdatasetdsgn;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, DB, bufdataset, ComponentEditors, FieldsEditor, ObjInspStrConsts;
|
||||
Classes, SysUtils, DB, bufdataset,
|
||||
LazUTF8,
|
||||
ComponentEditors, FieldsEditor, ObjInspStrConsts;
|
||||
|
||||
Type
|
||||
|
||||
@ -113,7 +115,7 @@ begin
|
||||
if not Assigned(Designer.PropertyEditorHook) then
|
||||
exit;
|
||||
FreeAndNil(FDatasetNames); // Free previous instance if any
|
||||
FDatasetNames:=TStringList.Create;
|
||||
FDatasetNames:=TStringListUTF8Fast.Create;
|
||||
Designer.PropertyEditorHook.GetComponentNames(GetTypeData(TypeInfo(TDataset)),@GetDatasetNames);
|
||||
Idx:=FDatasetNames.IndexOf(aBufDS.Name);
|
||||
if Idx<>-1 then
|
||||
|
@ -231,6 +231,7 @@ var
|
||||
begin
|
||||
ControlsCount := 0;
|
||||
CurParentNameList := TStringList.Create;
|
||||
CurParentNameList.UseLocale := False;
|
||||
|
||||
for i:=0 to ASelection.Count-1 do
|
||||
if ASelection.Items[i] is TControl then
|
||||
|
@ -28,7 +28,7 @@ uses
|
||||
// LCL
|
||||
Controls,
|
||||
// LazUtils
|
||||
LazUtilities, LazLoggerBase, Laz2_XMLCfg, LazMethodList;
|
||||
LazUtilities, LazLoggerBase, Laz2_XMLCfg, LazMethodList, LazUTF8;
|
||||
|
||||
type
|
||||
TComponentPriorityCategory = (
|
||||
@ -228,7 +228,7 @@ type
|
||||
fOrigComponentPageCache: TStringList; // Original
|
||||
fUserComponentPageCache: TStringList; // User ordered
|
||||
// Used to find names that differ in character case only.
|
||||
fOrigPageHelper: TStringList;
|
||||
fOrigPageHelper: TStringListUTF8Fast;
|
||||
fHandlers: array[TComponentPaletteHandlerType] of TMethodList;
|
||||
fComponentPageClass: TBaseComponentPageClass;
|
||||
fSelected: TRegisteredComponent;
|
||||
@ -426,9 +426,9 @@ end;
|
||||
constructor TCompPaletteOptions.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FPageNamesCompNames := TStringList.Create;
|
||||
FPageNamesCompNames := TStringListUTF8Fast.Create;
|
||||
FPageNamesCompNames.OwnsObjects := True;
|
||||
FHiddenPageNames := TStringList.Create;
|
||||
FHiddenPageNames := TStringListUTF8Fast.Create;
|
||||
FVisible := True;
|
||||
end;
|
||||
|
||||
@ -475,9 +475,9 @@ end;
|
||||
|
||||
function TCompPaletteOptions.IsDefault: Boolean;
|
||||
begin
|
||||
Result := (PageNames.Count = 0)
|
||||
Result := (FPageNames.Count = 0)
|
||||
and (FPageNamesCompNames.Count = 0)
|
||||
and (HiddenPageNames.Count = 0);
|
||||
and (FHiddenPageNames.Count = 0);
|
||||
end;
|
||||
|
||||
procedure TCompPaletteOptions.Load(XMLConfig: TXMLConfig; Path: String);
|
||||
@ -600,7 +600,7 @@ constructor TCompPaletteUserOrder.Create(aPalette: TBaseComponentPalette);
|
||||
begin
|
||||
inherited Create;
|
||||
fPalette:=aPalette;
|
||||
FComponentPages := TStringList.Create;
|
||||
FComponentPages := TStringListUTF8Fast.Create;
|
||||
FComponentPages.OwnsObjects := True;
|
||||
end;
|
||||
|
||||
@ -679,13 +679,13 @@ begin
|
||||
Clear;
|
||||
fPalette.CacheOrigComponentPages;
|
||||
// First add user defined page order from EnvironmentOptions,
|
||||
FComponentPages.Assign(fOptions.PageNames);
|
||||
FComponentPages.Assign(fOptions.FPageNames);
|
||||
// then add other pages which don't have user configuration
|
||||
for PageI := 0 to fPalette.OrigPagePriorities.Count-1 do
|
||||
begin
|
||||
PgName:=fPalette.OrigPagePriorities.Keys[PageI];
|
||||
if (FComponentPages.IndexOf(PgName) = -1)
|
||||
and (fOptions.HiddenPageNames.IndexOf(PgName) = -1) then
|
||||
and (fOptions.FHiddenPageNames.IndexOf(PgName) = -1) then
|
||||
FComponentPages.Add(PgName);
|
||||
end;
|
||||
// Map components with their pages
|
||||
@ -802,13 +802,15 @@ begin
|
||||
fComponentCache:=TAVLTree.Create(@CompareIDEComponentByClass);
|
||||
fOrigComponentPageCache:=TStringList.Create;
|
||||
fOrigComponentPageCache.OwnsObjects:=True;
|
||||
fOrigComponentPageCache.UseLocale:=False;
|
||||
fOrigComponentPageCache.CaseSensitive:=True;
|
||||
fOrigComponentPageCache.Sorted:=True;
|
||||
fUserComponentPageCache:=TStringList.Create;
|
||||
fUserComponentPageCache.OwnsObjects:=True;
|
||||
fUserComponentPageCache.UseLocale:=False;
|
||||
fUserComponentPageCache.CaseSensitive:=True;
|
||||
fUserComponentPageCache.Sorted:=True;
|
||||
fOrigPageHelper:=TStringList.Create; // Note: CaseSensitive = False
|
||||
fOrigPageHelper:=TStringListUTF8Fast.Create; // Note: CaseSensitive = False
|
||||
fOrigPageHelper.Sorted:=True;
|
||||
fLastFoundCompClassName:='';
|
||||
fLastFoundRegComp:=Nil;
|
||||
|
@ -141,6 +141,7 @@ var
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.SetSelectedProps');
|
||||
L:=TStringList.Create;
|
||||
L.UseLocale:=False;
|
||||
Try
|
||||
L.Delimiter:=';';
|
||||
L.DelimitedText:=AValue;
|
||||
|
@ -458,7 +458,7 @@ type
|
||||
|
||||
TIDEWindowsGlobalOptions = class
|
||||
private
|
||||
FList: TStringList;
|
||||
FOptList: TStringListUTF8Fast;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -568,22 +568,21 @@ procedure TIDEWindowsGlobalOptions.Add(const aFormIDPrefix: string;
|
||||
var
|
||||
xIndex: Integer;
|
||||
begin
|
||||
xIndex := FList.Add(aFormIDPrefix);
|
||||
if FList.Objects[xIndex] = nil then
|
||||
FList.Objects[xIndex] := TIDEWindowGlobalOption.Create;
|
||||
xIndex := FOptList.Add(aFormIDPrefix);
|
||||
if FOptList.Objects[xIndex] = nil then
|
||||
FOptList.Objects[xIndex] := TIDEWindowGlobalOption.Create;
|
||||
|
||||
TIDEWindowGlobalOption(FList.Objects[xIndex]).CanSetVisibility := CanSetVisibility;
|
||||
TIDEWindowGlobalOption(FOptList.Objects[xIndex]).CanSetVisibility := CanSetVisibility;
|
||||
end;
|
||||
|
||||
function TIDEWindowsGlobalOptions.CanSetVisibility(const aFormID: string
|
||||
): Boolean;
|
||||
function TIDEWindowsGlobalOptions.CanSetVisibility(const aFormID: string): Boolean;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to FList.Count-1 do
|
||||
if Copy(aFormID, 1, Length(FList[I])) = FList[I] then
|
||||
for I := 0 to FOptList.Count-1 do
|
||||
if Copy(aFormID, 1, Length(FOptList[I])) = FOptList[I] then
|
||||
begin
|
||||
Result := TIDEWindowGlobalOption(FList.Objects[I]).CanSetVisibility;
|
||||
Result := TIDEWindowGlobalOption(FOptList.Objects[I]).CanSetVisibility;
|
||||
Exit;
|
||||
end;
|
||||
Result := True;//default is true
|
||||
@ -593,14 +592,14 @@ constructor TIDEWindowsGlobalOptions.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FList := TStringList.Create;
|
||||
FList.Sorted := True;
|
||||
FList.OwnsObjects := True;
|
||||
FOptList := TStringListUTF8Fast.Create;
|
||||
FOptList.Sorted := True;
|
||||
FOptList.OwnsObjects := True;
|
||||
end;
|
||||
|
||||
destructor TIDEWindowsGlobalOptions.Destroy;
|
||||
begin
|
||||
FList.Free;
|
||||
FOptList.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
|
@ -38,7 +38,7 @@ uses
|
||||
{$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF}
|
||||
TreeFilterEdit, ListFilterEdit,
|
||||
// LazUtils
|
||||
GraphType, LazConfigStorage, LazLoggerBase,
|
||||
GraphType, LazConfigStorage, LazLoggerBase, LazUTF8,
|
||||
// IdeIntf
|
||||
IDEImagesIntf, IDEHelpIntf, ObjInspStrConsts,
|
||||
PropEdits, PropEditUtils, ComponentTreeView, OIFavoriteProperties,
|
||||
@ -297,7 +297,7 @@ type
|
||||
FItemIndex: integer;
|
||||
FNameFont, FDefaultValueFont, FValueFont, FHighlightFont: TFont;
|
||||
FValueDifferBackgrndColor: TColor;
|
||||
FNewComboBoxItems: TStringList;
|
||||
FNewComboBoxItems: TStringListUTF8Fast;
|
||||
FOnModified: TNotifyEvent;
|
||||
FRows: TFPList;// list of TOIPropertyGridRow
|
||||
FSelection: TPersistentSelectionList;
|
||||
@ -2031,7 +2031,7 @@ end;
|
||||
procedure TOICustomPropertyGrid.AddStringToComboBox(const s: string);
|
||||
begin
|
||||
if FNewComboBoxItems=nil then
|
||||
FNewComboBoxItems:=TStringList.Create;
|
||||
FNewComboBoxItems:=TStringListUTF8Fast.Create;
|
||||
FNewComboBoxItems.Add(s);
|
||||
end;
|
||||
|
||||
|
@ -2735,6 +2735,7 @@ var
|
||||
begin
|
||||
if not AutoFill then Exit;
|
||||
Values:=TStringList.Create;
|
||||
Values.UseLocale := False;
|
||||
Values.Sorted:=paSortList in GetAttributes;
|
||||
try
|
||||
AddValue := @Values.Add;
|
||||
|
@ -92,7 +92,7 @@ type
|
||||
FAccessClass: string;
|
||||
FAncestor: TPersistent;
|
||||
FAncestorPos: Integer;
|
||||
FAncestors: TStringList;
|
||||
FAncestors: TStringListUTF8Fast;
|
||||
FAssignOp: String;
|
||||
FCurIndent: integer;
|
||||
FCurrentPos: Integer;
|
||||
@ -499,7 +499,7 @@ procedure TCompWriterPas.WriteChildren(Component: TComponent;
|
||||
Step: TCWPChildrenStep);
|
||||
var
|
||||
SRoot, SRootA, SParent: TComponent;
|
||||
SList: TStringList;
|
||||
SList: TStringListUTF8Fast;
|
||||
SPos, i, SAncestorPos: Integer;
|
||||
begin
|
||||
// Write children list.
|
||||
@ -520,7 +520,7 @@ begin
|
||||
FRoot:=Component;
|
||||
if (FAncestor is TComponent) then
|
||||
begin
|
||||
FAncestors:=TStringList.Create;
|
||||
FAncestors:=TStringListUTF8Fast.Create;
|
||||
if csInline in TComponent(FAncestor).ComponentState then
|
||||
FRootAncestor := TComponent(FAncestor);
|
||||
TAccessComp(FAncestor).GetChildren(@AddToAncestorList,FRootAncestor);
|
||||
@ -1444,7 +1444,7 @@ begin
|
||||
FMaxColumn:=CSPDefaultMaxColumn;
|
||||
FExecCustomProc:=CSPDefaultExecCustomProc;
|
||||
FExecCustomProcUnit:=CSPDefaultExecCustomProcUnit;
|
||||
FNeededUnits:=TStringList.Create;
|
||||
FNeededUnits:=TStringListUTF8Fast.Create;
|
||||
FAccessClass:=CSPDefaultAccessClass;
|
||||
C:=TAccessComp.Create(nil);
|
||||
FDefaultDefineProperties:=TMethod(@C.DefineProperties).Code;
|
||||
|
@ -15,7 +15,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
// LazUtils
|
||||
LazLoggerBase, LazSysUtils;
|
||||
LazLoggerBase, LazSysUtils, LazUTF8;
|
||||
|
||||
type
|
||||
|
||||
@ -75,8 +75,8 @@ function DbgsTimeUsed(AFormat: String; AName: String): string;
|
||||
implementation
|
||||
|
||||
var
|
||||
NamedMemWatches: TStringList = nil;
|
||||
NamedTimer: TStringList = nil;
|
||||
NamedMemWatches: TStringListUTF8Fast = nil;
|
||||
NamedTimer: TStringListUTF8Fast = nil;
|
||||
NamedMemWatchesData: Array of record Sum, Last: Int64; end;
|
||||
NamedTimerData: array of record Sum, Last: QWord; end;
|
||||
|
||||
@ -144,7 +144,7 @@ var
|
||||
idx: Integer;
|
||||
begin
|
||||
if NamedTimer = nil then begin
|
||||
NamedTimer := TStringList.Create;
|
||||
NamedTimer := TStringListUTF8Fast.Create;
|
||||
NamedTimer.Sorted := True;
|
||||
NamedTimer.Duplicates := dupError;
|
||||
end;
|
||||
@ -180,7 +180,7 @@ var
|
||||
idx: Integer;
|
||||
begin
|
||||
if NamedMemWatches = nil then begin
|
||||
NamedMemWatches := TStringList.Create;
|
||||
NamedMemWatches := TStringListUTF8Fast.Create;
|
||||
NamedMemWatches.Sorted := True;
|
||||
NamedMemWatches.Duplicates := dupError;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user