mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD/StashFS: step-9: improve StashFilesBackend
This commit is contained in:
parent
2347cc3f30
commit
89154db05d
1 changed files with 18 additions and 1 deletions
|
|
@ -21,6 +21,8 @@ type
|
|||
procedure addPath( const path: String );
|
||||
procedure removePath( const path: String );
|
||||
procedure clear;
|
||||
function count: Integer;
|
||||
procedure removePaths( const files: TFiles );
|
||||
function toFiles: TFiles;
|
||||
end;
|
||||
|
||||
|
|
@ -34,6 +36,8 @@ implementation
|
|||
constructor TStashFilesBackend.Create;
|
||||
begin
|
||||
_paths:= TStringList.Create;
|
||||
_paths.SortStyle:= sslAuto;
|
||||
_paths.Duplicates:= dupIgnore;
|
||||
end;
|
||||
|
||||
destructor TStashFilesBackend.Destroy;
|
||||
|
|
@ -50,7 +54,7 @@ procedure TStashFilesBackend.removePath(const path: String);
|
|||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i:= _paths.IndexOf( path );
|
||||
_paths.Find( path, i );
|
||||
if i >= 0 then
|
||||
_paths.Delete( i );
|
||||
end;
|
||||
|
|
@ -60,6 +64,19 @@ begin
|
|||
_paths.Clear;
|
||||
end;
|
||||
|
||||
function TStashFilesBackend.count: Integer;
|
||||
begin
|
||||
Result:= _paths.Count;
|
||||
end;
|
||||
|
||||
procedure TStashFilesBackend.removePaths(const files: TFiles);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:= 0 to files.Count-1 do
|
||||
self.removePath( files[i].FullPath );
|
||||
end;
|
||||
|
||||
function TStashFilesBackend.toFiles: TFiles;
|
||||
var
|
||||
files: TFiles;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue