|
@@ -17,7 +17,6 @@ interface
|
|
uses
|
|
uses
|
|
System.Classes,
|
|
System.Classes,
|
|
System.SysUtils,
|
|
System.SysUtils,
|
|
-
|
|
|
|
GLS.Strings;
|
|
GLS.Strings;
|
|
|
|
|
|
type
|
|
type
|
|
@@ -25,7 +24,7 @@ type
|
|
PObject = ^TObject;
|
|
PObject = ^TObject;
|
|
|
|
|
|
//Virtual layer similar to VCL's TReader (but reusable)
|
|
//Virtual layer similar to VCL's TReader (but reusable)
|
|
- TVirtualReader = class
|
|
|
|
|
|
+ TGLVirtualReader = class
|
|
private
|
|
private
|
|
FStream: TStream;
|
|
FStream: TStream;
|
|
public
|
|
public
|
|
@@ -45,7 +44,7 @@ type
|
|
end;
|
|
end;
|
|
|
|
|
|
//Virtual layer similar to VCL's TWriter (but reusable)
|
|
//Virtual layer similar to VCL's TWriter (but reusable)
|
|
- TVirtualWriter = class
|
|
|
|
|
|
+ TGLVirtualWriter = class
|
|
private
|
|
private
|
|
FStream: TStream;
|
|
FStream: TStream;
|
|
public
|
|
public
|
|
@@ -61,17 +60,16 @@ type
|
|
procedure WriteTStrings(const aStrings: TStrings; storeObjects: Boolean = True);
|
|
procedure WriteTStrings(const aStrings: TStrings; storeObjects: Boolean = True);
|
|
end;
|
|
end;
|
|
|
|
|
|
- TVirtualReaderClass = class of TVirtualReader;
|
|
|
|
- TVirtualWriterClass = class of TVirtualWriter;
|
|
|
|
|
|
+ TVirtualReaderClass = class of TGLVirtualReader;
|
|
|
|
+ TVirtualWriterClass = class of TGLVirtualWriter;
|
|
|
|
|
|
(*Interface for persistent objects.
|
|
(*Interface for persistent objects.
|
|
This interface does not really allow polymorphic persistence,
|
|
This interface does not really allow polymorphic persistence,
|
|
- but is rather intended as a way to unify persistence calls
|
|
|
|
- for iterators *)
|
|
|
|
- IPersistentObject = interface(IInterface)
|
|
|
|
|
|
+ but is rather intended as a way to unify persistence calls for iterators *)
|
|
|
|
+ IGLPersistentObject = interface(IInterface)
|
|
['{A9A0198A-F11B-4325-A92C-2F24DB41652B}']
|
|
['{A9A0198A-F11B-4325-A92C-2F24DB41652B}']
|
|
- procedure WriteToFiler(writer: TVirtualWriter);
|
|
|
|
- procedure ReadFromFiler(reader: TVirtualReader);
|
|
|
|
|
|
+ procedure WriteToFiler(writer: TGLVirtualWriter);
|
|
|
|
+ procedure ReadFromFiler(reader: TGLVirtualReader);
|
|
end;
|
|
end;
|
|
|
|
|
|
(* Base class for persistent objects.
|
|
(* Base class for persistent objects.
|
|
@@ -80,9 +78,9 @@ type
|
|
file or string), assignment and cloning.
|
|
file or string), assignment and cloning.
|
|
The other requirement being the use of a virtual constructor, which allows
|
|
The other requirement being the use of a virtual constructor, which allows
|
|
polymorphic construction (don't forget to register your subclasses).
|
|
polymorphic construction (don't forget to register your subclasses).
|
|
- Note that TPersistentObject implements IUnknown, but does *not* implement
|
|
|
|
|
|
+ Note that TGLPersistentObject implements IUnknown, but does *not* implement
|
|
reference counting *)
|
|
reference counting *)
|
|
- TPersistentObject = class(TPersistent, IPersistentObject)
|
|
|
|
|
|
+ TGLPersistentObject = class(TPersistent, IGLPersistentObject)
|
|
protected
|
|
protected
|
|
procedure RaiseFilerException(const archiveVersion: Integer);
|
|
procedure RaiseFilerException(const archiveVersion: Integer);
|
|
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
|
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
|
@@ -90,15 +88,15 @@ type
|
|
function _Release: Integer; stdcall;
|
|
function _Release: Integer; stdcall;
|
|
public
|
|
public
|
|
constructor Create; virtual;
|
|
constructor Create; virtual;
|
|
- constructor CreateFromFiler(reader: TVirtualReader);
|
|
|
|
|
|
+ constructor CreateFromFiler(reader: TGLVirtualReader);
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
procedure Assign(source: TPersistent); override;
|
|
procedure Assign(source: TPersistent); override;
|
|
- function CreateClone: TPersistentObject; dynamic;
|
|
|
|
|
|
+ function CreateClone: TGLPersistentObject; dynamic;
|
|
class function FileSignature: string; virtual;
|
|
class function FileSignature: string; virtual;
|
|
class function FileVirtualWriter: TVirtualWriterClass; virtual;
|
|
class function FileVirtualWriter: TVirtualWriterClass; virtual;
|
|
class function FileVirtualReader: TVirtualReaderClass; virtual;
|
|
class function FileVirtualReader: TVirtualReaderClass; virtual;
|
|
- procedure WriteToFiler(writer: TVirtualWriter); dynamic;
|
|
|
|
- procedure ReadFromFiler(reader: TVirtualReader); dynamic;
|
|
|
|
|
|
+ procedure WriteToFiler(writer: TGLVirtualWriter); dynamic;
|
|
|
|
+ procedure ReadFromFiler(reader: TGLVirtualReader); dynamic;
|
|
procedure SaveToStream(stream: TStream; writerClass: TVirtualWriterClass = nil); dynamic;
|
|
procedure SaveToStream(stream: TStream; writerClass: TVirtualWriterClass = nil); dynamic;
|
|
procedure LoadFromStream(stream: TStream; readerClass: TVirtualReaderClass = nil); dynamic;
|
|
procedure LoadFromStream(stream: TStream; readerClass: TVirtualReaderClass = nil); dynamic;
|
|
procedure SaveToFile(const fileName: string; writerClass: TVirtualWriterClass = nil); dynamic;
|
|
procedure SaveToFile(const fileName: string; writerClass: TVirtualWriterClass = nil); dynamic;
|
|
@@ -107,10 +105,11 @@ type
|
|
procedure LoadFromString(const data: string; readerClass: TVirtualReaderClass = nil); dynamic;
|
|
procedure LoadFromString(const data: string; readerClass: TVirtualReaderClass = nil); dynamic;
|
|
end;
|
|
end;
|
|
|
|
|
|
- TPersistentObjectClass = class of TPersistentObject;
|
|
|
|
|
|
+ TPersistentObjectClass = class of TGLPersistentObject;
|
|
|
|
+
|
|
|
|
+ PGLPointerObjectList = ^TGLPointerObjectList;
|
|
|
|
+ TGLPointerObjectList = array[0..MaxInt div (2*SizeOf(Pointer))] of TObject;
|
|
|
|
|
|
- TPointerObjectList = array[0..MaxInt div (2*SizeOf(Pointer))] of TObject;
|
|
|
|
- PPointerObjectList = ^TPointerObjectList;
|
|
|
|
TObjectListSortCompare = function(item1, item2: TObject): Integer;
|
|
TObjectListSortCompare = function(item1, item2: TObject): Integer;
|
|
|
|
|
|
(*A persistent Object list.
|
|
(*A persistent Object list.
|
|
@@ -118,13 +117,13 @@ type
|
|
persistence of contained data. Unlike the VCL's TObjectList, this one
|
|
persistence of contained data. Unlike the VCL's TObjectList, this one
|
|
does NOT free its objects upon destruction or Clear, use Clean and CleanFree
|
|
does NOT free its objects upon destruction or Clear, use Clean and CleanFree
|
|
for that, and as such can be used for object referral lists too.
|
|
for that, and as such can be used for object referral lists too.
|
|
- But only TPersistentObject items will be streamed appropriately.
|
|
|
|
|
|
+ But only TGLPersistentObject items will be streamed appropriately.
|
|
The list can be used in a stack-like fashion with Push & Pop, and can
|
|
The list can be used in a stack-like fashion with Push & Pop, and can
|
|
perform basic boolean set operations.
|
|
perform basic boolean set operations.
|
|
Note: the IndexOf implementation is up to 3 times faster than that of TList *)
|
|
Note: the IndexOf implementation is up to 3 times faster than that of TList *)
|
|
- TPersistentObjectList = class(TPersistentObject)
|
|
|
|
|
|
+ TGLPersistentObjectList = class(TGLPersistentObject)
|
|
private
|
|
private
|
|
- FList: PPointerObjectList;
|
|
|
|
|
|
+ FList: PGLPointerObjectList;
|
|
FCount: Integer;
|
|
FCount: Integer;
|
|
FCapacity: Integer;
|
|
FCapacity: Integer;
|
|
FGrowthDelta: Integer;
|
|
FGrowthDelta: Integer;
|
|
@@ -144,9 +143,9 @@ type
|
|
public
|
|
public
|
|
constructor Create; override;
|
|
constructor Create; override;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
- procedure WriteToFiler(writer: TVirtualWriter); override;
|
|
|
|
- procedure ReadFromFiler(reader: TVirtualReader); override;
|
|
|
|
- procedure ReadFromFilerWithEvent(reader: TVirtualReader;
|
|
|
|
|
|
+ procedure WriteToFiler(writer: TGLVirtualWriter); override;
|
|
|
|
+ procedure ReadFromFiler(reader: TGLVirtualReader); override;
|
|
|
|
+ procedure ReadFromFilerWithEvent(reader: TGLVirtualReader;
|
|
afterSenderObjectCreated: TNotifyEvent);
|
|
afterSenderObjectCreated: TNotifyEvent);
|
|
function Add(const item: TObject): Integer; inline;
|
|
function Add(const item: TObject): Integer; inline;
|
|
procedure AddNils(nbVals: Cardinal);
|
|
procedure AddNils(nbVals: Cardinal);
|
|
@@ -161,10 +160,10 @@ type
|
|
procedure DeleteAndFreeItems(index: Integer; nbVals: Cardinal);
|
|
procedure DeleteAndFreeItems(index: Integer; nbVals: Cardinal);
|
|
function RemoveAndFree(item: TObject): Integer;
|
|
function RemoveAndFree(item: TObject): Integer;
|
|
property GrowthDelta: integer read FGrowthDelta write FGrowthDelta;
|
|
property GrowthDelta: integer read FGrowthDelta write FGrowthDelta;
|
|
- function Expand: TPersistentObjectList;
|
|
|
|
|
|
+ function Expand: TGLPersistentObjectList;
|
|
property Items[Index: Integer]: TObject read Get write Put; default;
|
|
property Items[Index: Integer]: TObject read Get write Put; default;
|
|
property Count: Integer read FCount write SetCount;
|
|
property Count: Integer read FCount write SetCount;
|
|
- property List: PPointerObjectList read FList;
|
|
|
|
|
|
+ property List: PGLPointerObjectList read FList;
|
|
property Capacity: Integer read FCapacity write SetCapacity;
|
|
property Capacity: Integer read FCapacity write SetCapacity;
|
|
//Makes sure capacity is at least aCapacity.
|
|
//Makes sure capacity is at least aCapacity.
|
|
procedure RequiredCapacity(aCapacity: Integer);
|
|
procedure RequiredCapacity(aCapacity: Integer);
|
|
@@ -185,13 +184,13 @@ type
|
|
procedure Push(item: TObject);
|
|
procedure Push(item: TObject);
|
|
function Pop: TObject;
|
|
function Pop: TObject;
|
|
procedure PopAndFree;
|
|
procedure PopAndFree;
|
|
- function AddObjects(const objectList: TPersistentObjectList): Integer;
|
|
|
|
- procedure RemoveObjects(const objectList: TPersistentObjectList);
|
|
|
|
|
|
+ function AddObjects(const objectList: TGLPersistentObjectList): Integer;
|
|
|
|
+ procedure RemoveObjects(const objectList: TGLPersistentObjectList);
|
|
procedure Sort(compareFunc: TObjectListSortCompare);
|
|
procedure Sort(compareFunc: TObjectListSortCompare);
|
|
end;
|
|
end;
|
|
|
|
|
|
//Wraps a TReader-compatible reader.
|
|
//Wraps a TReader-compatible reader.
|
|
- TGLBinaryReader = class(TVirtualReader)
|
|
|
|
|
|
+ TGLBinaryReader = class(TGLVirtualReader)
|
|
protected
|
|
protected
|
|
function ReadValue: TValueType;
|
|
function ReadValue: TValueType;
|
|
function ReadWideString(vType: TValueType): WideString;
|
|
function ReadWideString(vType: TValueType): WideString;
|
|
@@ -208,7 +207,7 @@ type
|
|
end;
|
|
end;
|
|
|
|
|
|
//Wraps a TWriter-compatible writer.
|
|
//Wraps a TWriter-compatible writer.
|
|
- TGLBinaryWriter = class(TVirtualWriter)
|
|
|
|
|
|
+ TGLBinaryWriter = class(TGLVirtualWriter)
|
|
protected
|
|
protected
|
|
procedure WriteAnsiString(const aString: AnsiString); virtual;
|
|
procedure WriteAnsiString(const aString: AnsiString); virtual;
|
|
procedure WriteWideString(const aString: WideString); virtual;
|
|
procedure WriteWideString(const aString: WideString); virtual;
|
|
@@ -223,7 +222,7 @@ type
|
|
end;
|
|
end;
|
|
|
|
|
|
//Reads object persistence in Text format.
|
|
//Reads object persistence in Text format.
|
|
- TGLTextReader = class(TVirtualReader)
|
|
|
|
|
|
+ TGLTextReader = class(TGLVirtualReader)
|
|
private
|
|
private
|
|
FValueType: string;
|
|
FValueType: string;
|
|
FData: string;
|
|
FData: string;
|
|
@@ -242,7 +241,7 @@ type
|
|
end;
|
|
end;
|
|
|
|
|
|
//Writes object persistence in Text format.
|
|
//Writes object persistence in Text format.
|
|
- TGLTextWriter = class(TVirtualWriter)
|
|
|
|
|
|
+ TGLTextWriter = class(TGLVirtualWriter)
|
|
private
|
|
private
|
|
FIndentLevel: Integer;
|
|
FIndentLevel: Integer;
|
|
protected
|
|
protected
|
|
@@ -393,20 +392,20 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
// ------------------
|
|
// ------------------
|
|
-// ------------------ TVirtualReader ------------------
|
|
|
|
|
|
+// ------------------ TGLVirtualReader ------------------
|
|
// ------------------
|
|
// ------------------
|
|
|
|
|
|
-constructor TVirtualReader.Create(Stream: TStream);
|
|
|
|
|
|
+constructor TGLVirtualReader.Create(Stream: TStream);
|
|
begin
|
|
begin
|
|
FStream := Stream;
|
|
FStream := Stream;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TVirtualReader.ReadTypeError;
|
|
|
|
|
|
+procedure TGLVirtualReader.ReadTypeError;
|
|
begin
|
|
begin
|
|
raise EReadError.CreateFmt('%s, read type error', [ClassName]);
|
|
raise EReadError.CreateFmt('%s, read type error', [ClassName]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TVirtualReader.ReadTStrings(aStrings: TStrings);
|
|
|
|
|
|
+procedure TGLVirtualReader.ReadTStrings(aStrings: TStrings);
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
objectsStored: Boolean;
|
|
objectsStored: Boolean;
|
|
@@ -431,15 +430,15 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
// ------------------
|
|
// ------------------
|
|
-// ------------------ TVirtualWriter ------------------
|
|
|
|
|
|
+// ------------------ TGLVirtualWriter ------------------
|
|
// ------------------
|
|
// ------------------
|
|
|
|
|
|
-constructor TVirtualWriter.Create(Stream: TStream);
|
|
|
|
|
|
+constructor TGLVirtualWriter.Create(Stream: TStream);
|
|
begin
|
|
begin
|
|
FStream := Stream;
|
|
FStream := Stream;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TVirtualWriter.WriteTStrings(const aStrings: TStrings;
|
|
|
|
|
|
+procedure TGLVirtualWriter.WriteTStrings(const aStrings: TStrings;
|
|
storeObjects: Boolean = True);
|
|
storeObjects: Boolean = True);
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
@@ -463,26 +462,26 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
// ------------------
|
|
// ------------------
|
|
-// ------------------ TPersistentObject ------------------
|
|
|
|
|
|
+// ------------------ TGLPersistentObject ------------------
|
|
// ------------------
|
|
// ------------------
|
|
|
|
|
|
-constructor TPersistentObject.Create;
|
|
|
|
|
|
+constructor TGLPersistentObject.Create;
|
|
begin
|
|
begin
|
|
inherited Create;
|
|
inherited Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
-constructor TPersistentObject.CreateFromFiler(reader: TVirtualReader);
|
|
|
|
|
|
+constructor TGLPersistentObject.CreateFromFiler(reader: TGLVirtualReader);
|
|
begin
|
|
begin
|
|
Create;
|
|
Create;
|
|
ReadFromFiler(reader);
|
|
ReadFromFiler(reader);
|
|
end;
|
|
end;
|
|
|
|
|
|
-destructor TPersistentObject.Destroy;
|
|
|
|
|
|
+destructor TGLPersistentObject.Destroy;
|
|
begin
|
|
begin
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.Assign(source: TPersistent);
|
|
|
|
|
|
+procedure TGLPersistentObject.Assign(source: TPersistent);
|
|
var
|
|
var
|
|
ms: TStringStream; // faster than a TMemoryStream...
|
|
ms: TStringStream; // faster than a TMemoryStream...
|
|
begin
|
|
begin
|
|
@@ -490,7 +489,7 @@ begin
|
|
begin
|
|
begin
|
|
ms := TStringStream.Create('');
|
|
ms := TStringStream.Create('');
|
|
try
|
|
try
|
|
- TPersistentObject(source).SaveToStream(ms);
|
|
|
|
|
|
+ TGLPersistentObject(source).SaveToStream(ms);
|
|
ms.Position := 0;
|
|
ms.Position := 0;
|
|
LoadFromStream(ms);
|
|
LoadFromStream(ms);
|
|
finally
|
|
finally
|
|
@@ -501,45 +500,45 @@ begin
|
|
inherited;
|
|
inherited;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObject.CreateClone: TPersistentObject;
|
|
|
|
|
|
+function TGLPersistentObject.CreateClone: TGLPersistentObject;
|
|
begin
|
|
begin
|
|
Result := TPersistentObjectClass(Self.ClassType).Create;
|
|
Result := TPersistentObjectClass(Self.ClassType).Create;
|
|
Result.Assign(Self);
|
|
Result.Assign(Self);
|
|
end;
|
|
end;
|
|
|
|
|
|
-class function TPersistentObject.FileSignature: string;
|
|
|
|
|
|
+class function TGLPersistentObject.FileSignature: string;
|
|
begin
|
|
begin
|
|
Result := '';
|
|
Result := '';
|
|
end;
|
|
end;
|
|
|
|
|
|
-class function TPersistentObject.FileVirtualWriter: TVirtualWriterClass;
|
|
|
|
|
|
+class function TGLPersistentObject.FileVirtualWriter: TVirtualWriterClass;
|
|
begin
|
|
begin
|
|
Result := TGLBinaryWriter;
|
|
Result := TGLBinaryWriter;
|
|
end;
|
|
end;
|
|
|
|
|
|
-class function TPersistentObject.FileVirtualReader: TVirtualReaderClass;
|
|
|
|
|
|
+class function TGLPersistentObject.FileVirtualReader: TVirtualReaderClass;
|
|
begin
|
|
begin
|
|
Result := TGLBinaryReader;
|
|
Result := TGLBinaryReader;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.WriteToFiler(writer: TVirtualWriter);
|
|
|
|
|
|
+procedure TGLPersistentObject.WriteToFiler(writer: TGLVirtualWriter);
|
|
begin
|
|
begin
|
|
// nothing
|
|
// nothing
|
|
Assert(Assigned(writer));
|
|
Assert(Assigned(writer));
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.ReadFromFiler(reader: TVirtualReader);
|
|
|
|
|
|
+procedure TGLPersistentObject.ReadFromFiler(reader: TGLVirtualReader);
|
|
begin
|
|
begin
|
|
// nothing
|
|
// nothing
|
|
Assert(Assigned(reader));
|
|
Assert(Assigned(reader));
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.RaiseFilerException(const archiveVersion: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObject.RaiseFilerException(const archiveVersion: Integer);
|
|
begin
|
|
begin
|
|
raise EFilerException.Create(ClassName + strUnknownArchiveVersion + IntToStr(archiveVersion)); //IGNORE
|
|
raise EFilerException.Create(ClassName + strUnknownArchiveVersion + IntToStr(archiveVersion)); //IGNORE
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObject.QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
|
|
|
|
|
+function TGLPersistentObject.QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
|
begin
|
|
begin
|
|
if GetInterface(IID, Obj) then
|
|
if GetInterface(IID, Obj) then
|
|
Result := S_OK
|
|
Result := S_OK
|
|
@@ -547,21 +546,21 @@ begin
|
|
Result := E_NOINTERFACE;
|
|
Result := E_NOINTERFACE;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObject._AddRef: Integer; stdcall;
|
|
|
|
|
|
+function TGLPersistentObject._AddRef: Integer; stdcall;
|
|
begin
|
|
begin
|
|
// ignore
|
|
// ignore
|
|
Result := 1;
|
|
Result := 1;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObject._Release: Integer; stdcall;
|
|
|
|
|
|
+function TGLPersistentObject._Release: Integer; stdcall;
|
|
begin
|
|
begin
|
|
// ignore
|
|
// ignore
|
|
Result := 0;
|
|
Result := 0;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.SaveToStream(stream: TStream; writerClass: TVirtualWriterClass = nil);
|
|
|
|
|
|
+procedure TGLPersistentObject.SaveToStream(stream: TStream; writerClass: TVirtualWriterClass = nil);
|
|
var
|
|
var
|
|
- wr: TVirtualWriter;
|
|
|
|
|
|
+ wr: TGLVirtualWriter;
|
|
fileSig: AnsiString;
|
|
fileSig: AnsiString;
|
|
begin
|
|
begin
|
|
if writerClass = nil then
|
|
if writerClass = nil then
|
|
@@ -579,9 +578,9 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.LoadFromStream(stream: TStream; readerClass: TVirtualReaderClass = nil);
|
|
|
|
|
|
+procedure TGLPersistentObject.LoadFromStream(stream: TStream; readerClass: TVirtualReaderClass = nil);
|
|
var
|
|
var
|
|
- rd: TVirtualReader;
|
|
|
|
|
|
+ rd: TGLVirtualReader;
|
|
sig: AnsiString;
|
|
sig: AnsiString;
|
|
begin
|
|
begin
|
|
if readerClass = nil then
|
|
if readerClass = nil then
|
|
@@ -601,7 +600,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.SaveToFile(const fileName: string; writerClass: TVirtualWriterClass = nil);
|
|
|
|
|
|
+procedure TGLPersistentObject.SaveToFile(const fileName: string; writerClass: TVirtualWriterClass = nil);
|
|
var
|
|
var
|
|
fs: TStream;
|
|
fs: TStream;
|
|
begin
|
|
begin
|
|
@@ -615,7 +614,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.LoadFromFile(const fileName: string; readerClass: TVirtualReaderClass = nil);
|
|
|
|
|
|
+procedure TGLPersistentObject.LoadFromFile(const fileName: string; readerClass: TVirtualReaderClass = nil);
|
|
var
|
|
var
|
|
fs: TStream;
|
|
fs: TStream;
|
|
begin
|
|
begin
|
|
@@ -629,7 +628,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObject.SaveToString(writerClass: TVirtualWriterClass = nil): string;
|
|
|
|
|
|
+function TGLPersistentObject.SaveToString(writerClass: TVirtualWriterClass = nil): string;
|
|
var
|
|
var
|
|
ss: TStringStream;
|
|
ss: TStringStream;
|
|
begin
|
|
begin
|
|
@@ -642,7 +641,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObject.LoadFromString(const data: string; readerClass: TVirtualReaderClass = nil);
|
|
|
|
|
|
+procedure TGLPersistentObject.LoadFromString(const data: string; readerClass: TVirtualReaderClass = nil);
|
|
var
|
|
var
|
|
ss: TStringStream;
|
|
ss: TStringStream;
|
|
begin
|
|
begin
|
|
@@ -655,22 +654,22 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
// ------------------
|
|
// ------------------
|
|
-// ------------------ TPersistentObjectList ------------------
|
|
|
|
|
|
+// ------------------ TGLPersistentObjectList ------------------
|
|
// ------------------
|
|
// ------------------
|
|
|
|
|
|
-constructor TPersistentObjectList.Create;
|
|
|
|
|
|
+constructor TGLPersistentObjectList.Create;
|
|
begin
|
|
begin
|
|
inherited Create;
|
|
inherited Create;
|
|
FGrowthDelta := cDefaultListGrowthDelta;
|
|
FGrowthDelta := cDefaultListGrowthDelta;
|
|
end;
|
|
end;
|
|
|
|
|
|
-destructor TPersistentObjectList.Destroy;
|
|
|
|
|
|
+destructor TGLPersistentObjectList.Destroy;
|
|
begin
|
|
begin
|
|
Clear;
|
|
Clear;
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.Add(const item: TObject): Integer;
|
|
|
|
|
|
+function TGLPersistentObjectList.Add(const item: TObject): Integer;
|
|
begin
|
|
begin
|
|
Result := FCount;
|
|
Result := FCount;
|
|
if Result = FCapacity then
|
|
if Result = FCapacity then
|
|
@@ -679,7 +678,7 @@ begin
|
|
Inc(FCount);
|
|
Inc(FCount);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.AddNils(nbVals: Cardinal);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.AddNils(nbVals: Cardinal);
|
|
begin
|
|
begin
|
|
if Integer(nbVals) + Count > Capacity then
|
|
if Integer(nbVals) + Count > Capacity then
|
|
SetCapacity(Integer(nbVals) + Count);
|
|
SetCapacity(Integer(nbVals) + Count);
|
|
@@ -687,7 +686,7 @@ begin
|
|
FCount := FCount + Integer(nbVals);
|
|
FCount := FCount + Integer(nbVals);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.AddObjects(const objectList: TPersistentObjectList): Integer;
|
|
|
|
|
|
+function TGLPersistentObjectList.AddObjects(const objectList: TGLPersistentObjectList): Integer;
|
|
begin
|
|
begin
|
|
if Assigned(objectList) then
|
|
if Assigned(objectList) then
|
|
begin
|
|
begin
|
|
@@ -700,7 +699,7 @@ begin
|
|
Result := 0;
|
|
Result := 0;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.RemoveObjects(const objectList: TPersistentObjectList);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.RemoveObjects(const objectList: TGLPersistentObjectList);
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
begin
|
|
begin
|
|
@@ -708,7 +707,7 @@ begin
|
|
Remove(objectList[i]);
|
|
Remove(objectList[i]);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Clear;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Clear;
|
|
begin
|
|
begin
|
|
if Assigned(Self) and Assigned(FList) then
|
|
if Assigned(Self) and Assigned(FList) then
|
|
begin
|
|
begin
|
|
@@ -717,7 +716,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Delete(index: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Delete(index: Integer);
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(Index) >= Cardinal(FCount) then
|
|
if Cardinal(Index) >= Cardinal(FCount) then
|
|
@@ -728,7 +727,7 @@ begin
|
|
System.Move(FList[index + 1], FList[index], (FCount - index) * SizeOf(TObject));
|
|
System.Move(FList[index + 1], FList[index], (FCount - index) * SizeOf(TObject));
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.DeleteItems(index: Integer; nbVals: Cardinal);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.DeleteItems(index: Integer; nbVals: Cardinal);
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
Assert(Cardinal(index) < Cardinal(FCount));
|
|
Assert(Cardinal(index) < Cardinal(FCount));
|
|
@@ -745,10 +744,10 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Exchange(index1, index2: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Exchange(index1, index2: Integer);
|
|
var
|
|
var
|
|
item: TObject;
|
|
item: TObject;
|
|
- locList: PPointerObjectList;
|
|
|
|
|
|
+ locList: PGLPointerObjectList;
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if (Cardinal(Index1) >= Cardinal(FCount)) or
|
|
if (Cardinal(Index1) >= Cardinal(FCount)) or
|
|
@@ -761,14 +760,14 @@ begin
|
|
locList^[index2] := item;
|
|
locList^[index2] := item;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.Expand: TPersistentObjectList;
|
|
|
|
|
|
+function TGLPersistentObjectList.Expand: TGLPersistentObjectList;
|
|
begin
|
|
begin
|
|
if FCount = FCapacity then
|
|
if FCount = FCapacity then
|
|
SetCapacity(FCapacity + FGrowthDelta);
|
|
SetCapacity(FCapacity + FGrowthDelta);
|
|
Result := Self;
|
|
Result := Self;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.GetFirst: TObject;
|
|
|
|
|
|
+function TGLPersistentObjectList.GetFirst: TObject;
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(FCount) = 0 then
|
|
if Cardinal(FCount) = 0 then
|
|
@@ -777,7 +776,7 @@ begin
|
|
Result := FList^[0];
|
|
Result := FList^[0];
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.SetFirst(item: TObject);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.SetFirst(item: TObject);
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(FCount) = 0 then
|
|
if Cardinal(FCount) = 0 then
|
|
@@ -786,12 +785,12 @@ begin
|
|
FList^[0] := item;
|
|
FList^[0] := item;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Error;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Error;
|
|
begin
|
|
begin
|
|
raise EListError.Create(strListIndexError);
|
|
raise EListError.Create(strListIndexError);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.Get(Index: Integer): TObject;
|
|
|
|
|
|
+function TGLPersistentObjectList.Get(Index: Integer): TObject;
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(Index) >= Cardinal(FCount) then
|
|
if Cardinal(Index) >= Cardinal(FCount) then
|
|
@@ -800,7 +799,7 @@ begin
|
|
Result := FList^[Index];
|
|
Result := FList^[Index];
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.IndexOf(Item: TObject): Integer;
|
|
|
|
|
|
+function TGLPersistentObjectList.IndexOf(Item: TObject): Integer;
|
|
var
|
|
var
|
|
I: Integer;
|
|
I: Integer;
|
|
begin
|
|
begin
|
|
@@ -818,7 +817,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Insert(index: Integer; item: TObject);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Insert(index: Integer; item: TObject);
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(index) > Cardinal(FCount) then
|
|
if Cardinal(index) > Cardinal(FCount) then
|
|
@@ -833,7 +832,7 @@ begin
|
|
Inc(FCount);
|
|
Inc(FCount);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.InsertNils(index: Integer; nbVals: Cardinal);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.InsertNils(index: Integer; nbVals: Cardinal);
|
|
var
|
|
var
|
|
nc: Integer;
|
|
nc: Integer;
|
|
begin
|
|
begin
|
|
@@ -853,7 +852,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.GetLast: TObject;
|
|
|
|
|
|
+function TGLPersistentObjectList.GetLast: TObject;
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(FCount) = 0 then
|
|
if Cardinal(FCount) = 0 then
|
|
@@ -862,7 +861,7 @@ begin
|
|
Result := FList^[FCount - 1];
|
|
Result := FList^[FCount - 1];
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.SetLast(item: TObject);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.SetLast(item: TObject);
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(FCount) = 0 then
|
|
if Cardinal(FCount) = 0 then
|
|
@@ -871,7 +870,7 @@ begin
|
|
FList^[FCount - 1] := item;
|
|
FList^[FCount - 1] := item;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Move(CurIndex, NewIndex: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Move(CurIndex, NewIndex: Integer);
|
|
var
|
|
var
|
|
item: Pointer;
|
|
item: Pointer;
|
|
begin
|
|
begin
|
|
@@ -898,7 +897,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Put(Index: Integer; Item: TObject);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Put(Index: Integer; Item: TObject);
|
|
begin
|
|
begin
|
|
{$IFOPT R+}
|
|
{$IFOPT R+}
|
|
if Cardinal(Index) >= Cardinal(FCount) then
|
|
if Cardinal(Index) >= Cardinal(FCount) then
|
|
@@ -907,17 +906,17 @@ begin
|
|
FList^[Index] := Item;
|
|
FList^[Index] := Item;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.Remove(item: TObject): Integer;
|
|
|
|
|
|
+function TGLPersistentObjectList.Remove(item: TObject): Integer;
|
|
begin
|
|
begin
|
|
Result := IndexOf(item);
|
|
Result := IndexOf(item);
|
|
if Result >= 0 then
|
|
if Result >= 0 then
|
|
Delete(Result);
|
|
Delete(Result);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Pack;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Pack;
|
|
var
|
|
var
|
|
i, j, n: Integer;
|
|
i, j, n: Integer;
|
|
- p: PPointerObjectList;
|
|
|
|
|
|
+ p: PGLPointerObjectList;
|
|
pk: PObject;
|
|
pk: PObject;
|
|
begin
|
|
begin
|
|
p := List;
|
|
p := List;
|
|
@@ -944,7 +943,7 @@ begin
|
|
SetCount(n + 1);
|
|
SetCount(n + 1);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.SetCapacity(newCapacity: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.SetCapacity(newCapacity: Integer);
|
|
begin
|
|
begin
|
|
if newCapacity <> FCapacity then
|
|
if newCapacity <> FCapacity then
|
|
begin
|
|
begin
|
|
@@ -955,13 +954,13 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.RequiredCapacity(aCapacity: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.RequiredCapacity(aCapacity: Integer);
|
|
begin
|
|
begin
|
|
if FCapacity < aCapacity then
|
|
if FCapacity < aCapacity then
|
|
SetCapacity(aCapacity);
|
|
SetCapacity(aCapacity);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.SetCount(newCount: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.SetCount(newCount: Integer);
|
|
begin
|
|
begin
|
|
if newCount > FCapacity then
|
|
if newCount > FCapacity then
|
|
SetCapacity(newCount);
|
|
SetCapacity(newCount);
|
|
@@ -970,7 +969,7 @@ begin
|
|
FCount := NewCount;
|
|
FCount := NewCount;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.DeleteAndFree(index: Integer);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.DeleteAndFree(index: Integer);
|
|
var
|
|
var
|
|
obj: TObject;
|
|
obj: TObject;
|
|
begin
|
|
begin
|
|
@@ -979,7 +978,7 @@ begin
|
|
obj.Free;
|
|
obj.Free;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.DeleteAndFreeItems(index: Integer; nbVals: Cardinal);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.DeleteAndFreeItems(index: Integer; nbVals: Cardinal);
|
|
var
|
|
var
|
|
i, n: Integer;
|
|
i, n: Integer;
|
|
begin
|
|
begin
|
|
@@ -994,7 +993,7 @@ begin
|
|
DeleteItems(index, nbVals);
|
|
DeleteItems(index, nbVals);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.RemoveAndFree(item: TObject): Integer;
|
|
|
|
|
|
+function TGLPersistentObjectList.RemoveAndFree(item: TObject): Integer;
|
|
begin
|
|
begin
|
|
Result := IndexOf(item);
|
|
Result := IndexOf(item);
|
|
if Result >= 0 then
|
|
if Result >= 0 then
|
|
@@ -1004,7 +1003,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.DoClean;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.DoClean;
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
begin
|
|
begin
|
|
@@ -1018,13 +1017,13 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Clean;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Clean;
|
|
begin
|
|
begin
|
|
DoClean;
|
|
DoClean;
|
|
Clear;
|
|
Clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.CleanFree;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.CleanFree;
|
|
begin
|
|
begin
|
|
if Self <> nil then
|
|
if Self <> nil then
|
|
begin
|
|
begin
|
|
@@ -1033,7 +1032,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.WriteToFiler(writer: TVirtualWriter);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.WriteToFiler(writer: TGLVirtualWriter);
|
|
(*
|
|
(*
|
|
Object List Filer Format :
|
|
Object List Filer Format :
|
|
Integer (Version)
|
|
Integer (Version)
|
|
@@ -1063,9 +1062,9 @@ begin
|
|
WriteBoolean(False);
|
|
WriteBoolean(False);
|
|
WriteInteger(0);
|
|
WriteInteger(0);
|
|
end
|
|
end
|
|
- else if (FList^[i] is TPersistentObject) then
|
|
|
|
|
|
+ else if (FList^[i] is TGLPersistentObject) then
|
|
begin
|
|
begin
|
|
- // yeah, a TPersistentObject
|
|
|
|
|
|
+ // yeah, a TGLPersistentObject
|
|
aType := FList^[i].ClassType;
|
|
aType := FList^[i].ClassType;
|
|
objId := objTypes.IndexOf(aType);
|
|
objId := objTypes.IndexOf(aType);
|
|
if objId < 0 then
|
|
if objId < 0 then
|
|
@@ -1079,7 +1078,7 @@ begin
|
|
// class already registered
|
|
// class already registered
|
|
WriteInteger(objId);
|
|
WriteInteger(objId);
|
|
end;
|
|
end;
|
|
- TPersistentObject(FList^[i]).WriteToFiler(writer);
|
|
|
|
|
|
+ TGLPersistentObject(FList^[i]).WriteToFiler(writer);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
@@ -1095,9 +1094,9 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.ReadFromFilerWithEvent(reader: TVirtualReader; afterSenderObjectCreated: TNotifyEvent);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.ReadFromFilerWithEvent(reader: TGLVirtualReader; afterSenderObjectCreated: TNotifyEvent);
|
|
var
|
|
var
|
|
- obj: TPersistentObject;
|
|
|
|
|
|
+ obj: TGLPersistentObject;
|
|
m: TPersistentObjectClass;
|
|
m: TPersistentObjectClass;
|
|
version: integer;
|
|
version: integer;
|
|
objTypes: TList;
|
|
objTypes: TList;
|
|
@@ -1154,22 +1153,22 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.ReadFromFiler(reader: TVirtualReader);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.ReadFromFiler(reader: TGLVirtualReader);
|
|
begin
|
|
begin
|
|
ReadFromFilerWithEvent(reader, AfterObjectCreatedByReader);
|
|
ReadFromFilerWithEvent(reader, AfterObjectCreatedByReader);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.AfterObjectCreatedByReader(Sender: TObject);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.AfterObjectCreatedByReader(Sender: TObject);
|
|
begin
|
|
begin
|
|
// nothing
|
|
// nothing
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Push(item: TObject);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Push(item: TObject);
|
|
begin
|
|
begin
|
|
Add(item);
|
|
Add(item);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPersistentObjectList.Pop: TObject;
|
|
|
|
|
|
+function TGLPersistentObjectList.Pop: TObject;
|
|
begin
|
|
begin
|
|
if FCount > 0 then
|
|
if FCount > 0 then
|
|
begin
|
|
begin
|
|
@@ -1180,12 +1179,12 @@ begin
|
|
Result := nil;
|
|
Result := nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.PopAndFree;
|
|
|
|
|
|
+procedure TGLPersistentObjectList.PopAndFree;
|
|
begin
|
|
begin
|
|
Pop.Free;
|
|
Pop.Free;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure POListQuickSort(SortList: PPointerObjectList; L, R: Integer;
|
|
|
|
|
|
+procedure POListQuickSort(SortList: PGLPointerObjectList; L, R: Integer;
|
|
compareFunc: TObjectListSortCompare);
|
|
compareFunc: TObjectListSortCompare);
|
|
var
|
|
var
|
|
I, J: Integer;
|
|
I, J: Integer;
|
|
@@ -1215,7 +1214,7 @@ begin
|
|
until I >= R;
|
|
until I >= R;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TPersistentObjectList.Sort(compareFunc: TObjectListSortCompare);
|
|
|
|
|
|
+procedure TGLPersistentObjectList.Sort(compareFunc: TObjectListSortCompare);
|
|
begin
|
|
begin
|
|
if Count > 1 then
|
|
if Count > 1 then
|
|
POListQuickSort(FList, 0, Count - 1, compareFunc);
|
|
POListQuickSort(FList, 0, Count - 1, compareFunc);
|
|
@@ -1805,6 +1804,6 @@ end;
|
|
initialization
|
|
initialization
|
|
// ------------------------------------------------------------------
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
- RegisterClass(TPersistentObjectList);
|
|
|
|
|
|
+ RegisterClass(TGLPersistentObjectList);
|
|
|
|
|
|
end.
|
|
end.
|