Added examples 27-40

This commit is contained in:
michael 1999-01-17 15:08:43 +00:00
parent e7b0669f65
commit 5082f98017
21 changed files with 586 additions and 21 deletions

View File

@ -183,6 +183,7 @@ unitex.chk:
$(MAKE) -C go32ex tex
$(MAKE) -C heapex tex
$(MAKE) -C objectex tex
$(MAKE) -C ipcex tex
touch unitex.chk
refex.chk:
@ -318,8 +319,9 @@ examples:
$(MAKE) -C optex
$(MAKE) -C printex
$(MAKE) -C refex
$(MAKE) -C sockex
$(MAKE) -C stringex
$(MAKE) -C ipcex
$(MAKE) -C objectex[A
dosexamples: examples
$(MAKE) -C go32ex
@ -328,10 +330,14 @@ dosexamples: examples
linuxexamples: examples
$(MAKE) -C linuxex
$(MAKE) -C sockex
$(MAKE) -C ipcex
#
# $Log$
# Revision 1.16 1998-12-15 23:50:53 michael
# Revision 1.17 1999-01-17 15:12:50 michael
# Added examples 27-40
#
# Revision 1.16 1998/12/15 23:50:53 michael
# * Some updates
#
# Revision 1.15 1998/11/17 23:42:02 michael

View File

@ -34,22 +34,23 @@ endif
OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 \
ex11 ex12 ex13 ex14 ex15 ex16 ex17 ex18 ex19 ex20 \
ex21 ex22 ex23 ex24 ex25 ex26
#ex7 ex8 ex9 ex10
ex21 ex22 ex23 ex24 ex25 ex26 ex27 ex28 ex29 ex30 \
ex31 ex32 ex33 ex34 ex35 ex36 ex37 ex38 ex39 ex40
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
all : $(OBJECTS)
tex : $(TEXOBJECTS) myobject.tex
tex : $(TEXOBJECTS) myobject.tex mysortc.tex
onetex : tex
$(MAKETEX) $(TEXOBJECTS)
clean :
rm -f *.o *.s $(OBJECTS) $(TEXOBJECTS) myobject.ppu myobject.tex test.dat
rm -f *.o *.s $(OBJECTS) $(TEXOBJECTS) mysortc.ppu myobject.ppu mysortc.tex myobject.tex test.dat
$(OBJECTS): %: %.pp
$(PP) $(PPOPTS) $*
$(TEXOBJECTS) myobject.tex: %.tex: %.pp head.tex foot.tex
$(TEXOBJECTS) myobject.tex mysortc.tex: %.tex: %.pp head.tex foot.tex
$(PP2TEX) $*

View File

@ -21,9 +21,23 @@ ex17.pp contains an example for the function TStream.Seek
ex18.pp contains an example for the function TStream.Read
ex19.pp contains an example for the function TStream.CopyFrom
ex20.pp contains an example for the function TMemoryStream.Truncate
ex21.pp contains an example for the function TCollection.Foreach;
ex22.pp contains an example for the function TCollection.Load;
ex23.pp contains an example for the function TCollection.At;
ex24.pp contains an example for the function TCollection.indexOf;
ex25.pp contains an example for the function TCollection.LastThat;
ex26.pp contains an example for the function TCollection.FirstThat;
ex21.pp contains an example for the function TCollection.Foreach
ex22.pp contains an example for the function TCollection.Load
ex23.pp contains an example for the function TCollection.At
ex24.pp contains an example for the function TCollection.indexOf
ex25.pp contains an example for the function TCollection.LastThat
ex26.pp contains an example for the function TCollection.FirstThat
ex27.pp contains an example for the function TCollection.Pack
ex28.pp contains an example for the function TCollection.FreeAll
ex29.pp contains an example for the function TCollection.DeleteAll
ex30.pp contains an example for the function TCollection.Free
ex31.pp contains an example for the function TCollection.Delete
ex32.pp contains an example for the function TCollection.AtFree
ex33.pp contains an example for the function TCollection.AtDelete
ex34.pp contains an example for the function TCollection.AtInsert
ex35.pp contains an example for the function TSortedCollection.Insert
ex36.pp contains an example for the function TSortedCollection.Search
ex37.pp contains an example for the function TStringCollection.Compare
ex38.pp contains an example for the function TStrCollection.Compare
ex39.pp contains an example for the function TUnsortedStrCollection.Insert
ex40.pp contains an example for the function NewStr

View File

@ -1,4 +1,4 @@
Program ex21;
Program ex23;
{ Program to demonstrate the TCollection.At method }

View File

@ -1,6 +1,6 @@
Program ex21;
Program ex24;
{ Program to demonstrate the TCollection.At method }
{ Program to demonstrate the TCollection.IndexOf method }
Uses Objects,MyObject; { For TMyObject definition and registration }

41
docs/objectex/ex27.pp Normal file
View File

@ -0,0 +1,41 @@
Program ex27;
{ Program to demonstrate the TCollection.Pack method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,cnt : Longint;
begin
Randomize;
C:=New(PCollection,Init(100,10));
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
cnt:=0;
For I:=0 to 99 do
begin
If Random<0.1 then
begin
Inc(Cnt);
C^.FreeItem(C^.At(I));
C^.AtPut(I,Nil);
end;
end;
Writeln ('Set ',cnt,' pointers to Nil. Count is ',C^.Count);
Writeln ('Available memory : ',Memavail);
C^.Pack;
Writeln ('Packed collection. Count is ',C^.Count);
cnt:=Memavail;
Writeln ('Available memory : ',Cnt);
C^.SetLimit(C^.Count);
Writeln ('Set limit to ',C^.Count);
Write ('Available memory : ',Memavail,'.');
Writeln (' Gained ',Memavail-cnt,' bytes.');
Dispose(C,Done);
end.

30
docs/objectex/ex28.pp Normal file
View File

@ -0,0 +1,30 @@
Program ex28;
{ Program to demonstrate the TCollection.FreeAll method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,InitMem : Longint;
begin
Randomize;
C:=New(PCollection,Init(120,10));
InitMem:=Memavail;
Writeln ('Initial memory : ',InitMem);
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
Writeln ('Added 100 Items. Memory available : ',Memavail);
Write ('Lost : ',Initmem-Memavail,' bytes.');
Write ('(Should be 100*',SizeOF(TMyObject));
Writeln ('=',100*SizeOf(TMyObject),')');
C^.FreeAll;
Writeln ('Freed all objects. Memory available : ',Memavail);
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
Dispose(C,Done);
end.

33
docs/objectex/ex29.pp Normal file
View File

@ -0,0 +1,33 @@
Program ex29;
{
Program to demonstrate the TCollection.DeleteAll method
Compare with example 28, where FreeAll is used.
}
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,InitMem : Longint;
begin
Randomize;
C:=New(PCollection,Init(120,10));
InitMem:=Memavail;
Writeln ('Initial memory : ',InitMem);
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
Writeln ('Added 100 Items. Memory available : ',Memavail);
Write ('Lost : ',Initmem-Memavail,' bytes.');
Write ('(Should be 100*',SizeOF(TMyObject));
Writeln ('=',100*SizeOf(TMyObject),')');
C^.DeleteAll;
Writeln ('Deleted all objects. Memory available : ',Memavail);
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
Dispose(C,Done);
end.

31
docs/objectex/ex30.pp Normal file
View File

@ -0,0 +1,31 @@
Program ex30;
{ Program to demonstrate the TCollection.Free method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,InitMem : Longint;
begin
Randomize;
C:=New(PCollection,Init(120,10));
InitMem:=Memavail;
Writeln ('Initial memory : ',InitMem);
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
Writeln ('Added 100 Items. Memory available : ',Memavail);
Write ('Lost : ',Initmem-Memavail,' bytes.');
Write ('(Should be 100*',SizeOF(TMyObject));
Writeln ('=',100*SizeOf(TMyObject),')');
With C^ do
While Count>0 do Free(At(Count-1));
Writeln ('Freed all objects. Memory available : ',Memavail);
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
Dispose(C,Done);
end.

31
docs/objectex/ex31.pp Normal file
View File

@ -0,0 +1,31 @@
Program ex31;
{ Program to demonstrate the TCollection.Delete method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,InitMem : Longint;
begin
Randomize;
C:=New(PCollection,Init(120,10));
InitMem:=Memavail;
Writeln ('Initial memory : ',InitMem);
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
Writeln ('Added 100 Items. Memory available : ',Memavail);
Write ('Lost : ',Initmem-Memavail,' bytes.');
Write ('(Should be 100*',SizeOF(TMyObject));
Writeln ('=',100*SizeOf(TMyObject),')');
With C^ do
While Count>0 do Delete(At(Count-1));
Writeln ('Freed all objects. Memory available : ',Memavail);
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
Dispose(C,Done);
end.

31
docs/objectex/ex32.pp Normal file
View File

@ -0,0 +1,31 @@
Program ex32;
{ Program to demonstrate the TCollection.AtFree method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,InitMem : Longint;
begin
Randomize;
C:=New(PCollection,Init(120,10));
InitMem:=Memavail;
Writeln ('Initial memory : ',InitMem);
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
Writeln ('Added 100 Items. Memory available : ',Memavail);
Write ('Lost : ',Initmem-Memavail,' bytes.');
Write ('(Should be 100*',SizeOF(TMyObject));
Writeln ('=',100*SizeOf(TMyObject),')');
With C^ do
While Count>0 do AtFree(Count-1);
Writeln ('Freed all objects. Memory available : ',Memavail);
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
Dispose(C,Done);
end.

31
docs/objectex/ex33.pp Normal file
View File

@ -0,0 +1,31 @@
Program ex33;
{ Program to demonstrate the TCollection.AtDelete method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I,InitMem : Longint;
begin
Randomize;
C:=New(PCollection,Init(120,10));
InitMem:=Memavail;
Writeln ('Initial memory : ',InitMem);
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
C^.Insert(M);
end;
Writeln ('Added 100 Items. Memory available : ',Memavail);
Write ('Lost : ',Initmem-Memavail,' bytes.');
Write ('(Should be 100*',SizeOF(TMyObject));
Writeln ('=',100*SizeOf(TMyObject),')');
With C^ do
While Count>0 do AtDelete(Count-1);
Writeln ('Freed all objects. Memory available : ',Memavail);
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
Dispose(C,Done);
end.

35
docs/objectex/ex34.pp Normal file
View File

@ -0,0 +1,35 @@
Program ex34;
{ Program to demonstrate the TCollection.AtInsert method }
Uses Objects,MyObject; { For TMyObject definition and registration }
Var C : PCollection;
M : PMyObject;
I : Longint;
Procedure PrintField (Dummy: Pointer;P : PMyObject);
begin
Writeln ('Field : ',P^.GetField);
end;
begin
Randomize;
C:=New(PCollection,Init(120,10));
Writeln ('Inserting 100 records at random places.');
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(I-1);
If I=1 then
C^.Insert(M)
else
With C^ do
AtInsert(Random(Count),M);
end;
Writeln ('Values : ');
C^.Foreach(@PrintField);
Dispose(C,Done);
end.

32
docs/objectex/ex35.pp Normal file
View File

@ -0,0 +1,32 @@
Program ex35;
{ Program to demonstrate the TSortedCollection.Insert method }
Uses Objects,MyObject,MySortC;
{ For TMyObject,TMySortedCollection definition and registration }
Var C : PSortedCollection;
M : PMyObject;
I : Longint;
Procedure PrintField (Dummy: Pointer;P : PMyObject);
begin
Writeln ('Field : ',P^.GetField);
end;
begin
Randomize;
C:=New(PMySortedCollection,Init(120,10));
Writeln ('Inserting 100 records at random places.');
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(Random(100));
C^.Insert(M)
end;
Writeln ('Values : ');
C^.Foreach(@PrintField);
Dispose(C,Done);
end.

48
docs/objectex/ex36.pp Normal file
View File

@ -0,0 +1,48 @@
Program ex36;
{ Program to demonstrate the TSortedCollection.Insert method }
Uses Objects,MyObject,MySortC;
{ For TMyObject,TMySortedCollection definition and registration }
Var C : PSortedCollection;
M : PMyObject;
I : Longint;
Procedure PrintField (Dummy: Pointer;P : PMyObject);
begin
Writeln ('Field : ',P^.GetField);
end;
begin
Randomize;
C:=New(PMySortedCollection,Init(120,10));
C^.Duplicates:=True;
Writeln ('Inserting 100 records at random places.');
For I:=1 to 100 do
begin
M:=New(PMyObject,Init);
M^.SetField(Random(100));
C^.Insert(M)
end;
M:=New(PMyObject,Init);
Repeat;
Write ('Value to search for (-1 stops) :');
read (I);
If I<>-1 then
begin
M^.SetField(i);
If Not C^.Search (M,I) then
Writeln ('No such value found')
else
begin
Write ('Value ',PMyObject(C^.At(I))^.GetField);
Writeln (' present at position ',I);
end;
end;
Until I=-1;
Dispose(M,Done);
Dispose(C,Done);
end.

27
docs/objectex/ex37.pp Normal file
View File

@ -0,0 +1,27 @@
Program ex37;
{ Program to demonstrate the TStringCollection.Compare method }
Uses Objects;
Var C : PStringCollection;
S : String;
I : longint;
begin
Randomize;
C:=New(PStringCollection,Init(120,10));
C^.Duplicates:=True; { Duplicates allowed }
Writeln ('Inserting 100 records at random places.');
For I:=1 to 100 do
begin
Str(Random(100),S);
S:='String with value '+S;
C^.Insert(NewStr(S));
end;
For I:=0 to 98 do
With C^ do
If Compare (At(i),At(I+1))=0 then
Writeln ('Duplicate string found at position ',i);
Dispose(C,Done);
end.

29
docs/objectex/ex38.pp Normal file
View File

@ -0,0 +1,29 @@
Program ex38;
{ Program to demonstrate the TStrCollection.Compare method }
Uses Objects,Strings;
Var C : PStrCollection;
S : String;
I : longint;
P : Pchar;
begin
Randomize;
C:=New(PStrCollection,Init(120,10));
C^.Duplicates:=True; { Duplicates allowed }
Writeln ('Inserting 100 records at random places.');
For I:=1 to 100 do
begin
Str(Random(100),S);
S:='String with value '+S;
P:=StrAlloc(Length(S)+1);
C^.Insert(StrPCopy(P,S));
end;
For I:=0 to 98 do
With C^ do
If Compare (At(I),At(I+1))=0 then
Writeln ('Duplicate string found at position ',I);
Dispose(C,Done);
end.

26
docs/objectex/ex39.pp Normal file
View File

@ -0,0 +1,26 @@
Program ex39;
{ Program to demonstrate the TUnsortedStrCollection.Insert method }
Uses Objects,Strings;
Var C : PUnsortedStrCollection;
S : String;
I : longint;
P : Pchar;
begin
Randomize;
C:=New(PUnsortedStrCollection,Init(120,10));
Writeln ('Inserting 100 records at random places.');
For I:=1 to 100 do
begin
Str(Random(100),S);
S:='String with value '+S;
P:=StrAlloc(Length(S)+1);
C^.Insert(StrPCopy(P,S));
end;
For I:=0 to 99 do
Writeln (I:2,': ',PChar(C^.At(i)));
Dispose(C,Done);
end.

19
docs/objectex/ex40.pp Normal file
View File

@ -0,0 +1,19 @@
Program ex40;
{ Program to demonstrate the NewStr function }
Uses Objects;
Var S : String;
P : PString;
begin
S:='Some really cute string';
Writeln ('Memavail : ',Memavail);
P:=NewStr(S);
If P^<>S then
Writeln ('Oh-oh... Something is wrong !!');
Writeln ('Allocated string. Memavail : ',Memavail);
DisposeStr(P);
Writeln ('Deallocated string. Memavail : ',Memavail);
end.

23
docs/objectex/mysortc.pp Normal file
View File

@ -0,0 +1,23 @@
Unit MySortC;
Interface
Uses Objects;
Type
PMySortedCollection = ^TMySortedCollection;
TMySortedCollection = Object(TSortedCollection)
Function Compare (Key1,Key2 : Pointer): Sw_integer; virtual;
end;
Implementation
Uses MyObject;
Function TMySortedCollection.Compare (Key1,Key2 : Pointer) :sw_integer;
begin
Compare:=PMyobject(Key1)^.GetField - PMyObject(Key2)^.GetField;
end;
end.

View File

@ -157,6 +157,9 @@ If not enough memory is available, an 'out of memory' error will occur.
\seep{DisposeStr}
\end{function}
\latex{\inputlisting{objectex/ex40.pp}}
\html{\input{objectex/ex40.tex}}
\begin{procedure}{DisposeStr}
\Declaration
Procedure DisposeStr (P: PString);
@ -168,6 +171,7 @@ None.
\seef{NewStr}
\end{procedure}
For an example, see \seef{NewStr}.
\begin{procedure}{Abstract}
\Declaration
@ -1409,6 +1413,8 @@ error.
\seepl{Insert}{TCollection.Insert}
\end{function}
\latex{\inputlisting{objectex/ex23.pp}}
\html{\input{objectex/ex23.tex}}
\begin{function}{TCollection.IndexOf}
\Declaration
@ -1482,6 +1488,8 @@ None.
\seepl{SetLimit}{TCollection.SetLimit}
\end{procedure}
\latex{\inputlisting{objectex/ex26.pp}}
\html{\input{objectex/ex26.tex}}
\begin{procedure}{TCollection.FreeAll}
\Declaration
@ -1496,6 +1504,10 @@ does set \var{Count} to zero.
\end{procedure}
\latex{\inputlisting{objectex/ex28.pp}}
\html{\input{objectex/ex28.tex}}
\begin{procedure}{TCollection.DeleteAll}
\Declaration
Procedure TCollection.DeleteAll;
@ -1510,6 +1522,9 @@ None.
\seepl{FreeAll}{TCollection.FreeAll}, \seepl{Delete}{TCollection.Delete}
\end{procedure}
\latex{\inputlisting{objectex/ex29.pp}}
\html{\input{objectex/ex29.tex}}
\begin{procedure}{TCollection.Free}
\Declaration
@ -1525,6 +1540,9 @@ If the \var{Item} is not in the collection, \var{Error} will be called with
\end{procedure}
\latex{\inputlisting{objectex/ex30.pp}}
\html{\input{objectex/ex30.tex}}
\begin{procedure}{TCollection.Insert}
\Declaration
Procedure TCollection.Insert (Item: Pointer); Virtual;
@ -1554,6 +1572,9 @@ If the \var{Item} is not in the collection, \var{Error} will be called with
\end{procedure}
\latex{\inputlisting{objectex/ex31.pp}}
\html{\input{objectex/ex31.tex}}
\begin{procedure}{TCollection.AtFree}
\Declaration
Procedure TCollection.AtFree (Index: Sw\_Integer);
@ -1567,12 +1588,18 @@ with \var{CoIndexError}.
\seepl{Free}{TCollection.Free}, \seepl{AtDelete}{TCollection.AtDelete}
\end{procedure}
\latex{\inputlisting{objectex/ex32.pp}}
\html{\input{objectex/ex32.tex}}
\begin{procedure}{TCollection.FreeItem}
\Declaration
Procedure TCollection.FreeItem (Item: Pointer); Virtual;
\Description
\var{FreeItem} calls the destructor of \var{Item} if it is not nil.
This function is used internally by the TCollection object, and should not be
called directly.
\Errors
None.
\SeeAlso
@ -1594,6 +1621,9 @@ with \var{CoIndexError}.
\end{procedure}
\latex{\inputlisting{objectex/ex33.pp}}
\html{\input{objectex/ex33.tex}}
\begin{procedure}{TCollection.ForEach}
\Declaration
Procedure TCollection.ForEach (Action: Pointer);
@ -1610,6 +1640,10 @@ None.
\end{procedure}
\latex{\inputlisting{objectex/ex21.pp}}
\html{\input{objectex/ex21.tex}}
\begin{procedure}{TCollection.SetLimit}
\Declaration
Procedure TCollection.SetLimit (ALimit: Sw\_Integer); Virtual;
@ -1623,6 +1657,7 @@ None.
\seepl{Init}{TCollection.Init}
\end{procedure}
For an example, see \seepl{Pack}{TCollection.Pack}.
\begin{procedure}{TCollection.Error}
\Declaration
@ -1631,11 +1666,14 @@ Procedure TCollection.Error (Code, Info: Integer); Virtual;
\var{Error} is called by the various \var{TCollection} methods
in case of an error condition. The default behaviour is to make
a call to \var{RunError} with an error of \var{212-Code}.
This method can be overridden by descendent objects to implement
a different error-handling.
\Errors
\SeeAlso
\seep{Abstract}
\end{procedure}
\begin{procedure}{TCollection.AtPut}
\Declaration
Procedure TCollection.AtPut (Index: Sw\_Integer; Item: Pointer);
@ -1648,6 +1686,7 @@ with \var{CoIndexError}.
\SeeAlso
\end{procedure}
For an example, see \seepl{Pack}{TCollection.Pack}.
\begin{procedure}{TCollection.AtInsert}
\Declaration
@ -1665,6 +1704,9 @@ with \var{CoIndexError}. If the collection fails to expand, then
\end{procedure}
\latex{\inputlisting{objectex/ex34.pp}}
\html{\input{objectex/ex34.tex}}
\begin{procedure}{TCollection.Store}
\Declaration
Procedure TCollection.Store (Var S: TStream);
@ -1681,19 +1723,21 @@ Errors returned are those by \seep{TStream.Put}.
\seepl{Load}{TCollection.Load}, \seepl{PutItem}{TCollection.PutItem}
\end{procedure}
For an example, see seepl{Load}{TCollection.Load}.
\begin{procedure}{TCollection.PutItem}
\Declaration
Procedure TCollection.PutItem (Var S: TStream; Item: Pointer); Virtual;
\Description
\var{PutItem} writes \var{Item} to stream \var{S}.
\var{PutItem} writes \var{Item} to stream \var{S}. This method is used
internaly by the \var{TCollection} object, and should not be called
directly.
\Errors
Errors are those returned by \seep{TStream.Put}.
\SeeAlso
\seepl{Store}{TCollection.Store}, \seefl{GetItem}{TCollection.GetItem}.
\end{procedure}
\section{TSortedCollection}
\label{se:TSortedCollection}
@ -1731,6 +1775,12 @@ TYPE
PSortedCollection = ^TSortedCollection;
\end{verbatim}
In the subsequent examples, the following descendent of
\var{TSortedCollection} is used:
\latex{\inputlisting{objectex/mysortc.pp}}
\html{\input{objectex/mysortc.tex}}
\begin{procedure}{TSortedCollection.Init}
\Declaration
Constructor TSortedCollection.Init (ALimit, ADelta: Sw\_Integer);
@ -1747,6 +1797,8 @@ None.
\seepl{Load}{TSortedCollection.Load}, \seepl{Done}{TCollection.Done}
\end{procedure}
For an example, see
\begin{procedure}{TSortedCollection.Load}
\Declaration
Constructor Load (Var S: TStream);
@ -1763,6 +1815,8 @@ None.
\seepl{Init}{TSortedCollection.Init}, \seepl{Done}{TCollection.Done}
\end{procedure}
For an example, see \seep{TCollection.Load}.
\begin{function}{TSortedCollection.KeyOf}
\Declaration
Function TSortedCollection.KeyOf (Item: Pointer): Pointer; Virtual;
@ -1799,6 +1853,8 @@ None.
\seefl{Compare}{TSortedCollection.Compare}.
\end{function}
For an example, see \seef{TCollection.IndexOf}
\begin{function}{TSortedCollection.Compare}
\Declaration
Function TSortedCollection.Compare (Key1, Key2: Pointer): Sw\_Integer; Virtual;
@ -1826,6 +1882,10 @@ An 'abstract run-time error' will be generated if you call
\seefl{Search}{TSortedCollection.Search}
\end{function}
\latex{\inputlisting{objectex/mysortc.pp}}
\html{\input{objectex/mysortc.tex}}
\begin{function}{TSortedCollection.Search}
\Declaration
Function TSortedCollection.Search (Key: Pointer; Var Index: Sw\_Integer): Boolean;Virtual;
@ -1846,6 +1906,9 @@ None.
\seefl{IndexOf}{TCollection.IndexOf}.
\end{function}
\latex{\inputlisting{objectex/ex36.pp}}
\html{\input{objectex/ex36.tex}}
\begin{procedure}{TSortedCollection.Insert}
\Declaration
Procedure TSortedCollection.Insert (Item: Pointer); Virtual;
@ -1863,6 +1926,9 @@ None.
\seepl{AtInsert}{TCollection.AtInsert}
\end{procedure}
\latex{\inputlisting{objectex/ex35.pp}}
\html{\input{objectex/ex35.tex}}
\begin{procedure}{TSortedCollection.Store}
\Declaration
Procedure TSortedCollection.Store (Var S: TStream);
@ -1879,6 +1945,8 @@ Errors can be those of \seep{TStream.Put}.
\seepl{Load}{TSortedCollection.Load}
\end{procedure}
For an example, see \seep{TCollection.Load}.
\section{TStringCollection}
\label{se:TStringCollection}
@ -1900,7 +1968,6 @@ TYPE
PStringCollection = ^TStringCollection;
\end{verbatim}
\begin{function}{TStringCollection.GetItem}
\Declaration
Function TStringCollection.GetItem (Var S: TStream): Pointer; Virtual;
@ -1935,6 +2002,9 @@ None.
\seef{TSortedCollection.Compare}
\end{function}
\latex{\inputlisting{objectex/ex37.pp}}
\html{\input{objectex/ex37.tex}}
\begin{procedure}{TStringCollection.FreeItem}
\Declaration
Procedure TStringCollection.FreeItem (Item: Pointer); Virtual;
@ -2020,6 +2090,11 @@ None.
\seef{TSortedCollection.Compare}
\end{function}
\latex{\inputlisting{objectex/ex38.pp}}
\html{\input{objectex/ex38.tex}}
\begin{procedure}{TStrCollection.FreeItem}
\Declaration
Procedure TStrCollection.FreeItem (Item: Pointer); Virtual;
@ -2079,6 +2154,9 @@ strings.
\SeeAlso
\end{procedure}
\latex{\inputlisting{objectex/ex39.pp}}
\html{\input{objectex/ex39.tex}}
\section{TResourceCollection}
\label{se:TResourceCollection}
@ -2330,7 +2408,6 @@ Errors returned may be those by \seep{TStream.Put} and \var{TStream.Seek}
\seefl{Get}{TResourceFile.Get}
\end{procedure}
\section{TStringList}
\label{se:TStringList}