Removed all LCL dependencies.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@947 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Joshy
2009-09-01 23:41:05 +00:00
parent 41aab444e0
commit d7c494635e
3 changed files with 90 additions and 40 deletions

View File

@ -6,9 +6,6 @@ interface
uses
Classes, SysUtils, strutils,
{$ifdef FPSUSELCL}
Graphics,
{$endif}
uvirtuallayer_types, uvirtuallayer_stream;
type
@ -60,10 +57,6 @@ type
function intfCopy(const ASourceFileName,ATargetFileName: UTF8String): Boolean; virtual;
function intfMove(const ASourceFileName,ATargetFileName: UTF8String): Boolean; virtual;
{$ifdef FPSUSELCL}
function IntfGetIcon(const APath: UTF8String): TIcon; virtual;
{$endif}
procedure Lock(); virtual;
procedure Unlock(); virtual;
public
@ -99,10 +92,6 @@ type
property RootLayer: TVirtualLayer read GetRootLayer;
property ParentLayer: TVirtualLayer read FParentLayer write SetParentLayer;
{$ifdef FPSUSELCL}
function GetIcon(const APath: UTF8String): TIcon;
{$endif}
Constructor Create(const AVirtualLayerStream: TStream);
procedure PrepareDestroy(); virtual;
Destructor Destroy(); override;
@ -563,14 +552,6 @@ begin
MountPath+RemoveRootPathDelimiter(ATargetFileName));
end;
{$ifdef FPSUSELCL}
function TVirtualLayer.IntfGetIcon(const APath: UTF8String): TIcon;
begin
Result:=nil;
if Length(APath)=0 then Result:=nil; //Avoid hint.
end;
{$endif}
function TVirtualLayer.AcrossLayersMove(const ASourceFileName,
ATargetFileName: UTF8String): Boolean;
begin
@ -829,21 +810,6 @@ begin
Unlock();
end;
{$ifdef FPSUSELCL}
function TVirtualLayer.GetIcon(const APath: UTF8String): TIcon;
var
VL: TVirtualLayer;
RemainPath: UTF8String;
begin
VL:=FindMounted(APath,RemainPath);
if Assigned(VL) Then begin
Result:=VL.IntfGetIcon(RemainPath);
end else begin
Result:=IntfGetIcon(APath);
end;
end;
{$endif}
function TVirtualLayer.PathToVirtualLayer(const APath: UTF8String
): TVirtualLayer;
var
@ -935,6 +901,7 @@ begin
Name:='';
ExcludeAttr:=0;
end;
//Hint non portable conversion, it should work, but not tested.
LHandle:=PFileRecLocal(Rlst.FindHandle);
FindL:=TVirtualLayer_FolderList(LHandle^.FL);
if Assigned(FindL) Then begin
@ -957,6 +924,7 @@ var
FindL: TVirtualLayer_FolderList;
LHandle: PFileRecLocal;
begin
//Hint: non portable conversion. Not tested but it should work.
LHandle:=PFileRecLocal(Rlst.FindHandle);
FindL:=TVirtualLayer_FolderList(LHandle^.FL);
if Assigned(FindL) Then FindL.Free;

View File

@ -64,9 +64,6 @@ interface
uses
Classes, SysUtils,
{.$ifdef FPSUSELCL}
Masks,
{.$endif}
uvirtuallayer_types, uvirtuallayer,
uvirtuallayer_ole_helpers, uvirtuallayer_ole_types;
@ -110,10 +107,10 @@ type
function intfRemoveFolder(const AFolder: UTF8String): Boolean; override;
//..Not implemented
procedure AfterConstruction; override;
public
procedure Format();
function Initialize():boolean; override;
procedure AfterConstruction; override;
destructor Destroy(); override;
end;
@ -305,7 +302,7 @@ function TVirtualLayer_OLE.intfFindList(const APath: UTF8String;
const AMask: UTF8String): TVirtualLayer_FolderList;
var
LI: TVirtualLayer_FolderList;
Mask: TMask;
Mask: TMaskFile;
SSID: SID;
function AddNamesWithSID(const AStartSibling: SID): SID;
var
@ -343,7 +340,7 @@ begin
Exit;
end;
Mask:=TMask.Create(AMask);
Mask:=TMaskFile.Create(AMask);
LI:=TVirtualLayer_FolderList.Create(APath);
AddNamesWithSID(SSID);

View File

@ -43,6 +43,17 @@ type
Context: TFATStreamContext;
end;
{ TMaskFile }
TMaskFile=class
private
protected
FMask: UTF8String;
public
function Matches(const AFileName: UTF8String): Boolean;
Constructor Create(const AMask: UTF8String);
end;
{ TFATIndirect }
TFATIndirect=class
@ -113,6 +124,8 @@ end;
implementation
function MatchesMask(What, Mask: string): boolean; forward;
procedure TFATIndirect.InitializeMiniDataStream();
var
RootDir: TWCBFStructuredStorageDirectoryEntry;
@ -1254,5 +1267,77 @@ begin
inherited Destroy;
end;
//Matches mask taken from FV package of FPC with little changes
function MatchesMask(What, Mask: string): boolean;
Function CmpStr(const hstr1,hstr2:string):boolean;
var
found : boolean;
i1,i2 : SizeInt;
begin
i1:=0;
i2:=0;
if hstr1='' then
begin
CmpStr:=(hstr2='');
exit;
end;
found:=true;
repeat
inc(i1);
if (i1>length(hstr1)) then
break;
inc(i2);
if (i2>length(hstr2)) then
break;
case hstr1[i1] of
'?' :
found:=true;
'*' :
begin
found:=true;
if (i1=length(hstr1)) then
i2:=length(hstr2)
else
if (i1<length(hstr1)) and (hstr1[i1+1]<>hstr2[i2]) then
begin
if i2<length(hstr2) then
dec(i1)
end
else
if i2>1 then
dec(i2);
end;
else
found:=(hstr1[i1]=hstr2[i2]) or (hstr2[i2]='?');
end;
until not found;
if found then
begin
found:=(i2>=length(hstr2)) and
(
(i1>length(hstr1)) or
((i1=length(hstr1)) and
(hstr1[i1]='*'))
);
end;
CmpStr:=found;
end;
begin
MatchesMask:=CmpStr(Mask,What);
end;
{ TMaskFile }
function TMaskFile.Matches(const AFileName: UTF8String): Boolean;
begin
Result:=MatchesMask(AFileName,FMask)
end;
constructor TMaskFile.Create(const AMask: UTF8String);
begin
FMask:=AMask;
end;
end.