2006-01-07 19:56:40 +00:00
|
|
|
{: Implements unit filtering visitors.
|
|
|
|
|
|
|
|
Last changed: $Date$
|
|
|
|
Revision: $Rev$
|
|
|
|
Author: $Author$
|
|
|
|
}
|
2006-01-05 21:04:59 +00:00
|
|
|
unit UnSwFilters;
|
|
|
|
|
|
|
|
interface
|
|
|
|
uses
|
2007-02-16 17:19:22 +00:00
|
|
|
Classes,
|
2006-01-05 21:04:59 +00:00
|
|
|
|
2007-12-07 15:33:00 +00:00
|
|
|
BaseSwFilters,
|
|
|
|
BaseSwObjects,
|
|
|
|
UnSwObjects;
|
2006-01-05 21:04:59 +00:00
|
|
|
|
|
|
|
|
2007-12-07 15:33:00 +00:00
|
|
|
type
|
|
|
|
TUnSwUnitSimpleFormNameFilter = class(TBaseSwItemSimpleNameFilter, IUnSwVisitor)
|
2006-01-06 05:57:45 +00:00
|
|
|
protected
|
2007-12-07 15:33:00 +00:00
|
|
|
procedure VisitModule(const AUnit: TUnSwModuleUnit);
|
|
|
|
procedure VisitProject(const AUnit: TUnSwProjectUnit);
|
2006-01-06 05:57:45 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
|
2007-12-09 12:02:11 +00:00
|
|
|
TUnSwUnitTypeFilter = class(TBaseSwItemFilter, IBaseSwVisitor, IUnSwVisitor)
|
2006-01-05 21:04:59 +00:00
|
|
|
private
|
|
|
|
FIncludeDataModules: Boolean;
|
|
|
|
FIncludeForms: Boolean;
|
|
|
|
FIncludeProjectSource: Boolean;
|
|
|
|
FIncludeUnits: Boolean;
|
|
|
|
protected
|
2007-12-07 15:33:00 +00:00
|
|
|
procedure VisitModule(const AUnit: TUnSwModuleUnit);
|
|
|
|
procedure VisitProject(const AUnit: TUnSwProjectUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
public
|
2007-12-09 12:02:11 +00:00
|
|
|
constructor Create();
|
2006-01-05 21:04:59 +00:00
|
|
|
|
|
|
|
property IncludeDataModules: Boolean read FIncludeDataModules write FIncludeDataModules;
|
|
|
|
property IncludeForms: Boolean read FIncludeForms write FIncludeForms;
|
|
|
|
property IncludeProjectSource: Boolean read FIncludeProjectSource write FIncludeProjectSource;
|
|
|
|
property IncludeUnits: Boolean read FIncludeUnits write FIncludeUnits;
|
|
|
|
end;
|
|
|
|
|
2007-12-07 15:33:00 +00:00
|
|
|
|
2006-01-05 21:04:59 +00:00
|
|
|
implementation
|
|
|
|
uses
|
|
|
|
SysUtils;
|
2007-02-09 13:58:37 +00:00
|
|
|
|
2006-01-05 21:04:59 +00:00
|
|
|
|
2007-12-07 15:33:00 +00:00
|
|
|
{ TUnSwUnitSimpleFormNameFilter }
|
|
|
|
procedure TUnSwUnitSimpleFormNameFilter.VisitModule(const AUnit: TUnSwModuleUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
begin
|
2006-01-06 05:57:45 +00:00
|
|
|
if (Length(Filter) > 0) and
|
2007-12-07 15:33:00 +00:00
|
|
|
(AnsiPos(Filter, LowerCase(AUnit.FormName)) = 0) then
|
|
|
|
FilterItem(AUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
end;
|
|
|
|
|
2006-01-06 05:57:45 +00:00
|
|
|
|
2007-12-07 15:33:00 +00:00
|
|
|
procedure TUnSwUnitSimpleFormNameFilter.VisitProject(const AUnit: TUnSwProjectUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
begin
|
2007-12-07 15:33:00 +00:00
|
|
|
VisitItem(AUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{ TUnSwUnitTypeFilter }
|
2007-12-09 12:02:11 +00:00
|
|
|
constructor TUnSwUnitTypeFilter.Create();
|
2006-01-05 21:04:59 +00:00
|
|
|
begin
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
FIncludeDataModules := True;
|
|
|
|
FIncludeForms := True;
|
|
|
|
FIncludeProjectSource := True;
|
|
|
|
FIncludeUnits := True;
|
|
|
|
end;
|
|
|
|
|
2007-02-09 13:58:37 +00:00
|
|
|
|
2006-01-05 21:04:59 +00:00
|
|
|
procedure TUnSwUnitTypeFilter.VisitModule(const AUnit: TUnSwModuleUnit);
|
|
|
|
var
|
2006-01-07 19:56:40 +00:00
|
|
|
validTypes: TUnSwUnitTypes;
|
2006-01-05 21:04:59 +00:00
|
|
|
|
|
|
|
begin
|
2006-01-07 19:56:40 +00:00
|
|
|
validTypes := [];
|
2006-01-05 21:04:59 +00:00
|
|
|
|
|
|
|
if FIncludeDataModules then
|
2006-01-07 19:56:40 +00:00
|
|
|
Include(validTypes, swutDataModule);
|
2006-01-05 21:04:59 +00:00
|
|
|
|
|
|
|
if FIncludeForms then
|
2006-01-07 19:56:40 +00:00
|
|
|
Include(validTypes, swutForm);
|
2006-01-05 21:04:59 +00:00
|
|
|
|
|
|
|
if FIncludeUnits then
|
2006-01-07 19:56:40 +00:00
|
|
|
Include(validTypes, swutUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
|
2006-01-07 19:56:40 +00:00
|
|
|
if not (AUnit.UnitType in validTypes) then
|
2007-12-07 15:33:00 +00:00
|
|
|
FilterItem(AUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
end;
|
|
|
|
|
2007-02-09 13:58:37 +00:00
|
|
|
|
2006-01-05 21:04:59 +00:00
|
|
|
procedure TUnSwUnitTypeFilter.VisitProject(const AUnit: TUnSwProjectUnit);
|
|
|
|
begin
|
|
|
|
if not FIncludeProjectSource then
|
2007-12-07 15:33:00 +00:00
|
|
|
FilterItem(AUnit);
|
2006-01-05 21:04:59 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|