Changeset 251
- Timestamp:
- Jun 13, 2011, 8:21:12 AM (13 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Common.lpk
r249 r251 6 6 <Author Value="Chronos (robie@centrum.cz)"/> 7 7 <CompilerOptions> 8 <Version Value=" 9"/>8 <Version Value="10"/> 9 9 <PathDelim Value="\"/> 10 10 <SearchPaths> … … 29 29 <Item3> 30 30 <Filename Value="UDebugLog.pas"/> 31 <HasRegisterProc Value="True"/> 31 32 <UnitName Value="UDebugLog"/> 32 33 </Item3> -
Common/Common.pas
r230 r251 8 8 9 9 uses 10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI,11 UThreading,LazarusPackageIntf;10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading, 11 LazarusPackageIntf; 12 12 13 13 implementation … … 15 15 procedure Register; 16 16 begin 17 RegisterUnit('UDebugLog', @UDebugLog.Register); 17 18 end; 18 19 -
Common/UDebugLog.pas
r250 r251 24 24 private 25 25 FFileName: string; 26 FMaxCount: Integer; 26 27 FOnNewItem: TNewItemEvent; 28 FWriteToFileEnable: Boolean; 29 procedure SetMaxCount(const AValue: Integer); 27 30 public 28 WriteToFileEnable: Boolean;29 31 Items: TThreadList; 30 MaxCount: Integer;31 32 procedure Add(Group: string; Text: string); 32 33 procedure WriteToFile(Text: string); 33 property OnNewItem: TNewItemEvent read FOnNewItem write FOnNewItem;34 34 constructor Create(AOwner: TComponent); override; 35 35 destructor Destroy; override; 36 36 published 37 property WriteToFileEnable: Boolean read FWriteToFileEnable 38 write FWriteToFileEnable; 37 39 property FileName: string read FFileName write FFileName; 40 property MaxCount: Integer read FMaxCount write SetMaxCount; 41 property OnNewItem: TNewItemEvent read FOnNewItem write FOnNewItem; 38 42 end; 39 43 40 var 41 DebugLog: TDebugLog; 44 procedure Register; 42 45 43 46 implementation 44 47 48 procedure Register; 49 begin 50 RegisterComponents('Common', [TDebugLog]); 51 end; 52 45 53 { TDebugLog } 54 55 procedure TDebugLog.SetMaxCount(const AValue: Integer); 56 var 57 List: TList; 58 I: Integer; 59 begin 60 if FMaxCount = AValue then Exit; 61 FMaxCount := AValue; 62 List := Items.LockList; 63 if List.Count > 0 then begin 64 for I := AValue to List.Count - 1 do 65 TDebugLogItem(List[I]).Free; 66 List.Count := AValue; 67 end; 68 Items.UnlockList; 69 end; 46 70 47 71 procedure TDebugLog.Add(Group: string; Text: string); -
Generics/TemplateGenerics/Generic/GenericList.inc
r247 r251 42 42 function GetArray: TGListItemArray; 43 43 function Implode(Separator: string; Converter: TGListToStringConverter): string; 44 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; 44 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; virtual; 45 45 function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex; 46 46 procedure Insert(Index: TGListIndex; Item: TGListItem); -
Generics/TemplateGenerics/Generic/GenericListString.inc
r112 r251 18 18 procedure Clear; override; 19 19 procedure Assign(Source: TGList); override; 20 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; override; 20 21 constructor Create; 21 22 destructor Destroy; override; … … 71 72 end; 72 73 74 function TGListString.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex; 75 begin 76 Result := Start; 77 while (Result < Count) and 78 (CompareStr(FItems[Result], Item) = -1) do 79 Result := Result + 1; 80 if Result = FCount then Result := -1; 81 end; 82 73 83 constructor TGListString.Create; 74 84 begin
Note:
See TracChangeset
for help on using the changeset viewer.