codetools: added substring

git-svn-id: trunk@35657 -
This commit is contained in:
mattias 2012-03-03 00:22:26 +00:00
parent 8004b97fea
commit 95659a5d58
2 changed files with 16 additions and 2 deletions

View File

@ -200,6 +200,8 @@ function SearchNextInText(Search: PChar; SearchLen: PtrInt;
out MatchStart, MatchEnd: PtrInt;// 0 based
WholeWords: boolean = false; MultiLine: boolean = false): boolean;
// misc
function SubString(p: PChar; Count: SizeInt): string; overload;
// files
type
@ -5000,6 +5002,18 @@ begin
end;
end;
function SubString(p: PChar; Count: SizeInt): string;
var
l: SizeInt;
begin
if (p=nil) or (Count=0) then exit('');
l:=IndexByte(p,Count,0);
if l<0 then l:=Count;
if l=0 then exit('');
SetLength(Result,l);
System.Move(p^,Result[1],l);
end;
function GatherUnitFiles(const BaseDir, SearchPath,
Extensions: string; KeepDoubles, CaseInsensitive: boolean;
var TreeOfUnitFiles: TAVLTree): boolean;

View File

@ -636,10 +636,10 @@ begin
FCaseSensitive:=TheCaseSensitive;
if CaseSensitive then begin
FCompareKeyItemFunc:=@CompareStringAndStringToStringTreeItem;
FTree:=TAVLTree.Create(@CompareStringToStringItems);
FTree:=TMTAVLTree.Create(@CompareStringToStringItems);
end else begin
FCompareKeyItemFunc:=@CompareStringAndStringToStringTreeItemI;
FTree:=TAVLTree.Create(@CompareStringToStringItemsI);
FTree:=TMTAVLTree.Create(@CompareStringToStringItemsI);
end;
end;