Basic classes for RTL

This documentation describes the FPC classes unit. The Classes unit contains basic classes for the Free Component Library (FCL):

  • a class for maintaining lists of pointers,
  • for lists of strings,
  • to manage collections of objects
  • classes to support streaming.

Furthermore it introduces methods for object persistence, and classes that understand an owner-owned relationship, with automatic memory management.

A class for managing multiple threads This class is not yet implemented. Type to manage resources This type is provided for Delphi compatibilty, it is used for resource streams. Pointer to a record. The TStringItem is used to store the string and object items in a string list instance. It should never be used directly. Contains the string. Contains the object, if any. Type to manage streams. This type is used as the handle for THandleStream stream descendents Special type for component names. Names of components are of type TComponentName. By specifying a different type, the Object inspector can handle this property differently than a standard string property. IUnknown Interface IUknown is not yet implemented since interfaces are not yet supported by FPC. Special type for GUID's. FPC doesn't support GUID yet. Special type for handling modules. FPC doesn't support modules yet, so this is a dummy type. Special type to handle a fake position

This record describes a coordinate. It is used to handle the Top and Left properties of .

X represents the X-Coordinate of the point described by the record. Y represents the Y-Coordinate of the point described by the record.

Type to describe point in a small plane. Same as , only the X and Y ranges are limited to 2-byte integers instead of 4-byte integers. Descibes a rectangle TRect describes a rectangle in space with its upper-left (in (Top,Left>)) and lower-right (in (Bottom ,Right)) corners. Maximum number of elemens in list. This constant sets the maximum number of elements in a . Indicates Shift key in a keyboard shortcut. indicates CTRL key in a keyboard shortcut. Indicates ALT key in a keyboard shortcut. Indicates no special key is presed in a keyboard shortcut. Seek starts relative to the stream origin. Seek starts relative to the current position in the stream. Seek starts relative to the stream end. creates a new file if needed. opens a file with read-only access. opens a file with write-only access. opens a file with read-write access. Value returned by when the end of the input stream was reached. Value returned by when a symbol was found in the input stream. Value returned by when a string was found in the input stream. Value returned by when an integer was found in the input stream. Value returned by when a floating point value was found in the input stream. Value returned by when a widestring was found in the input stream. Constant that is found at the start of a binary stream containing a streamed component. Type to specify text alignment in controls that display text.

The TAlignment type is used to specify the alignment of the text in controls that display a text.

Text is displayed aligned to the left Text is displayed centered. Text is displayed aligned to the right. Indicates what special keys were pressed in combination with a normal key

This type is used when describing a shortcut key or when describing what special keys are pressed on a keyboard when a key event is generated.

The set contains the special keys that can be used in combination with a 'normal' key.

Either left or right shift key Either left or right ALT key Either left or right CTRL key Either left or right shift key The META key The AltGr (right Alt) key The CapsLock key The NumLock key The ScrollLock key Standard event handler type. Most event handlers are implemented as a property of type TNotifyEvent. When this is set to a certain method of a class, when the event occurs, the method will be called, and the class that generated the event will pass itself along as the Sender argument. Special event for display of online help. This event is used for display of online help. Event for retrieving string values. This event is used as a callback to retrieve string values. It is used, among other things, to pass along string properties in property editors. Exception raised when an error occurs during read or write operations on a stream.

An EStreamError is raised when an error occurs during reading from or writng to a stream: Possible causes are

  1. Not enough data is available in the stream.
  2. Trying to seek beyond the beginning or end of the stream.
  3. Trying to set the capacity of a memory stream and no memory is available.
  4. Trying to write to a read-only stream, such as a resource stream.
  5. Trying to read from a write-only stream.
Exception raised when an error occurred during creation of a stream. When the operating system reports an error during creation of a new file in the Filestream Constructor, a EFCreateError is raised. Exception raised when an error occurred during creation of a When the operating system reports an error during the opening of a file in the Filestream Constructor, a EFOpenError is raised. Exception raised by the component streaming system if an error occurs. This class serves as an ancestor class for exceptions that are raised when an error occurs during component streaming. A EFilerError exception is raised when a class is registered twice. Exception raised if an error occurs while reading from a stream.

If an error occurs when reading from a stream, a EReadError exception is raised. Possible causes for this are:

  1. Not enough data is available when reading from a stream
  2. The stream containing a component's data contains invalid data. this will occurr only when reading a component from a stream.
Exception raised when an error occurs during writing to a stream.

If an error occurs when writing to a stream, a EWriteError exception is raised. Possible causes for this are:

  1. The stream doesn't allow writing.
  2. An error occurred when writing a property to a stream.
Exception raised when an unknown class is referenced in a streamed component. When the streaming system needs to create a component, it looks for the class pointer (VMT) in the list of registered classes by its name. If this name is not found, then an EClassNotFound is raised. This exception is no longer used. This exception is no longer used in the streaming system. This error is replaced by a . Exception raised when the resource header needed for streaming of a component is invalid. This exception is not used by Free Pascal but is provided for Delphi compatibility. Exception raised when a resource, needed to initialize a component, is not found. This exception is not used by Free Pascal but is provided for Delphi compatibility. Exception raised when an error occurs in lists handling.

If an error occurs in one of the or methods, then a EListError exception is raised. This can occur in one of the following cases:

  1. There is not enough memory to expand the list.
  2. The list tried to grow beyond its maximal capacity.
  3. An attempt was made to reduce the capacity of the list below the current element count.
  4. An attempt was made to set the list count to a negative value.
  5. A non-existent element of the list was referenced. (i.e. the list index was out of bounds)
  6. An attempt was made to move an item to a position outside the list's bounds.
,
Exception raised when an error occurs in a method of . When an index of a bit in a is out of the valid range (0 to Count-1) then a EBitsError exception is raised. Exception raised when an error occurs in a method of .

When an error occurs in one of the methods of then an EStringListError is raised. This can have one of the following causes:

  1. There is not enough memory to expand the list.
  2. The list tried to grow beyond its maximal capacity.
  3. A non-existent element of the list was referenced. (i.e. the list index was out of bounds)
  4. An attempt was made to add a duplicate entry to a when is False.
Exception raised when an error occurs in the component registration routines.

When an error occurs during the registration of a component, or when naming a component, then a EComponentError is raised. Possible causes are:

  1. An name with an illegal character was assigned to a component.
  2. A component with the same name and owner already exists.
  3. The component registration system isn't set up properly.
Exception raised when an error occurs during the parsing of streams. When an error occurs during the parsing of a stream, an EParserError is raised. Usually this indicates that an invalid token was found on the input stream, or the token read from the stream wasn't the expected token. Exception raised when the system is out of resources. This exception is not used in Free Pascal, it is defined for Delphi compatibiliy purposes only. Exception raised when an invalid operation is performed. Obsolete. This exception is not used in Free Pascal, it is defined for Delphi compatibiliy purposes only. Class to manage collections of pointers.

TList is a class that can be used to manage collections of pointers. It introduces methods and properties to store the pointers, search in the list of pointers, sort them. It manages its memory by itself, no intervention for that is needed. It has an event notification mechanism which allows to notify of list changes. This slows down some of TList mechanisms, and if no notification is used, may be used instead.

To manage collections of strings, it is better to use a descendent such as . To manage general objects, a class exists, from which a descendent can be made to manage collections of various kinds.

Class to manage collections of pointers.

TList.Create creates a new instance of TList. It clears the list and prepares it for use.

Destroys the list and releases the memory used to store the list elements. Destroy destroys the list and releases the memory used to store the list elements. The elements themselves are in no way touched, i.e. any meomory they point to must be explicitly released before calling the destructor. Adds a new pointer to the list.

Add adds a new pointer to the list after the last pointer (i.e. at position Count, thus increasing the item count with 1. If the list is at full capacity, the capacity of the list is expanded, using the Grow method.

To insert a pointer at a certain position in the list, use the Insert method instead.

Delete Grow Insert
Clears the pointer list. Clear removes all pointers from the list, and sets the capacity to 0, thus freeing any memory allocated to maintain the list. Destroy Removes a pointer from the list.

Delete removes the pointer at position Index from the list, shifting all following pointers one position up (or to the left).

The memory the pointer is pointing to is not deallocated.

Raises an exception. Error raises an exception, with a message formatted with Msg and Data. Exchanges two pointers in the list. Exchange exchanges the pointers at positions Index1 and Index2. Both pointers must be withing the current range of the list, or an exception will be raised. Increases the capacity of the list if needed.

Expand increases the capacity of the list if the current element count matches the current list capacity.

The capacity is increased according to the following algorithm:

  1. If the capacity is less than 3, the capacity is increased with 4.
  2. If the capacity is larger than 3 and less than 8, the capacity is increased with 8.
  3. If the capacity is larger than 8, the capacity is increased with 16.

The return value is Self.

Capacity
Returns the first non-nil pointer in the list.

First returns the value of the first non-nil pointer in the list.

If there are no pointers in the list or all pointers equal Nil, then Nil is returned.

Last
Returns the index of a given pointer.

IndexOf searches for the pointer Item in the list of pointers, and returns the index of the pointer, if found.

If no pointer with the value Item was found, -1 is returned.

Inserts a new pointer in the list at a given position.

Insert inserts pointer Item at position Index in the list. All pointers starting from Index are shifted to the right.

If Index is not a valid position, then a exception is raised.

Add Delete
Pointer to be inserted. Position where to insert Returns the last non-nil pointer in the list.

Last returns the value of the last non-nil pointer in the list.

If there are no pointers in the list or all pointers equal Nil, then Nil is returned.

First
Moves a pointer from one position in the list to another.

Move moves the pointer at position CurIndex to position NewIndex. This is done by storing the value at position CurIndex, deleting the pointer at position CurIndex, and reinserting the value at position NewIndex

If CurIndex or Newindex are not inside the valid range of indices, an exception is raised.

Exchange
Removes a value from the list. Remove searches Item in the list, and, if it finds it, deletes the item from the list. Only the first occurrence of Item is removed. Delete IndexOf Insert Removes Nil pointers from the list and frees unused memory. Pack removes all nil pointers from the list. The capacity of the list is then set to the number of pointers in the list. This method can be used to free unused memory if the list has grown to very large sizes and has a lot of unneeded nil pointers in it. Sorts the pointers in the list.

Sort> sorts the pointers in the list. Two pointers are compared by passing them to the Compare function. The result of this function determines how the pointers will be sorted:

  • If the result of this function is negative, the first pointer is assumed to be 'less' than the second and will be moved before the second in the list.
  • If the function result is positive, the first pointer is assumed to be 'greater than' the second and will be moved after the second in the list.
  • if the function result is zero, the pointers are assumed to be 'equal' and no moving will take place.

The sort is done using a quicksort algorithm.

Current capacity (i.e. number of pointers that can be stored) of the list.

Capacity contains the number of pointers the list can store before it starts to grow.

If a new pointer is added to the list using add or insert, and there is not enough memory to store the new pointer, then the list will try to allocate more memory to store the new pointer. Since this is a time consuming operation, it is important that this operation be performed as little as possible. If it is known how many pointers there will be before filling the list, it is a good idea to set the capacity first before filling. This ensures that the list doesn't need to grow, and will speed up filling the list.

SetCapacity Count
Current number of pointers in the list. Count is the current number of (possibly Nil) pointers in the list. Since the list is zero-based, the index of the largest pointer is Count-1. Capacity Provides access to the pointers in the list.

Items is used to access the pointers in the list. It is the default property of the TList class, so it can be omitted.

The list is zero-based, so Index must be in the range 0 to Count-1.

Memory array where pointers are stored. List points to the memory space where the pointers are stored. This can be used to quickly copy the list of pinters to another location. Class to manage collections of pointers.

TFPList is a class that can be used to manage collections of pointers. It introduces methods and properties to store the pointers, search in the list of pointers, sort them. It manages its memory by itself, no intervention for that is needed. Contrary to , TFPList has no notification mechanism. If no notification mechanism is used, it is better to use TFPList instead of TList, as the performance of TFPList is much higher.

To manage collections of strings, it is better to use a descendent such as . To manage general objects, a class exists, from which a descendent can be made to manage collections of various kinds.

Assign performs the given operation on the list. Assign can be used to merge or assign lists It is an extended version of the usual TPersistent.Assign mechanism. The arguments ListA and ListB are used as sources of pointers to add or remove elements from the current list, depending on the operation AOperation. The available operations are documented in the type. Remove the first occurrence of a pointer from the list. Extract searches for the first occurrence of Item in the list and deletes it from the list. If Item was found, it's value is returned. If Item was not found, Nil is returned. Destroys the list and releases the memory used to store the list elements. Destroy destroys the list and releases the memory used to store the list elements. The elements themselves are in no way touched, i.e. any meomory they point to must be explicitly released before calling the destructor. Adds a new pointer to the list.

Add adds a new pointer to the list after the last pointer (i.e. at position Count, thus increasing the item count with 1. If the list is at full capacity, the capacity of the list is expanded, using the Expand method.

To insert a pointer at a certain position in the list, use the Insert method instead.

Delete Grow Insert
Clears the pointer list. Clear removes all pointers from the list, and sets the capacity to 0, thus freeing any memory allocated to maintain the list. Destroy Removes a pointer from the list.

Delete removes the pointer at position Index from the list, shifting all following pointers one position up (or to the left).

The memory the pointer is pointing to is not deallocated.

Raises an exception. Error raises an exception, with a message formatted with Msg and Data. Exchanges two pointers in the list. Exchange exchanges the pointers at positions Index1 and Index2. Both pointers must be withing the current range of the list, or an exception will be raised. Increases the capacity of the list if needed.

Expand increases the capacity of the list if the current element count matches the current list capacity.

The capacity is increased according to the following algorithm:

  1. If the capacity is less than 3, the capacity is increased with 4.
  2. If the capacity is larger than 3 and less than 8, the capacity is increased with 8.
  3. If the capacity is larger than 8, the capacity is increased with 16.

The return value is Self.

Capacity
Returns the first non-nil pointer in the list.

First returns the value of the first non-nil pointer in the list.

If there are no pointers in the list or all pointers equal Nil, then Nil is returned.

Last
Returns the index of a given pointer.

IndexOf searches for the pointer Item in the list of pointers, and returns the index of the pointer, if found.

If no pointer with the value Item was found, -1 is returned.

Inserts a new pointer in the list at a given position.

Insert inserts pointer Item at position Index in the list. All pointers starting from Index are shifted to the right.

If Index is not a valid position, then a exception is raised.

Add Delete
Pointer to be inserted. Position where to insert Returns the last non-nil pointer in the list.

Last returns the value of the last non-nil pointer in the list.

If there are no pointers in the list or all pointers equal Nil, then Nil is returned.

First
Moves a pointer from one position in the list to another.

Move moves the pointer at position CurIndex to position NewIndex. This is done by storing the value at position CurIndex, deleting the pointer at position CurIndex, and reinserting the value at position NewIndex

If CurIndex or Newindex are not inside the valid range of indices, an exception is raised.

Exchange
Removes a value from the list. Remove searches Item in the list, and, if it finds it, deletes the item from the list. Only the first occurrence of Item is removed. Delete IndexOf Insert Removes Nil pointers from the list and frees unused memory. Pack removes all nil pointers from the list. The capacity of the list is then set to the number of pointers in the list. This method can be used to free unused memory if the list has grown to very large sizes and has a lot of unneeded nil pointers in it. Sorts the pointers in the list.

Sort> sorts the pointers in the list. Two pointers are compared by passing them to the Compare function. The result of this function determines how the pointers will be sorted:

  • If the result of this function is negative, the first pointer is assumed to be 'less' than the second and will be moved before the second in the list.
  • If the function result is positive, the first pointer is assumed to be 'greater than' the second and will be moved after the second in the list.
  • if the function result is zero, the pointers are assumed to be 'equal' and no moving will take place.

The sort is done using a quicksort algorithm.

Current capacity (i.e. number of pointers that can be stored) of the list.

Capacity contains the number of pointers the list can store before it starts to grow.

If a new pointer is added to the list using add or insert, and there is not enough memory to store the new pointer, then the list will try to allocate more memory to store the new pointer. Since this is a time consuming operation, it is important that this operation be performed as little as possible. If it is known how many pointers there will be before filling the list, it is a good idea to set the capacity first before filling. This ensures that the list doesn't need to grow, and will speed up filling the list.

SetCapacity Count
Current number of pointers in the list. Count is the current number of (possibly Nil) pointers in the list. Since the list is zero-based, the index of the largest pointer is Count-1. Capacity Provides access to the pointers in the list.

Items is used to access the pointers in the list. It is the default property of the TFPList class, so it can be omitted.

The list is zero-based, so Index must be in the range 0 to Count-1.

Memory array where pointers are stored. List points to the memory space where the pointers are stored. This can be used to quickly copy the list of pinters to another location. Thread-safe list object TThreadList is a thread-safe implementation. Unlike TList, it can be accessed read-write by multiple threads: the list implementation will take care of locking the list when adding or removing items from the list. Creates a new thread-safe list. Create instantiates a new TThreadList instance. It initializes a critical section and an internal list object. Destroys the list instance. Destroy finalizes the critical section, clears the internal list object and calls the inherited destructor. Adds an element to the list. Add attempts to lock the list and adds the pointer Item to the list. After the pointer was added, the list is unlocked again. LockList Clear Remove UnlockList Removes all emements from the list. Clear attempts to lock the list and then clears the list; all items are removed from the list. After the list is cleared, it is again unlocked. LockList Add Remove UnlockList Locks the list for exclusive access. LockList locks the list for exclusive access. Locklist uses an internal critical section, so all rules for multiple locking of critical sections apply to locklist/unlocklist as well. Clear Add Remove UnlockList Removes an item from the list. Remove attempts to lock the list and then removes Item from the list. After the item is removed, the list is again unlocked. LockList Add Clear UnlockList Unlocks the list after it was locked. UnLockList unlocks the list when it was locked for exclusive access. UnLocklist and LockList use an internal critical section, so all rules for multiple locking/unlocking of critical sections apply. Clear Add Remove lockList Used to calculate the size of a bits array Bitmask with all bits on. Maximum number of bit records in TBits. Maximum number of bits in TBits collection. Array to store bits. Class to store collections of bits (binary values that can be 0 or 1)

TBits can be used to store collections of bits in an indexed array. This is especially useful for storing collections of booleans: Normally the size of a boolean is the size of the smallest enumerated type, i.e. 1 byte. Since a bit can take 2 values it can be used to store a boolean as well. Since TBits can store 8 bits in a byte, it takes 8 times less space to store an array of booleans in a TBits class then it would take to store them in a conventional array.

TBits introduces methods to store and retrieve bit values, apply masks, and search for bits.

Creates a new bits collection.

Create creates a new bit collection with initial size TheSize. The size of the collection can be changed later on.

All bits are initially set to zero.

Destroy
Destroys a bit collection

Destroy destroys a previously created bit collection and releases all memory used to store the bit collection.

Destroy should never be called directly, Free should be used instead.

None. Create
Returns the number of records used to store the bits. GetFSize returns the number of records used to store the current number of bits. None. Size Turn a particular bit on. SetOn turns on the bit at position bit, i.e. sets it to 1. If bit is at a position bigger than the current size, the collection is expanded to the required size using Grow. If bit is larger than the maximum allowed bits array size or is negative, an exception is raised. Bits Clear Clears a particular bit. Clear clears the bit at position bit. If the array If bit is at a position bigger than the current size, the collection is expanded to the required size using Grow. If bit is larger than the maximum allowed bits array size or is negative, an exception is raised. Bits seton Clears all bits in the array. ClearAll clears all bits in the array, i.e. sets them to zero. ClearAll works faster than clearing all individual bits, since it uses the packed nature of the bits. None. Bits clear Performs an and operation on the bits. andbits performs an and operation on the bits in the array with the bits of array BitSet. If BitSet contains less bits than the current array, then all bits which have no counterpart in BitSet are cleared. None. ClearAll OrBits XOrBits NotBits Performs an or operation on the bits.

andbits performs an or operation on the bits in the array with the bits of array BitSet.

If BitSet contains less bits than the current array, then all bits which have no counterpart in BitSet are left untouched.

If the current array contains less bits than BitSet then it is grown to the size of BitSet before the or operation is performed.

None. ClearAll andBits XOrBits NotBits
Performs a xor operation on the bits.

XorBits performs a xor operation on the bits in the array with the bits of array BitSet.

If BitSet contains less bits than the current array, then all bits which have no counterpart in BitSet are left untouched.

If the current array contains less bits than BitSet then it is grown to the size of BitSet before the xor operation is performed.

None. ClearAll andBits OrBits NotBits
Performs a not operation on the bits.

NotBits performs a not operation on the bits in the array with the bits of array Bitset.

If BitSet contains less bits than the current array, then all bits which have no counterpart in BitSet are left untouched.

None. ClearAll andBits OrBits XOrBits
Retrieve the value of a particular bit Get returns True if the bit at position bit is set, or False if it is not set. If bit is not a valid bit index then an exception is raised. Bits FindFirstBit seton Expands the bits array to the requested size. Grow expands the bit array so it can at least contain nbit bits. If nbit is less than the current size, nothing happens. If there is not enough memory to complete the operation, then an is raised. Size Determines whether the bits of 2 arrays are equal.

equals returns True if all the bits in BitSet are the same as the ones in the current BitSet; if not, False is returned.

If the sizes of the two BitSets are different, the arrays are still reported equal when all the bits in the larger set, which are not present in the smaller set, are zero.

None. ClearAll andBits OrBits XOrBits
Sets the start position for FindNextBit and FindPrevBit

SetIndex sets the search start position forFindNextBit and FindPrevBit to Index. This means that these calls will start searching from position Index.

This mechanism provides an alternative to FindFirstBit which can also be used to position for the FindNextBit and FindPrevBit calls.

None. FindNextBit FindPrevBit FindFirstBit OpenBit
Find first bit with a particular value

FindFirstBit searches for the first bit with value State. It returns the position of this bit, or -1 if no such bit was found.

The search starts at position 0 in the array. If the first search returned a positive result, the found position is saved, and the FindNextBit and FindPrevBit will use this position to resume the search. To start a search from a certain position, the start position can be set with the SetIndex instead.

None. FindNextBit FindPrevBit OpenBit SetIndex
Searches the next bit with a particular value.

FindNextBit resumes a previously started search. It searches for the next bit with the value specified in the FindFirstBit. The search is done towards the end of the array and starts at the position last reported by one of the Find calls or at the position set with SetIndex.

If another bit with the same value is found, its position is returned. If no more bits with the same value are present in the array, -1 is returned.

None. FindFirstBit FindPrevBit OpenBit SetIndex
Searches the previous bit with a particular value.

FindPrevBit resumes a previously started search. It searches for the previous bit with the value specified in the FindFirstBit. The search is done towards the beginning of the array and starts at the position last reported by one of the Find calls or at the position set with SetIndex.

If another bit with the same value is found, its position is returned. If no more bits with the same value are present in the array, -1 is returned.

None. FindFirstBit FindNextBit OpenBit SetIndex
Returns the position of the first bit that is set to False. OpenBit returns the position of the first bit whose value is 0 (False), or -1 if no open bit was found. This call is equivalent to FindFirstBit(False), except that it doesn't set the position for the next searches. None. FindNextBit FindPrevBit FindFirstBit SetIndex Access to all bits in the array. Bits allows indexed access to all of the bits in the array. It gives True if the bit is 1, False otherwise; Assigning to this property will set, respectively clear the bit. If an index is specified which is out of the allowed range then an exception is raised. Size Current size of the array of bits. Size is the current size of the bit array. Setting this property will adjust the size; this is equivalent to calling Grow(Value-1) If an invalid size (negative or too large) is specified, a exception is raised. Bits Base class for streaming system and persistent properties.

TPersistent is the basic class for the streaming system. Since it is compiled in the {$M+} state, the compiler generates RTTI (Run-Time Type Information) for it and all classes that descend from it. This information can be used to stream all properties of classes.

It also introduces functionality to assign the contents of 2 classes to each other.

TPersistent implements the interface for the benefit of descendent classes, but does not call . Descendents such as and and do use it.

Raises an EConvertError when an error occurs during assignment. AssignError raises an EConvertError exception with the classnames of the Source and destination classes. It is used when two incompatible classes are assigned to each other. Assign AssignTo Generic assignment function.

AssignTo is the generic function to assign the class' contents to another class. This method must be overridden by descendent classes to actually assign the content of the source instance to the destination instance.

The implementation of Assignto raises an EConvertError exception. This is done for the following reason: If the source class doesn't know how to assign itself to the destination class (using AssignTo), the destination class may know how get the data from the source class (using Assign). If all descendent methods are implemented correctly, then if neither of the two classes knows how to assign their contents to each other, execution will end up at , which will simply execute

Dest.AssignTo(Self);

If neither of the classes knows how to assign to/from each other, then execution will end up at the TPersistent implementation of AssignTo, and an exception will be raised.

Assign
Declare non-published properties that need to be streamed.

DefineProperties must be overridden by descendent classes to indicate to the streaming system which non-published properties must also be streamed.

The streaming systems stores only published properties in the stream. Sometimes it is necessary to store additional data in the stream, data which is not published. This can be done by overriding the DefineProperties method. The Filer object is the class that is responsible for writing all properties to the stream.

To define new properties, two methods of the class should be used:

  1. DefineProperty, to define a property which can be represented as text.
  2. DefineProperty, to define a property which contains binary data.

On order for the streaming to work correctly, a call to the inherited DefineProperties is also needed, so ancestor objects also get the possibility to read or write their private data to the stream. Failure to call the inherited method will result in component properties not being streamed correctly.

Returns the owner of the component. GetOwner returns the owning component of the classes instane. The TPersistent implementation of GetOwner returns Nil. overrides this method. Destroys the TPersistent instance. Destroy disposes of the persistent object. This method should never be called directly. Instead the Free method should be used. Assign the contents of one class to another.

Assign copies the contents of Source to Self, if the classes of the destination and source classes are compatible.

The TPersistent implementation of Assign does nothing but calling the AssignTo method of source. This means that if the destination class does not know how to assign the contents of the source class, the source class instance is asked to assign itself to the destination class. This means that it is necessary to implement only one of the two methods so that two classes can be assiged to one another.

In general, a statement of the form

Destination:=Source;

(where Destination and Source are classes) does not achieve the same as a statement of the form

Destination.Assign(Source);

After the former statement, both Source and Destination will point to the same object. The latter statemtent will copy the contents of the Source class to the Destination class.

AssignTo
Returns a string that can be used to identify the class instance.

GetNamePath returns a string that can be used to identify the class instance. This can be used to display a name for this instance in a Object designer.

GetNamePath constructs a name by recursively prepending the Classname of the Owner instance to the Classname of this instance, separated by a dot.

Class reference type for . TPersistentClass is the class reference type for the class. Basic object that is managed by a class.

TCollectionItem and form a pair of base classes that manage a collection of named objects. The TCollectionItem is the named object that is managed, it represents one item in the collection. An item in the collection is represented by three properties: , and .

A TCollectionItem object is never created directly. To manage a set of named items, it is necessary to make a descendent of TCollectionItem to which needed properties and methods are added. This descendant can then be managed with a class. The managing collection will create and destroy it's items by itself, it should therefore never be necessary to create TCollectionItem descendents manually.

Method to notify the managing collection that the name or index of this item has changed. This method is called when the is set or when the is changed. Returns the namepath of this collection item. GetNamePath overrides the method to return the name of the managing collection and appends its property. Returns the managing collection. TCollectionItem overrides to and returns the that manages it. Returns the of the collectionitem

GetDisplayName returns the value of the property. By default, this is the classname of the actual TCollectionItem descendant.

Descendants of TCollectionItem can and should override this method to return a more meaningful value.

Write method for the property. SetIndex implements the write handler for the property. It requests the managing collection to move this item to the desired index value. Write method for the property

SetDisplayName is the write method for the property. It does nothing but notifying the managing collection that the displayname has changed. It does NOT store the actual Value.

Descendants of TCollectionItem should override this method to store the actual displayname if this is required.

Creates a new instance of this collection item. Create instantiates a new item in a . It is called by the function and should under normal circumstances never be called directly. called Destroyes this collection item.

Destroy removes the item from the managing collection and Destroys the item instance.

This is the only way to remove items from a collection;

Pointer to the collection managing this item. Collection points to the collection managing this item. This property can be set to point to a new collection. If this is done, the old collection will be notified that the item should no longer be managed, and the new collection is notified that it should manage this item as well. Initial index of this item.

ID is the initial value of ; it doesn't change after the index changes. It can be used to uniquely identify the item. The ID property doesn't change as items are added and removed from the collection.

While the property forms a continuous series, ID does not. If items are removed from the collection, their ID is not used again, leaving gaps. Only when the collection is initialiiy created, the ID and Index properties will be equal.

Index of the item in its managing collection property.

Index is the current index of the item in its managing collection's property. This property may change as items are added and removed from the collection.

The index of an item is zero-based, i.e. the first item has index zero. The last item has index Count-1 where Count is the number of items in the collection.

The Index property of the items in a collection form a continuous series ranging from 0 to Count-1. The property does not form a continuous series, but can also be used to identify an item.

Name of the item, displayed in the object inspector.

DisplayName contains the name of this item as shown in the object inspector. For TCollectionItem this returns always the class name of the managing collection, followed by the index of the item.

TCollectionItem does not implement any functionality to store the DisplayName property. The property can be set, but this will have no effect other than that the managing collection is notified of a change. The actual displayname will remain unchanged. To store the DisplayName property,TCollectionItem descendants should override the and to add storage functionality.

Class reference for . TCollectionItemClass is used by the property of to identify the descendent class of which should be created and managed. Base class to manage collections of named objects.

TCollection implements functionality to manage a collection of named objects. Each of these objects needs to be a descendent of the class. Exactly which type of object is managed can be seen from the property.

Normally, no TCollection is created directly. Instead, a descendents of TCollection and are created as a pair.

Returns the count of attributes associated with each item.

GetAttrCount returns 0 in the TCollection implementation. It can be used to determine the number of attributes associated with each collection item. Descendent objects should override this method to return the number of attributes.

This method is provided for compatibility with Delphi only and is not used in Free Pascal.

Returns an attribute of the collection.

This method is provided for compatibility with Delphi only and is not used in Free Pascal.

Returns the attributes of an item.

This method is provided for compatibility with Delphi only and is not used in Free Pascal.

Overrides to return a proper pathname.

GetNamePath returns the name path for this collection. If the following conditions are satisfied:

  1. There is an owner object.
  2. The owner object returns a non-empty name path.
  3. The property is not empty

collection has an owner and the owning object has a name, then the function returns the owner name, followed by the propname. If one of the conditions is not satisfied, then the classname is returned.

Procedure called if an item is added to or removed from the collection. Changed is called if a change takes place in the collection managed by the class. If the update count ghas reached zero, it calls with a nil argument. Read handler for the property. GetItem is the read handler for the property. It returns the Index-th element from the list of objects. If Index is outside the allowed range, then an exception is raised. Write handler for the property. SetItem implements the write handler for the property. It assignes Value to the Index-th element in the array. For this to work properly, the method of the Item must work correctly. If Index is outside the allowed range, then an exception is raised. Virtual method to set the name of the specified item Write handler for the property SetPropName must be overridden by descendent objects to set the property to a suitable value. By default, SetPropName sets the PropName property to empty. Hander called when an item in the collection has changed.

Update is called in the following cases:

  1. An item is added to or removed from the collection.
  2. An item is moved in the list, i.e. its property changes.
  3. An item's property changes.

Descendent classes can override this method to perform additional actions when the collection changes. The Item parameter indicates the item that was changed. This can be Nil

Name of the property that this collection represents. PropName indicates the name of the property that this collection is supposed to represent. By default, this is the empty string. Descendents can override this property to return the name of the property that is represented by this collection. Creates a new collection. Create instantiates a new instance of the TCollection class which will manage objects of class AItemClass. It creates the list used to hold all objects, and stores the AItemClass for the adding of new objects to the collection. Destroys the collection and frees all the objects it manages.

Destroy first clears the collection, and then frees all memory allocated to this instance.

Don't call Destroy directly, call Free instead.

Creates and adds a new item to the collection. Add instantiates a new item of class and adds it to the list. The newly created object is returned. Assigns one collection to another.

Assign assigns the contents of one collection to another. It does this by clearing the items list, and adding as much elements as there are in the Source collection; it assigns to each created element the contents of it's counterpart in the Source element.

Two collections cannot be assigned to each other if instances of the ItemClass classes cannot be assigned to each other.

If the objects in the collections cannot be assigned to one another, then an EConvertError is raised.
Start an update batch.

BeginUpdate is called at the beginning of a batch update. It raises the update count with 1.

Call BeginUpdate at the beginning of a series of operations that will change the state of the collection. This will avoid the call to for each operation. At the end of the operations, a corresponding call to EndUpdate must be made. It is best to do this in the context of a Try ... finally block:

With MyCollection Do try BeginUpdate; // Some Lengthy operations finally EndUpdate; end;

This insures that the number of calls to BeginUpdate always matches the number of calls to , even in case of an exception.

Removes all items from the collection. Clear will clear the collection, i.e. each item in the collection is destroyed and removed from memory. After a call to Clear, Count is zero. Ends an update batch. EndUpdate signals the end of a series of operations that change the state of the collection, possibly triggering an update event. It does this by decreasing the update count with 1 and calling it should always be used in conjunction with , preferably in the Finally section of a Try ... Finally block. Searches for an Item in the collection, based on its property.

FindItemID searches through the collection for the item that has a value of ID for its property, and returns the found item. If no such item is found in the collection, Nil is returned.

The routine performs a linear search, so this can be slow on very large collections.

Number of items in the collection.

Count contains the number of items in the collection.

The items in the collection are identified by their property, which is a zero-based index, meaning that it can take values between 0 and Count-1, borders included.
Class pointer for each item in the collection. ItemClass is the class pointer with which each new item in the collection is created. It is the value that was passed to the collection's constructor when it was created, and does not change during the lifetime of the collection. Indexed array of items in the collection.

Items provides indexed access to the items in the collection. Since the array is zero-based, Index should be an integer between 0 and Count-1.

It is possible to set or retrieve an element in the array. When setting an element of the array, the object that is assigned should be compatible with the class of the objects in the collection, as given by the property.

Adding an element to the array can be done with the method. The array can be cleared with the method. Removing an element of the array should be done by freeing that element.

IStringsAdapter Interface declaration. Is not yet supported in Free Pascal. Class to manage arrays or collections of strings

TStrings implements an abstract class to manage an array of strings. It introduces methods to set and retrieve strings in the array, searching for a particular string, concatenating the strings and so on. It also allows an arbitrary object to be associated with each string.

It also introduces methods to manage a series of name=value settings, as found in many configuration files.

An instance of TStrings is never created directly, instead a descendent class such as should be created. This is because TStrings is an abstract class which does not implement all methods; TStrings also doesn't store any strings, this is the functionality introduced in descendents such as .

TStrings implements the interface: when the stringlist is changed, a ooChanged notification is sent to all observers.

Method to stream the contents of the string collection DefineProperties allows the contents of the string collection to be streamed. As such, it overrides Raises an exception.

Error raises an exception. It passes Msg as a format with Data as the only argument.

This method can be used by descendent objects to raise an error.

Abstract read handler for the property.

Get is the abstract read handler for the property. This is an abstract method, hence it is not implemented in TStrings.

Descendent classes, such as must override this method and implement a routine that retrieves the Index-th string in the list. Index should have a value between 0 and Count-1, in all other cases an error should be raised using .

Abstract Read handler for the property.

GetCapacity is the read handler for the property. The implementation in TStrings will return 0.

Descendent classes can override this method. It should return the current number of strings that can be held by the stringlist before it attempts to expand it's storage space.

Abstract read handler for the property.

GetCount is the abstract read handler for the property. This is an abstract method, hence it is not implemented in TStrings.

Descendent classes must override this method. It should return the current number of strings in the list. (empty strings included).

Abstract read handler for the property.

GetObject is the read handler for the property. The TStrings implementation of this method ignores the Index argument and simply returns Nil.

Descendent classes that should support object storage should override this method and return the object associated to the Index-th string in the list. Index should have a value between 0 and Count-1. If Index is outside the allowed range, an error should be raised using .

Read handler for the property.

GetTextStr is the read handler for the property. It simply concatenates all strings in the list with a linefeed between them, and returns the resulting string.

Descendent classes may override this method to implement an efficienter algorithm which is more suitable to their storage method.

Write handler for the property.

Put is the write handler for the property. It does this by saving the object associated to the Index-th string, deleting the Index-th string, and inserting S and the saved object at position Index with

Descendent classes may wish to override Put to implement a more efficient method.

Write handler for the property.

PutObject is the write handler for the property. The TStrings implementation of PutObject does nothing.

Descendent objects that should support Object storage must override this method to store the AObject so that it is associated with the Index-th string in the list. Index should have a value between 0 and Count-1. If the value of Index is out of range, an error should be raised using .

Write handler for the property.

SetCapacity is the write handler for the property. The TStrings implementation of SetCapacity does nothing.

Descendent classes can override this method to set the current capacity of the stringlist to NewCapacity. The capacity is the number of strings the list can hold before it tries to expand its storage space. NewCapacity should be no less than Count.

Write handler for the property.

SetTextStr is the write method for the property. It does nothing other than calling .

Descendent classes may override this method to implement a more efficient algoritm that fits their storage method better.

Sets the update state.

SetUpdateState sets the update state to Updating. The TStrings implementation of SetUpdateState does nothing.

Descendent objects may override this method to implement optimizations. If Updating is True then the list of strings is about to be updated (possibly many times). If it is False no more updates will take place till the next SetUpdateState call.

Frees all strings and objects, and removes the list from memory. Destroy is the destructor of TStrings it does nothing except calling the inherited destructor. Add a string to the list Add adds S at the end of the list and returns the index of S in the list (which should equal " Add a string and associated object to the list.

AddObject adds S to the list of strings, and associates AObject with it. It returns the index of S.

An object added to the list is not automatically destroyed by the list of the list is destroyed or the string it is associated with is deleted. It is the responsibility of the application to destroy any objects associated with strings.
Add a string to the list. Append does the same as , only it does not return the index of the inserted string. Add contents of another stringlist to this list. AddStrings adds the contents of TheStrings to the stringlist. Any associated objects are added as well. Assign the contents of another stringlist to this one. Assign replaces the contents of the stringlist with the contents of Source if Source is also of type TStrings. Any associated objects are copied as well. Mark the beginning of an update batch.

BeginUpdate increases the update count by one. It is advisable to call BeginUpdate before lengthy operations on the stringlist. At the end of these operation, should be called to mark the end of the operation. Descendent classes may use this information to perform optmizations. e.g. updating the screen only once after many strings were added to the list.

All TStrings methods that modify the string list call BeginUpdate before the actual operation, and call endUpdate when the operation is finished. Descendent classes should also call these methods when modifying the string list.

Always put the corresponding call to in the context of a Finally block, to ensure that the update count is always descreased at the end of the operation, even if an exception occurred:

With MyStrings do try BeginUpdate; // Some lengthy operation. Finally EndUpdate end;
Removes all strings and associated objects from the list.

Clear will remove all strings and their associated objects from the list. After a call to clear, is zero.

Since it is an abstract method, TStrings itself does not implement Clear. Descendent classes such as implement this method.

"
Delete a string from the list.

Delete deletes the string at position Index from the list. The associated object is also removed from the list, but not destroyed. Index is zero-based, and should be in the range 0 to Count-1.

Since it is an abstract method, TStrings itself does not implement Delete. Descendent classes such as implement this method.

If Index is not in the allowed range, an is raised.
Mark the end of an update batch.

EndUpdate should be called at the end of a lengthy operation on the stringlist, but only if there was a call to BeginUpdate before the operation was started. It is best to put the call to EndUpdate in the context of a Finally block, so it will be called even if an exception occurs.

For more information, see .

TStrings implements the interface: when EndUpdate is called, a ooChanged notification is sent to all observers.

Compares the contents of two stringlists.

Equals compares the contents of the stringlist with the contents of TheStrings. If the contents match, i.e. the stringlist contain an equal amount of strings, and all strings match, then True is returned. If the number of strings in the lists is is unequal, or they contain one or more different strings, False is returned.

  1. The strings are compared case-insensitively.
  2. The associated objects are not compared
Exchanges two strings in the list.

Exchange exchanges the strings at positions Index1 and Index2. The associated objects are also exchanged.

Both indexes must be in the range of valid indexes, i.e. must have a value between 0 and Count-1.

If either Index1 or Index2 is not in the range of valid indexes, an exception is raised.
Returns the contents as a PChar

GetText allocates a memory buffer and compies the contents of the stringlist to this buffer as a series of strings, separated by an end-of-line marker. The buffer is zero terminated.

The caller is responsible for freeing the returned memory buffer.
Find a string in the list and return its position.

IndexOf searches the list for S. The search is case-insensitive. If a matching entry is found, its position is returned. if no matching string is found, -1 is returned.

  1. Only the first occurrence of the string is returned.
  2. The returned position is zero-based, i.e. 0 indicates the first string in the list.
Finds the index of a name in the name-value pairs.

IndexOfName searches in the list of strings for a name-value pair with name part Name. If such a pair is found, it returns the index of the pair in the stringlist. If no such pair is found, the function returns -1. The search is done case-insensitive.

  1. Only the first occurrence of a matching name-value pair is returned.
  2. The returned position is zero-based, i.e. 0 indicates the first string in the list.
Finds an object in the list and returns its index.

IndexOfObject searchs through the list of strings till it find a string associated with AObject, and returns the index of this string. If no such string is found, -1 is returned.

  1. Only the first occurrence of a string with associated object AObject is returned; if more strings in the list can be associated with AObject, they will not be found by this routine.
  2. The returned position is zero-based, i.e. 0 indicates the first string in the list.
Insert a string in the list.

Insert inserts the string S at position Index in the list. Index is a zero-based position, and can have values from 0 to Count. If Index equals Count then the string is appended to the list.

  1. All methods that add strings to the list use Insert to add a string to the list.
  2. If the string has an associated object, use instead.
If Index is less than zero or larger than Count then an exception is raised.
Insert a string and associated object in the list.

InsertObject inserts the string S and its associated objectAObject at position Index in the list. Index is a zero-based position, and can have values from 0 to Count. If Index equals Count then the string is appended to the list.

If Index is less than zero or larger than Count then an exception is raised.
Load the contents of a file as a series of strings.

LoadFromFile loads the contents of a file into the stringlist. Each line in the file (as marked by the end-of-line marker of the particular OS the application runs on) becomes one string in the stringlist. This action replaces the contents of the stringlist, it does not append the strings to the current content.

LoadFromFile simply creates a file stream with the given filename, and then executes ; after that the file stream object is destroyed again.

Load the contents of a stream as a series of strings. LoadFromStream loads the contents of Stream into the stringlist. Each line in the stream (as marked by the end-of-line marker of the particular OS the application runs on) becomes one string in the stringlist. This action replaces the contents of the stringlist, it does not append the strings to the current content. Move a string from one place in the list to another.

Move moves the string at position CurIndex so it has position NewIndex after the move operation. The object associated to the string is also moved. CurIndex and NewIndex should be in the range of 0 to Count-1.

NewIndex is not the position in the stringlist before the move operation starts. The move operation

  1. removes the string from position CurIndex
  2. inserts the string at position NewIndex

This may not lead to the desired result if NewIndex is bigger than CurIndex. Consider the following example:

With MyStrings do begin Clear; Add('String 0'); Add('String 1'); Add('String 2'); Add('String 3'); Add('String 4'); Move(1,3); end;

After the Move operation has completed, 'String 1' will be between 'String 3' and 'String 4'.

If either CurIndex or NewIndex is outside the allowed range, an is raised.
Save the contents of the list to a file.

SaveToFile saves the contents of the stringlist to the file with name FileName. It writes the strings to the file, separated by end-of-line markers, so each line in the file will contain 1 string from the stringlist.

SaveToFile creates a file stream with name FileName, calls and then destroys the file stream object.

An exception can be raised if the file FileName cannot be opened, or if it cannot be written to.
Save the contents of the string to a stream.

SaveToStream saves the contents of the stringlist to Stream. It writes the strings to the stream, separated by end-of-line markers, so each 'line' in the stream will contain 1 string from the stringlist.

An exception can be raised if the stream cannot be written to.
Set the contents of the list from a PChar. SetText parses the contents of TheText and fills the stringlist based on the contents. It regards TheText as a series of strings, separated by end-of-line markers. Each of these strings is added to the stringlist. Capacity of the list, i.e. number of strings that the list can currently hold before it tries to expand.

Capacity is the number of strings that the list can hold before it tries to allocate more memory.

TStrings returns when read. Trying to set the capacity has no effect. Descendent classes such as can override this property such that it actually sets the new capacity.

Return both name and value of a name,value pair based on it's index. Delimiter character used in DelimitedText. Delimiter is the delimiter character used to separate the different strings in the stringlist when they are read or set through the DelimitedText property. Get or set all strings in the list in a delimited form.

DelimitedText returns all strings, properly quoted with QuoteChar and separated by the Delimiter character.

Strings are quoted if they contain a space or any character with ASCII value less than 32.

The CommaText property is a special case of delimited text where the delimiter character is a comma and the quote character is a double quote.

If StrictDelimiter is set to True, then no quoting is done (The QuoteChar property is disregarded completely): the returned text will contain the items in the stringlist, separated by the Delimiter character. When writing the DelimitedText property, the text will be split at all occurrences of the Delimiter character; however, when reading, the QuoteChar property will be taken into account.

Quote character used in DelimitedText. QuoteChar is the character used by the DelimitedText property to quote strings that have a space or non-printing character in it. Value of the character used to separate name,value pairs

NameValueSeparator is the character used to separate name,value pair. By default, this is the equal sign (=), resulting in Name=Value pairs.

It can be set to a colon for Name : Value pairs.

Return the value part of a string based on it's index. ValueFromIndex returns the value part of a string based on the string index. The value part are all characters in the string after the NameValueSeparator character, or all characters if the NameValueSeparator character is not present. Sort the stringlist using a custom sort algorithm CustomSort sorts the stringlist with a custom comparison function. The function should compare 2 elements in the list, and return a negative number if the first item is before the second. It should return 0 if the elements are equal, and a positive result indicates that the second elements should be before the first. Indicates whether locating strings happens in a case sensitive manner. Contents of the list as a comma-separated string.

CommaText represents the stringlist as a single string, consisting of a comma-separated concatenation of the strings in the list. If one of the strings contains spaces, comma's or quotes it will be enclosed by double quotes. Any double quotes in a string will be doubled. For instance the following strings:

Comma,string
Quote"string
Space string
NormalSttring

is converted to

"Comma,string","Quote""String","Space string",NormalString

Conversely, when setting the CommaText property, the text will be parsed according to the rules outlined above, and the strings will be set accordingly. Note that spaces will in this context be regarded as string separators, unless the string as a whole is contained in double quotes. Spaces that occur next to a delimiter will be ignored. The following string:

"Comma,string" , "Quote""String",Space string,, NormalString

Will be converted to

Comma,String
Quote"String
Space
String

NormalString

This is a special case of the property where the quote character is always the double quote, and the delimiter is always the colon.

Number of strings in the list.

Count is the current number of strings in the list. TStrings does not implement this property; descendent classes should override the property read handler to return the correct value.

Strings in the list are always uniquely identified by their Index; the index of a string is zero-based, i.e. it's supported range is 0 to Count-1. trying to access a string with an index larger than or equal to Count will result in an error. Code that iterates over the list in a stringlist should always take into account the zero-based character of the list index.

Name parts of the name-value pairs in the list.

Names provides indexed access to the names of the name-value pairs in the list. It returns the name part of the Index-th string in the list.

The index is not an index based on the number of name-value pairs in the list. It is the name part of the name-value pair a string Index in the list. If the string at position Index is not a name-value pair (i.e. does not contain the equal sign (=)), then an empty name is returned.
Indexed access to the objects associated with the strings in the list.

Objects provides indexed access to the objects associated to the strings in the list. Index is a zero-based index and must be in the range of 0 to Count-1.

Setting the objects property will not free the previously associated object, if there was one. The caller is repsonsible for freeing the object that was previously associated to the string.

TStrings does not implement any storage for objects. Reading the Objects property will always return Nil, Setting the property will have no effect. It is the responsability of the descendent classes to provide storage for the associated objects.

If an Index outside the valid range is specified, an exception will be raised.
Value parts of the name-value pairs in the list.

Values represents the value parts of the name-value pairs in the list.

When reading this property, if there is a name-value pair in the list of strings that has name part Name, then the corresponding value is returned. If there is no such pair, an empty string is returned.

When writing this value, first it is checked whether there exists a name-value pair in the list with name Name. If such a pair is found, it's value part is overwritten with the specified value. If no such pair is found, a new name-value pair is added with the specified Name and value.

  1. Names are compared case-insensitively.
  2. Any character, including whitespace, up till the first equal (=) sign in a string is considered part of the name.
Indexed access to the strings in the list.

Strings is the default property of TStrings. It provides indexed read-write access to the list of strings. Reading it will return the string at position Index in the list. Writing it will set the string at position Index.

Index is the position of the string in the list. It is zero-based, i.e. valued values range from 0 (the first string in the list) till Count-1 (the last string in the list). When browsing through the strings in the list, this fact must be taken into account.

To access the objects associated with the strings in the list, use the property. The name parts of name-value pairs can be accessed with the property, and the values can be set or read through the property.

Searching through the list can be done using the method.

If Index is outside the allowed range, an exception is raised.
Contents of the list as one big string.

Text returns, when read, the contents of the stringlist as one big string consisting of all strings in the list, separated by an end-of-line marker. When this property is set, the string will be cut into smaller strings, based on the positions of end-of-line markers in the string. Any previous content of the stringlist will be lost.

If any of the strings in the list contains an end-of-line marker, then the resulting string will appear to contain more strings than actually present in the list. To avoid this ambiguity, use the property instead.
Not implemented in Free Pascal. Type to describe what to do with duplicate values in a . Duplicate values will not be be added to the list, but no error will be triggered. Duplicate values can be added to the list. If an attempt is made to add a duplicate value to the list, an exception is raised. Duplicate values will not be be added to the list, but no error will be triggered. Duplicate values can be added to the list. If an attempt is made to add a duplicate value to the list, an exception is raised. Array of records. This declaration is provided for Delphi compatibility, it is not used in Free Pascal. Standard implementation of the class.

TStringList is a descendent class of that implements all of the abstract methods introduced there. It also introduces some additional methods:

  • Sort the list, or keep the list sorted at all times
  • Special handling of duplicates in sorted lists
  • Notification of changes in the list
Called when the list of strings was modified. Called when the list is changing. Overrides the standard read handler for the property. Overrides the standard read handler for the property. Overrides the standard read handler for the property. Overrides the standard read handler for the property. Overrides the standard write handler for the property. Overrides the standard write handler for the property. Overrides the standard write handler for the property. Overrides the standard call. Destroys the stringlist.

Destroy clears the stringlist, release all memory allocated for the storage of the strings, and then calls the inherited destroy method.

Any objects associated to strings in the list will not be destroyed; it is the responsability of the caller to destroy all objects associated with strings in the list.
Implements the function.

Add will add S to the list. If the list is sorted and the string S is already present in the list and is dupError then an exception is raised. If Duplicates is set to dupIgnore then the return value is underfined.

If the list is sorted, new strings will not necessarily be added to the end of the list, rather they will be inserted at their alphabetical position.

If the list is sorted and the string S is already present in the list and is dupError then an exception is raised.
Implements the function. Implements the function. Implements the function.

Exchange will exchange two items in the list as described in .

Exchange will not check whether the list os sorted or not; if Exchange is called on a sorted list and the strings are not identical, the sort order of the list will be destroyed.
Locates the index for a given string in sorted lists.

Find returns True if the string S is present in the list. Upon exit, the Index parameter will contain the position of the string in the list. If the string is not found, the function will return False and Index will contain the position where the string will be inserted if it is added to the list.

  1. Use this method only on sorted lists. For unsorted lists, use instead.
  2. Find uses a binary search method to locate the string
Overrides the property. IndexOf overrides the ancestor method . It tries to optimize the search by executing a binary search if the list is sorted. The function returns the position of S if it is found in the list, or -1 if the string is not found in the list. Overrides the method. Insert will insert the string S at position Index in the list. If the list is sorted, an exception will be raised instead. Index is a zero-based position. If Index contains an invalid value (less than zero or larger than Count, or the list is sorted, an exception will be raised. Sorts the strings in the list. Sort will sort the strings in the list using the quicksort algorithm. If the list has its property set to True then nothing will be done. Describes the behaviour of a sorted list with respect to duplicate strings.

Duplicates describes what to do in case a duplicate value is added to the list:

dupIgnore
dupError
dupAccept

If the stringlist is not sorted, the Duplicates setting is ignored.

Determines whether the list is sorted or not.

Sorted can be set to True in order to cause the list of strings to be sorted. Further additions to the list will be inserted at the correct position so the list remains sorted at all times. Setting the property to False has no immediate effect, but will allow strings to be inserted at any position.

  1. When Sorted is True, cannot be used. For sorted lists, should be used instead.
  2. If Sorted is True, the setting has effect. This setting is ignored when Sorted is False.
Event triggered after the list was modified.

OnChange can be assigned to respond to changes that have occurred in the list. The handler is called whenever strings are added, moved, modified or deleted from the list.

The Onchange event is triggered after the modification took place. When the modification is about to happen, an event occurs.

Event triggered when the list is about to be modified.

OnChanging can be assigned to respond to changes that will occurred in the list. The handler is called whenever strings will be added, moved, modified or deleted from the list.

The Onchanging event is triggered before the modification will take place. When the modification has happened, an event occurs.

Base class for streams.

TStream is the base class for all streaming classes. It defines methods for reading, writing from and to streams, as well as functions to determine the size of the stream as well as the current position of the stream.

Descendent classes such as or then override these methods to write streams to memory or file.

Sets the size of the stream SetSize is the write handler for the property. The TStream implementation of SetSize does nothing, but descendent classes may override this methods to allow programmers to set the size of the stream. Reads data from the stream to a buffer and returns the number of bytes read.

Read attempts to read Count from the stream to Buffer and returns the number of bytes actually read.

This method should be used when the number of bytes is not determined. If a specific number of bytes is expected, use instead.

As implemented in TStream, Read does nothing but raises an exception to indicate that reading is not supported. Descendent classes that allow reading must override this method to do the actual reading.

In case a descendent class does not allow reading from the stream, an exception is raised.
Writes data from a buffer to the stream and returns the number of bytes written.

Write attempts to write Count bytes from Buffer to the stream. It returns the actual number of bytes written to the stream.

This method should be used when the number of bytes that should be written is not determined. If a specific number of bytes should be written, use instead.

As implemented in TStream, Write does nothing but raises exception to indicate that writing is not supported. Descendent classes that allow writing must override this method to do the actual writing.

In case a descendent class does not allow writing to the stream, an exception is raised.
Sets the current position in the stream

Seek sets the position of the stream to Offset bytes from Origin. There is a 32-bit variant of this function and a 64-bit variant. The difference can be made by choosing the correct Offset parameter: the integer-typed parameter selects the 32-bit variant, the parameter of type selects the 64-bit variant of the function.

The Origin parameter for the 32-bit version can have one of the following values:

ConstantMeaning
soFromBeginningSet the position relative to the start of the stream.
soFromCurrentSet the position relative to the current position in the stream.
soFromEndSet the position relative to the end of the stream.

These values are defined in the unit.

The Origin parameter for the 64-bit version has one of the following values:

ValueMeaning
soBeginning
soCurrent
soEnd

Offset should be negative when the origin is SoFromEnd (soEnd). It should be positive for soFromBeginning and can have both signs for soFromCurrent

This is an abstract method, which must be overridden by descendent classes. They may choose not to implement this method for all values of Origin and Offset.

Internally, all calls are re-routed to the 64-bit version of the call. When creating a descendent of TStream, the 64-bit version of the call should be overridden.
An exception may be raised if this method is called with an invalid pair of Offset,Origin values. e.g. a negative offset for soFromBeginning (or soBeginning).
Reads data from the stream to a buffer

ReadBuffer reads Count bytes of the stream into Buffer. If the stream does not contain Count bytes, then an exception is raised.

ReadBuffer should be used to read in a fixed number of bytes, such as when reading structures or the content of variables. If the number of bytes is not determined, use instead. ReadBuffer uses Read internally to do the actual reading.

If the stream does not allow to read Count bytes, then an exception is raised.
Writes data from a buffer to the stream

WriteBuffer writes Count bytes to the stream from Buffer. If the stream does not allow Count bytes to be written, then an exception is raised.

WriteBuffer should be used to write a fixed number of bytes, such as when writing structures or the content of variables. If the number of bytes is not determined, use instead. WriteBuffer uses Write internally to do the actual writing.

If the stream does not allow to write Count bytes, then an exception is raised.
Copy data from one stream to another

CopyFrom reads Count bytes from Source and writes them to the current stream. This updates the current position in the stream. After the action is completed, the number of bytes copied is returned. If Count is zero, then the whole contents of the Source stream is copied. It is positioned on the first byte of data, and Size bytes are copied. Note that this cannot be used with streams that do not allow seeking or do not allow determining the size of the stream.

This can be used to quickly copy data from one stream to another or to copy the whole contents of the stream.

Reads component data from a stream

ReadComponent reads a component state from the stream and transfers this state to Instance. If Instance is nil, then it is created first based on the type stored in the stream. ReadComponent returns the component as it is read from the stream.

ReadComponent simply creates a object and calls its ReadRootComponent method.

If an error occurs during the reading of the component, an exception is raised.
Reads component data and resource header from a stream

ReadComponentRes reads a resource header from the stream, and then calls ReadComponent to read the component state from the stream into Instance.

This method is usually called by the global streaming method when instantiating forms and datamodules as created by an IDE. It should be used mainly on Windows, to store components in Windows resources.

If an error occurs during the reading of the component, an exception is raised.
Write component data to the stream

WriteComponent writes the published properties of Instance to the stream, so they can later be read with . This method is intended to be used by an IDE, to preserve the state of a form or datamodule as designed in the IDE.

WriteComponent simply calls WriteDescendent with Nil ancestor.

Write resource header and component data to a stream

WriteComponentRes writes a ResName resource header to the stream and then calls WriteComponent to write the published properties of Instance to the stream.

This method is intened for use by an IDE that can use it to store forms or datamodules as designed in a Windows resource stream.

Write component data to a stream, relative to an ancestor

WriteDescendent writes the state of Instance to the stream where it differs from Ancestor, i.e. only the changed properties are written to the stream.

WriteDescendent creates a object and calls its WriteDescendent object. The writer is passed a binary driver object by default.

Write resource header and component data to a stream, relative to an ancestor

WriteDescendentRes writes a ResName resource header, and then calls WriteDescendent to write the state of Instance to the stream where it differs from Ancestor, i.e. only the changed properties are written to the stream.

This method is intened for use by an IDE that can use it to store forms or datamodules as designed in a Windows resource stream.

Write resource header to the stream

WriteResourceHeader writes a resource-file header for a resource called ResName. It returns in FixupInfo the argument that should be passed on to .

WriteResourceHeader should not be used directly. It is called by the and methods.

Not implemented in FPC

FixupResourceHeader is used to write the size of the resource after a component was written to stream. The size is determined from the current position, and it is written at position FixupInfo. After that the current position is restored.

FixupResourceHeader should never be called directly; it is handled by the streaming system.

Read a resource header from the stream.

ReadResourceHeader reads a reasource file header from the stream. It positions the stream just beyond the header.

ReadResourceHeader should not be called directly, it is called by the streaming system when needed.

If the resource header is invalid an exception is raised.
Read a byte from the stream and return its value. ReadByte reads one byte from the stream and returns its value. If the byte cannot be read, a exception will be raised. This is a utility function which symply calls the Read function. Read a word from the stream and return its value. ReadWord reads one Word (i.e. 2 bytes) from the stream and returns its value. This is a utility function which symply calls the Read function. If the word cannot be read, a exception will be raised. Read a DWord from the stream and return its value. ReadDWord reads one DWord (i.e. 4 bytes) from the stream and returns its value. This is a utility function which simply calls the Read function. If the DWord cannot be read, a exception will be raised. Read an ansistring from the stream and return its value. ReadAnsiString reads an ansistring from the stream and returns its value. This is a utility function which simply calls the read function several times. The Ansistring should be stored as 4 bytes (a DWord) representing the length of the string, and then the string value itself. The WriteAnsiString function writes an ansistring in such a format. If the AnsiString cannot be read, a exception will be raised. Write a byte to the stream. WriteByte writes the byte B to the stream. This is a utility function which simply calls the Write function. The byte can be read from the stream using the ReadByte function. If an error occurs when attempting to write, an exception will be raised. Write a word to the stream. WriteWord writes the word W (i.e. 2 bytes) to the stream. This is a utility function which simply calls the Write function. The word can be read from the stream using the ReadWord function. If an error occurs when attempting to write, an exception will be raised. Write a DWord to the stream. WriteDWord writes the DWord D (i.e. 4 bytes) to the stream. This is a utility function which simply calls the Write function. The DWord can be read from the stream using the ReadDWord function. If an error occurs when attempting to write, an exception will be raised. Write an ansistring to the stream. WriteAnsiString writes the AnsiString S (i.e. 4 bytes) to the stream. This is a utility function which simply calls the Write function. The ansistring is written as a 4 byte length specifier, followed by the ansistring's content. The ansistring can be read from the stream using the ReadAnsiString function. If an error occurs when attempting to write, an exception will be raised. The current position in the stream.

Position can be read to determine the current position in the stream. It can be written to to set the (absolute) position in the stream. The position is zero-based, so to set the position at the beginning of the stream, the position must be set to zero.

Not all TStream descendants support setting the position in the stream, so this should be used with care.
Some descendents may raise an exception if they do not support setting the stream position.
The current size of the stream.

Size can be read to determine the stream size or to set the stream size.

Not all descendents of TStream support getting or setting the stream size; they may raise an exception if the Size property is read or set.
Base class for streams that are identified by an OS handle.

THandleStream is an abstract descendent of the class that provides methods for a stream to handle all reading and writing to and from a handle, provided by the underlying OS. To this end, it overrides the Read and Write methods of TStream.

  • ThandleStream does not obtain a handle from the OS by itself, it just handles reading and writing to such a handle by wrapping the system calls for reading and writing; Descendent classes should obtain a handle from the OS by themselves and pass it on in the inherited constructor.
  • Contrary to Delphi, no seek is implemented for THandleStream, since pipes and sockets do not support this. The seek is implemented in descendent methods that support it.
Create a handlestream from an OS Handle. Create creates a new instance of a THandleStream class. It stores AHandle in an internal variable and then calls the inherited constructor. Overrides standard read method.

Read overrides the Read method of TStream. It uses the Handle property to read the Count bytes into Buffer

If no error occurs while reading, the number of bytes actually read will be returned.

If the operating system reports an error while reading from the handle, -1 is returned.
Overrides standard write method.

Write overrides the Write method of TStream. It uses the Handle property to write the Count bytes from Buffer.

If no error occurs while writing, the number of bytes actually written will be returned.

If the operating system reports an error while writing to the handle, 0 is returned.
The OS handle of the stream. Handle represents the Operating system handle to which reading and writing is done. The handle can be read only, i.e. it cannot be set after the THandlestream instance was created. It should be passed to the constructor Stream that stores its data in a named file on disk.

TFileStream is a descdendent that stores or reads it's data from a named file in the filesystem of the operating system.

To this end, it overrides some of the methods in TStream and implements them for the case of files on disk, and it adds the FileName property to the list of public properties.

Sets the size of the file stream.

SetSize sets the size of the file at NewSize bytes. Errors returned by the operating system call will be silently ignored.

This is the protected write method of the public property.

Creates a file stream.

Create creates a new instance of a TFileStream class. It opens the file AFileName with mode Mode, which can have one of the following values:

fmCreate
fmOpenRead
fmOpenWrite
fmOpenReadWrite

After the file has been opened in the requested mode and a handle has been obtained from the operating system, the inherited constructor is called.

If the file could not be opened in the requested mode, an exception is raised.
Destroys the file stream.

Destroy closes the file (causing possible buffered data to be written to disk) and then calls the inherited destructor.

Do not call destroy directly, instead call the Free method. Destroy does not check whether Self is nil, while Free does.

Overrides the standard method.

Seek attempts to set the position of the stream at Offset bytes from Origin. Offset can have any integer value which would set the position within the boundaries of the file, and thus the valid range depends on the value of Origin. Origin can have one of the following values:

soFromBeginning
soFromCurrent
soFromEnd

Seek returns the new position in the file, or -1 on error.

On error, -1 is returned, and the position is not changed.
The filename of the stream. FileName is the name of the file that the stream reads from or writes to. It is the name as passed in the constructor of the stream; it cannot be changed. To write to another file, the stream must be freed and created again with the new filename. Abstract stream that stores its data in memory.

TCustomMemoryStream is the parent class for streams that stored their data in memory. It introduces all needed functions to handle reading from and navigating through the memory, and introduces a Memory property which points to the memory area where the stream data is kept.

The only thing which TCustomMemoryStream does not do is obtain memory to store data when writing data or the writing of data. This functionality is implemented in descendent streams such as . The reason for this approach is that this way it is possible to create e.g. read-only descendents of TCustomMemoryStream that point to a fixed part in memory which can be read from, but not written to.

Since TCustomMemoryStream is an abstract class, do not create instances of TMemoryStream directly. Instead, create instances of descendents such as .
Sets the internal memory pointer and size of the memory block.

SetPointer updates the internal memory pointer and the size of the memory area pointed to.

Descendent memory streams should call this method whenever they set or reset the memory the stream should read from or write to.

Reads Count bytes from the stream into buffer.

Read reads Count bytes from the stream into the memory pointed to by buffer. It returns the number of bytes actually read.

This method overrides the method of . It will read as much bytes as are still available in the memory area pointer to by Memory. After the bytes are read, the internal stream position is updated.

Sets a new position in the stream. Seek overrides the abstract method. It simply updates the internal stream position, and returns the new position. No checking is done whether the new position is still a valid position, i.e. whether the position is still within the range 0..Size. Attempting a seek outside the valid memory range of the stream may result in an exception at the next read or write operation. Writes the contents of the memory stream to another stream.

SaveToStream writes the contents of the memory stream to Stream. The content of Stream is not cleared first. The current position of the memory stream is not changed by this action.

This method will work much faster than the use of the method:

Seek(0,soFromBeginning); Stream.CopyFrom(Self,Size);

because the CopyFrom method copies the contents in blocks, while SaveToStream writes the contents of the memory as one big block.

If an error occurs when writing to Stream an exception will be raised.
Writes the contents of the stream to a file.

SaveToFile writes the contents of the stream to a file with name FileName. It simply creates a filestream and writes the contents of the memorystream to this file stream using .

This method will work much faster than the use of the method:

Stream:=TFileStream.Create(fmCreate,FileName); Seek(0,soFromBeginning); Stream.CopyFrom(Self,Size);

because the CopyFrom method copies the contents in blocks, while SaveToFile writes the contents of the memory as one big block.

If an error occurs when creating or writing to the file, an exception may occur.
Pointer to the data kept in the memory stream.

Memory points to the memory area where stream keeps it's data. The property is read-only, so the pointer cannot be set this way.

Do not write to the memory pointed to by Memory, since the memory content may be read-only, and thus writing to it may cause errors.
Standard implementation of a stream that stores its data in memory

TMemoryStream is a descendent that stores it's data in memory. It descends directly from and implements the necessary to allocate and de-allocate memory directly from the heap. It implements the Write method which is missing in TCustomMemoryStream.

TMemoryStream also introduces methods to load the contents of another stream or a file into the memory stream.

It is not necessary to do any memory management manually, as the stream will allocate or de-allocate memory as needed. When the stream is freed, all allocated memory will be freed as well.

Sets the new capacity for the memory stream

SetCapacity sets the capacity of the memory stream, i.e. does the actual allocation or de-allocation of memory for the stream. It allocates at least NewCapacity bytes on the heap, moves the current contents of the stream to this location (as much as fits in) and returns the new memory location. Extra allocated memory is not initialized, i.e. may contain garbage.

Memory is allocated in blocks of 4 Kb; this can be changed by overriding the method.

Current capacity of the stream.

Capacity is the current capacity of the stream, this is the current size of the memory allocated to the stream. This is not necessarily equal to the size of the stream, but will always be larger than or equal to the size of the stream. When writing to the stream, the sets the capacity to the needed value.

If a lot of write operations will occur, performance may be improved by setting the capacity to a large value, so less reallocations of memory will occur while writing to the stream.

Frees any allocated memory and destroys the memory stream. Destroy clears the memory stream, thus in effect freeing any memory allocated for it, and then frees the memory stream. Zeroes the position, capacity and size of the stream. Clear sets the position and size to 0, and sets the capacity of the stream to 0, thus freeing all memory allocated for the stream. Loads the contents of a stream into memory.

LoadFromStream loads the contents of Stream into the memorybuffer of the stream. Any previous contents of the memory stream are overwritten. Memory is allocated as needed.

The LoadFromStream uses the Size property of Stream to determine how much memory must be allocated. Some streams do not allow the stream size to be determined, so care must be taken when using this method.

This method will work much faster than the use of the method:

Seek(0,soFromBeginning); CopyFrom(Stream,Stream.Size);

because the CopyFrom method copies the contents in blocks, while LoadFromStream reads the contents of the stream as one big block.

If an error occurs when reading from the stream, an may occur.
Loads the contents of a file into memory.

LoadFromFile loads the contents of the file with name FileName into the memory stream. The current contents of the memory stream is replaced by the contents of the file. Memory is allocated as needed.

The LoadFromFile method simply creates a filestream and then calls the method.

If an error occurs when creating or reading from the stream, an may occur.
Sets the size for the memory stream. SetSize sets the size of the memory stream to NewSize. This will set the capacity of the stream to NewSize and correct the current position in the stream when needed. Writes data to the stream's memory.

Write writes Count bytes from Buffer to the stream's memory, starting at the current position in the stream. If more memory is needed than currently allocated, more memory will be allocated. Any contents in the memory stream at the current position will be overwritten. The function returns the number of bytes actually written (which should under normal circumstances always equal Count).

This method overrides the method.

If no more memory could be allocated, then an exception will be raised.
Stream that stores its data in a string.

TStringStream stores its data in an ansistring. The contents of this string is available as the DataString property. It also introduces some methods to read or write parts of the stringstream's data as a string.

The main purpose of a TStringSTream is to be able to treat a string as a stream from which can be read.

Sets the size of the stream. SetSize sets the size of the stream to newsize. It does this by setting the size of the ansisting in which the stream is stored. NewSize can have any value greater than or equal to zero. In case there is not enough memory, an exception may be raised. Creates a new stringstream and sets its initial content. Create creates a new TStringStream instance and sets its initial content to Astring. The position is still 0 but the size of the stream will equal the length of the string. Reads from the stream. Read overrides the Read from . It tries to read Count bytes into Buffer. It returns the number of bytes actually read. The position of the stream is advanced with the number of bytes actually read; When the reading has reached the end of the DataString, then the reading stops, i.e. it is not possible to read beyond the end of the datastring. Reads a string of length Count

ReadString reads Count bytes from the stream and returns the read bytes as a string. If less than Count bytes were available, the string has as many characters as bytes could be read.

The ReadString method is a wrapper around the Read method. It does not do the same stringas the method, which first reads a length integer to determine the length of the string to be read.

Sets the position in the stream. Seek implements the abstract Seek method. Write overries the method. WriteString writes a string to the stream. Contains the contents of the stream in string form Stream that reads its data from a resource object. Initializes the resource stream. Creates a new instance of a resource stream. Creates a new instance of a resource stream with a resource The resource is loaded from the loaded module (identified by the handle Instance), identifier ResID and type ResType. Destroys the instance of the resource stream. Enumerated type used to identify the kind of streamed property Empty value. Ends a list. Identifies the start of a list of values Integer value, 8 bits long. Integer value, 16 bits long. Integer value, 32 bits long. Extended value. String value. Identifier. Boolean False value. Boolean True value. Binary data follows. Set data follows. Ansistring data follows. Nil pointer. Collection follows Single type follows. Currency value follows Date value follows Widestring value follows. Integer value, 64 bits long. Flags used by the class The TFiler class uses this enumeration type to decide whether the streamed object was streamed as part of an inherited form or not. Stored object is an inherited object. The position of the child on it's parent is included. Used for frames. Set of Reader procedure used by DefineProperties The TReaderProc reader procedure is a callback procedure which will be used by a descendent to read user properties from a stream during the streaming process. The Reader argument is the writer object which can be used read properties from the stream. Writer procedure used by DefineProperties The TWriterProc writer procedure is a callback procedure which will be used by a descendent to write user properties from a stream during the streaming process. The Writer argument is the writer object which can be used write properties to the stream. Procedure type used in streaming. Class responsible for streaming of components. Sets the root component which is being streamed. Sets the root component. The root component is the initial component which is being streamed. The root component is the initial component which is being streamed. The streaming process will stream a component and all the components which it owns. The Root component is the component which is initially streamed. LookupRoot Component used to look up ancestor components. When comparing inherited component's values against parent values, the values are compared with the component in LookupRoot. Initially, it is set to Root. Root Ancestor component from which an inherited component is streamed. When streaming a component, this is the parent component. Only properties that differ from the parent's property value will be streamed. Root LookupRoot Determines whether children will be streamed as well. By default, all children (i.e. owned objects) will also be streamed when streaming a component. This property can be used to prevent owned objects from being streamed. Class of TComponent The TComponentClass type is used when constructing descendent instances and when registering components. Abstract driver class to read stored component data.

The Free Pascal streaming mechanism, while compatible with Delphi's mechanism, differs from it in the sense that the streaming mechanism uses a driver class when streaming components. The TAbstractObjectReader class is the base driver class for reading property values from streams. It consists entirely of abstract methods, which must be implemented by descendent classes.

Different streaming mechanisms can be implemented by making a descendent from TAbstractObjectReader. The class is such a descendent class, which streams data in binary (Delphi compatible) format.

All methods described in this class, mustbe implemented by descendent classes.

Returns the type of the next value in the stream.

This function should return the type of the next value in the stream, but should not read the actual value, i.e. the stream position should not be altered by this method. This is used to 'peek' in the stream what value is next.

Reads the type of the next value. This function returns the type of the next value in the stream and reads it. i.e. after the call to this method, the stream is positioned to read the value of the type returned by this function. Starts the reading of the root component. This function can be used to initialize the driver class for reading a component. It is called once at the beginning of the read process, and is immediatly followed by a call to BeginComponent. Marks the reading of a new component.

This method is called when the streaming process wants to start reading a new component.

Descendent classes should override this method to read the start of a component new component definition and return the needed arguments. Flags should be filled with any flags that were found at the component definition, as well as AChildPos. The CompClassName should be filled with the class name of the streamed component, and the CompName argument should be filled with the name of the component.

AChildPos is used to change the ordering in which components appear below their parent component when streaming descendent forms.

Marks the reading of a property value. BeginProperty is called by the streaming system when it wants to read a new property. The return value of the function is the name of the property which can be read from the stream. Read binary data from the stream. ReadBinary is called when binary data should be read from the stream (i.e. after ReadValue returned a valuetype of vaBinary). The data should be stored in the DestData memory stream by descendent classes. Read a float value from the stream. ReadFloat is called by the streaming system when it wants to read a float from the stream (i.e. after ReadValue returned a valuetype of vaExtended). The return value should be the value of the float. Read a single (real-type) value from the stream. ReadSingle is called by the streaming system when it wants to read a single-type float from the stream (i.e. after ReadValue returned a valuetype of vaSingle). The return value should be the value of the float. Read a date value from the stream. ReadDate is called by the streaming system when it wants to read a date/time value from the stream (i.e. after ReadValue returned a valuetype of vaDate). The return value should be the date/time value. (This value can be stored as a float, since TDateTime is nothing but a float.) Read an identifier from the stream.

ReadIdent is called by the streaming system if it expects to read an identifier of type ValueType from the stream after a call to ReadValue returned vaIdent. The identifier should be returned as a string. Note that in some cases the identifier does not actually have to be in the stream. The following table indicates which identifiers must actually be read:

ValueTypeExpected value
vaIdentRead from stream.
vaNil'Nil'. This does not have to be read from the stream.
vaFalse'False'. This does not have to be read from the stream.
vaTrue'True'. This does not have to be read from the stream.
vaNull'Null'. This does not have to be read from the stream.
Read an 8-bit integer from the stream. ReadInt8 is called by the streaming process if it expects to read an integer value with a size of 8 bits (1 byte) from the stream (i.e. after ReadValue returned a valuetype of vaInt8). The return value is the value if the integer. Note that the size of the value in the stream does not actually have to be 1 byte. Read a 16-bit integer from the stream. ReadInt16 is called by the streaming process if it expects to read an integer value with a size of 16 bits (2 bytes) from the stream (i.e. after ReadValue returned a valuetype of vaInt16). The return value is the value if the integer. Note that the size of the value in the stream does not actually have to be 2 bytes. Read a 32-bit integer from the stream. ReadInt32 is called by the streaming process if it expects to read an integer value with a size of 32 bits (4 bytes) from the stream (i.e. after ReadValue returned a valuetype of vaInt32). The return value is the value of the integer. Note that the size of the value in the stream does not actually have to be 4 bytes. Read a 64-bit integer from the stream. ReadInt64 is called by the streaming process if it expects to read an int64 value with a size of 64 bits (8 bytes) from the stream (i.e. after ReadValue returned a valuetype of vaInt64). The return value is the value if the integer. Note that the size of the value in the stream does not actually have to be 8 bytes. Reads a set from the stream.

This method is called by the streaming system if it expects to read a set from the stream (i.e. after ReadValue returned a valuetype of vaSet). The return value is the contents of the set, encoded in a bitmask the following way:

For each (enumerated) value in the set, the bit corresponding to the ordinal value of the enumerated value should be set. i.e. as 1 shl ord(value).

Read a shortstring from the stream ReadStr is called by the streaming system if it expects to read a string from the stream (i.e. after ReadValue returned a valuetype of vaLString,vaWstring or vaString). The return value is the string. Read a string of type StringType from the stream. ReadStr is called by the streaming system if it expects to read a string from the stream (i.e. after ReadValue returned a valuetype of vaLString,vaWstring or vaString). The return value is the string. Skip till the end of the component. This method is used to skip the entire declaration of a component in the stream. Each descendent of TAbstractObjectReader should implement this in a way which is optimal for the implemented stream format. Skip the current value. SkipValue should be used when skipping a value in the stream; The method should determine the type of the value which should be skipped by itself, if this is necessary. Driver class descendent which reads component data stored in binary format.

The TBinaryObjectReader class reads component data stored in binary form in a file. For this, it overrides or implements all abstract methods from . No new functionality is added by this class, it is a driver class for the streaming system.

It should never be necessary to create an instance of this class directly. Instead, the call should be used.

Creates a new binary data reader instance. Create instantiates a new binary component data reader. The Stream stream is the stream from which data will be read. The BufSize argument is the size of the internal buffer that will be used by the reader. This can be used to optimize the reading process. Destroys the binary data reader. Destroy frees the buffer allocated when the instance was created. It also positions the stream on the last used position in the stream (the buffering may cause the reader to read more bytes than were actually used.) Occurs when the streaming process needs to locate a method If a instance needs to locate a method and it doesn't find it in the streamed form, then the OnFindMethod event handler will be called, if one is installed. This event can be assigned in order to use different locating methods. If a method is found, then its address should be returned in Address. The Error should be set to True if the reader should raise an exception after the event was handled. If it is set to False no exception will be raised, even if no method was found. On entry, Error will be set to True. Occurs when the reader needs to set a component's name. Occurs when a named object needs to be looked up. This event occurs when an ancestor component cannot be found. Callback type when reading a component from a stream Event handler type, called when an error occurs during the streaming. Event handler type, occurs when a component class pointer must be found when reading a component from a stream. Event handler type, occurs when a component instance must be created when a component is read from a stream. Generic reader object which reads component data from any given source.

The TReader class is a reader class that implements generic component streaming capabilities, independent of the format of the data in the stream. It uses a driver class to do the actual reading of data. The interface of the TReader class should be identical to the interface in Delphi.

Note that the TReader design is such that it can read a single component from a stream. It will read all children of this component, but it is not designed to read multiple components in succession from one stream.

It should never be necessary to create an instance of this class directly. Instead, the call should be used.

Calls an installed error handler and passes it Message

Error returns False if no handler is installed. If one is installed, then it will be called, passing the reader instance, message, and function return value as parameters.

If the function result False, i.e. when there is no handler installed or the handler restured False, then the calling code will raise an exception.

Return the address of a published method.

FindMethod will search for the method in ARoot. If it isn't found there, then it will call a OnFindMethod handler, if one is installed, passing it the method name AMethodName, the result pointer and a variable which says whether an exception should be raised if no method with name AMethodName is found.

If the method cannot be found and the OnFindMethod returns True, then an exception will be raised.

Read and process a property name Reads a property value for PropInfo. Skips a property value and raises an exception. Reads the components data after it has been created. Name of the property being read at this moment. Indicates whether the reader is handling exceptions at this stage. Creates a new reader class Destroys a reader class. Initializes the component referencing mechanism. When streaming components, the streaming mechanism keeps a list of existing components that can be referenced to. This method initializes up that system. Raises an exception if the next value in the stream is not of type Value Reads a user-defined property from the stream. Reads a user-defined binary property from the stream. Returns true if the stream contains an end-of-list marker. Finalizes the component referencing mechanism. When streaming components, the streaming mechanism keeps a list of existing components that can be referenced to. This method cleans up that system. Tries to resolve all unresolved component references. Returns the type of the next value. Reads a boolean from the stream. Reads a character from the stream. Reads a collection from the stream. Starts reading a component from the stream. Starts reading child components from the stream. Reads a float from the stream. Reads a single-type real from the stream. Reads a date from the stream Reads an identifier from the stream. Reads an integer from the stream Reads a 64-bit integer from the stream. Checks for the beginning of a list. Checks for the end of a list. Starts reading a root component. Reads a string from the stream. Reads the next value type from the stream. Copy a value to a writer. CopyValue reads the next value from the reader stream, and writes it to the passed Writer. Owner of the component being read Parent of the component being read. The driver in use for streaming the data. Handler called when an error occurs. Handler to find or change a method address. Handler called when setting a component name. Handler called when another component is referenced. Handler called when the ancestor component cannot be found. Handler called when a component needs to be created. Handler called when a component class reference needs to be found. Abstract driver class for writing component data. Start writing a collection. Start writing a component Start writing a list. Mark the end of a list. Start writing a property Marks the end of writing of a property. Writes binary data to the stream. Writes a boolean value to the stream. Writes a float value to the stream. Writes a single-type real value to the stream. Writes a date type to the stream. Writes an identifier to the stream. Writes an integer value to the stream Writes a methodname to the stream. Writes a set value to the stream. Writes a string value to the stream. Driver class which stores component data in binary form. Creates a new instance of a binary object writer. Destroys an instance of the binary object writer. Start writing a collection. Start writing a component Start writing a list. Mark the end of a list. Start writing a property Marks the end of writing of a property. Writes binary data to the stream. Writes a boolean value to the stream. Writes a float value to the stream. Writes a single-type real value to the stream. Writes a date type to the stream. Writes an identifier to the stream. Writes an integer value to the stream. Writes a methodname to the stream. Writes a set value to the stream. Writes a string value to the stream. Driver class which stores component data in text format. Not yet implemented. Event that occurs w Object to write component data to an arbitrary format.

The TWriter class is a writer class that implements generic component streaming capabilities, independent of the format of the data in the stream. It uses a driver class to do the actual reading of data. The interface of the TWriter class should be identical to the interface in Delphi.

Note that the TWriter design is such that it will write a single component to a stream. It will write all children of this component, but it is not designed to write multiple components in succession to one stream.

It should never be necessary to create an instance of this class directly. Instead, the call should be used.

Sets the root component Writes binary data to the stream. Writes one property to the stream. Writes the published properties to the stream. Creates a new Writer instance with a driver. Creates a new Writer with a stream and bufsize. Destroys the writer instance. Callback used when defining and streaming custom properties. Callback used when defining and streaming custom properties. Write boolean value to the stream. Write a collection to the stream. Stream a component to the stream. Write a character to the stream. Write a descendent component to the stream. Write a float to the stream. Write a single-type real to the stream. Write a date to the stream. Write an identifier to the stream. Write an integer to the stream. Write a start-of-list marker to the stream. Write an end-of-list marker to the stream. Write a root component to the stream. Write a string to the stream. Ancestor of root component. Event occurring when an ancestor component must be found. Driver used when writing to the stream. Class to parse the contents of a stream containing text data.

This class breaks a stream of text data in tokens. Its primary use is to help reading the contents of a form file (usually a file with dfm, xfm or lfm extension), and for this reason it isn't suitable to be used as a general parser.

The parser is always positioned on a certain token, whose type is stored in the Token property. Various methods are provided to obtain the token value in the desired format.

To advance to the next token, invoke NextToken method.

Creates a new parser instance.

Create creates a new TParser instance, using Stream as the stream to read data from, and reads the first token from the stream.

If an error occours while parsing the first token, an exception is raised.

Destroys the parser instance. None. Checks whether the token if of the given type.

If current token isn't of type T, an exception is raised.

Checks whether the token equals the given symbol

CheckTokenSymbol performs a case-insensitive comparison of current token value with S.

Current token must be of type , otherwise an exception is raised.

If the comparison fails, or current token isn't a symbol, an exception is raised.

Raises an exception with the given message Raises an exception and formats the message. Raises an exception with the given message Writes hexadecimal data to a stream.

HexToBinary reads a sequence of hexadecimal characters from the input stream and converts them to a sequence of bytes which is written to Stream. Each byte is represented by two contiguous hexadecimal characters.

Whitespace is allowed between hexadecimal characters if it doesn't appear between two characters that form the same byte.

HexToBinary stops when the first non-hexadecimal and non-whitespace character is found, or the end of the input stream is reached.

This method begins reading after the current token: that is, current token, even if it's a valid hexadecimal value, isn't included.

If a single hexadecimal character is found, an exception is raised.

Reads the next token and returns its type.

NextToken parses the next token in the stream and returns its type. The type of the token can also be retrieved later reading Token property.

If the end of the stream is reached, is returned.

For details about token types, see

If an error occours while parsing the token, an exception is raised.

Returns the current position in the stream. This is not the character position relative to the current source line, but the byte offset from the beginning of the stream. None. Returns the path of a subcomponent starting from the current token.

If current token is , TokenComponentIdent tries to find subcomponent names separated by a dot (.). The returned string is the longest subcomponent path found. If there are no subcomponents, current symbol is returned.

After this method has been called, subsequent calls to TokenString or TokenWideString return the same value returned by TokenComponentIdent.

Example

If source stream contains a.b.c and TParser is positioned on the first token (a), this method returns a.b.c.

If Token isn't , or no valid symbol is found after a dot, an exception is raised.

Returns the current token as a float.

If current token type is , this method returns the token value as a float.

To specify a negative number, no space must exist between unary minus and number.

Floating point numbers can be postfixed with a character that specifies the floating point type. See FloatType for further information.

In the input stream the decimal separator, if present, must be a dot (.).

If Token isn't , an exception is raised.

Returns the current token as an integer.

If current token type is , this method returns the token value as an integer.

In the input stream an integer can be an hexadecimal (prefixed by '$' character) or decimal number. Decimal numbers can be prefixed by an unary minus: if this is the case, no space must exist between minus and number.

If Token isn't , an EConvertError exception is raised.

Returns the current token as a string.

If current token type is or , this method returns the contents of the string. That is, enclosing quotes are removed, embedded quotes are unescaped and control strings are converted to the appropriate sequence of characters.

If current token type isn't a string, a string containing the token representation in the input stream is returned, without any conversion: hexadecimal integers are returned with the leading $, and floating point suffixes like s, c or d are kept. For tokens whose type isn't a special type, return value of TokenString equals Token.

If Token is , TokenWideString should be used instead.

None.
Returns the current token as a widestring

If current token type is , this method returns the contents of the string. That is, enclosing quotes are removed, embedded quotes are unescaped and control strings are converted to the appropriate sequence of characters.

If current token isn't a widestring, TokenWideString behaviour is the same as TokenString.

None. TokenString
Returns True if the token equals the given symbol.

TokenSymbolIs performs a case-insensitive comparison of current token value with S.

If current token isn't of type , or comparison fails, False is returned.

None.
The type of a float token.

Floating point numbers can be postfixed with a character specifying the type of floating point value. When specified, this property holds the character postfixed to the number.

It can be one of the following values:

s or SValue is a single.
c or CValue is a currency.
d or DValue is a date.

If Token isn't or one of the above characters wasn't specified, FloatType is the null character (zero).

Current source line number. The type of the current token.

This property holds the type of the current token. When Token isn't one of the special token types (whose value can be retrieved with specific methods) it is the character representing the current token.

Special token types:

To advance to the next token, use NextToken method.

Thread error exception. Procedure variable used when synchronizing threads. Enumeration specifying the priority at which a thread runs. Thread only runs when other processes are idle. Thread runs at the lowest priority. Thread runs at a lower priority. Thread runs at normal process priority. Thread runs at high priority Thread runs at highest possible priority. Thread runs at realtime priority. Abstract Thread class. The TThread class encapsulates the native thread support of the operating system. To create a thread, declare a descendent of the TThread object and override the Execute method. In this method, the tthread's code should be executed. To run a thread, create an instance of the tthread descendent, and call it's execute method. Terminates the thread. Execute method. Must be overridden in a descendent thread. Execute is a method that must be overridden in descendent classes of the thread. It must contain the code that must execute in the thread. The Execute method is responsible for checking at regular intervals: when it is set to True the execute method must exit. Synchronizes the thread by executing the method in the main thread. Return value of the thread when it stops executing. Indicates whether the Terminatemethod was called by the user. Creates a new thread. Destroys the thread object. Resumes the thread's execution. Deprecated, see TThread.Start Starts a thread thread that was created in a suspended state. The effect of this method is currently the same as calling TThread.Resume after creating a thread in a suspended state. This method was added for Delphi-compatibility, where it was introduced after TThread.Suspend and TThread.Resume were deprecated. Suspends the thread's execution. On non-Windows platforms, a thread can only suspend itself. Other threads can wake up a suspended thread by calling TThread.Resume. Deprecated, see TThread.Start. Signals the thread it should terminate. Waits for the thread to terminate and returns the exit status. Indicates whether the thread should free itself when it stops executing. Returns the thread handle. Returns the thread priority. Indicates whether the thread is suspended. Returns the thread ID. Event called when the thread terminates. Operation of which a component is notified. A new component is being inserted in the child component list. A component is being removed from the child component list. Indicates the state of the component during the streaming process. The component is being loaded from the stream. Properties are being read from the stream. Properties are being written to the stream. The component is being destroyed. The component is being designed in an IDE. The component is being streamed as part of a frame (?) The component is being updated. The component's references to other components are being fixed. Indicates whether the component has freenotifications Component is part of a frame (?). ?? Describes the style of the component. The component can be on inherited forms. ?? Callback used when obtaining child components. Base class for all components that need owner-owned functionality.

TComponent is the base class for any set of classes that needs owner-owned functionality, and which needs support for property streaming. All classes that should be handled by an IDE (Integrated Development Environment) must descend from TComponent, as it includes all support for streaming all its published properties.

Components can 'own' other components. TComponent introduces methods for enumerating the child components. It also allows to name the owned components with a unique name. Furthermore, functionality for sending notifications when a component is removed from the list or removed from memory alltogether is also introduced in TComponent

TComponent introduces a form of automatic memory management: When a component is destroyed, all its child components will be destroyed first.

Contains the component's style. FComponentStyle is the location where the ComponentStyle property is read from. ComponentStyle Actually sets the component name.

ChangeName is called by the SetName procedure when the component name is set and the name has been verified. It actually sets the name of the component to NewName, and can be used to bypass the name checks which are done when the Name property is set.

Application programmers should never use SetName directly.

SetName Name
Defines fake top,left properties for handling in the IDE. DefineProperties overrides the standard to store the top/left properties used to display an icon for a non-visual component in an IDE. Must be overridden by descendents to return all child components that must be streamed.

GetChildren is called by the streaming system to determine which child components should be streamed as well when the component is being streamed. By default, no child components are streamed, i.e. the TComponent implementation is empty.

TComponent descendents should override this method. For each child that needs to be streamed, Proc should be called with as an argument the child component that must be streamed. The Root argument contains the root component relative to which all streaming is done.

Returns the owner of any children.

GetChildOwner returns the owner of the children that are read from the stream. If the method returns Nil (the default) this means that streamed child components are owned by the root component of the streaming process (usually a Form or Datamodule)

Application programmers should not call GetChildOwner directly, it is called by the streaming system when needed.

Returns the parent of any children.

GetChildParent returns the parent component of the child components being streamed. The parent property is a visual property, which is not always meaningful. If there is no parent component, the owner of child components that are streamed is returned. If Nil is returned, then the root component of the streaming operation is assumed. The TComponent implementation of this method returns Self.

Application programmers should not call this method, it is called automatically by the streaming mechanism.

Returns the name path of this component.

GetNamePath returns the name of the component as it will be shown in the object inspector.

TComponent overrides GetNamePath so it returns the Name property of the component.

Name
Returns the owner of this component. GetOwner returns the owner of this component as indicated by the Owner property. The GetOwner call is introduced in and is used by the streaming system to determine the 'owner' of a component. Called when the component has finished loading.

Loaded is called by the streaming system when a root component was completely read from a stream and all properties and references to other objects have been resolved by the streaming system. Descendents of TComponent should override this method to do some additional processing of properties after all published properties have been set from values obtained from the stream.

Application programmers should never call Loaded directly, this is done automatically by the streaming system.

Called by components that are freed and which received a FreeNotification.

Notification is called whenever a child component is destroyed, inserted or removed from the list of owned component. Components that were requested to send a notification when they are freed ((with FreeNotification) will also call Notification when they are freed.

The AComponent parameter specifies which component sends the notification, and Operation specifies whether the component is being inserted into or removed from the child component list, or whether it is being destroyed.

Descendents of TComponent can use FreeNotification to request notification of the destruction of another object. By overriding the Notification method, they can do special processing (typically, set a reference to this component to Nil) when this component is destroyed. The Notification method is called quite often in the streaming process, so speed should be a consideration when overriding this method.

Read the component's state from a stream.

ReadState reads the component's state from a stream through the reader object reader. Values for all published properties of the component can be read from the stream. Normally there is no need to call ReadState directly. The streaming system calls ReadState itself.

The implementation of ReadState simply calls Descendent classes can, however, override ReadStateto provide additional processing of stream data.

WriteState
Sets the csAncestor state of the component.

SetAncestor includes or excludes the csAncestor flag in the ComponentState set property, depending on the boolean Value. The flag is set recursively for all owned components as well.

This is normally only done during the streaming system, and should not be called directly by an application programmer.

ComponentState
Sets the csDesigning state of the component.

SetDesigning includes or excludes the csDesigning flag in the ComponentState set property, depending on the boolean Value. The flag is set recursively for all owned components as well.

This is normally only done during the streaming system, and should not be called directly by an application programmer.

Write handler for Name property. SetName is the write handler for the Name property. It checks whether the desired name is valid (i.e is a valid identifier) and is unique among the children of the owner component. If either conditions is not satisfied, an exception is raised. Name ValidateRename Determines the order in which children are streamed/created. This method does nothing. It can be used to change the order in which child components are streamed and created. This can be used by descendent classes to optimize or correct the order in which child components are streamed. Set the parent component. SetParentComponent does nothing, but is called by the streaming system to set the parent component of the current component. This method can be overridden by descendent components to set the parent component of the current component. Owner Sets the state to csUpdating

Updating includes csUpdating in the ComponentState property of the component.

Normally, an application programmer should not call this method directly, it is called automatically by the streaming system.

Updated ComponentState
Ends the csUpdating state.

Updated excludes csUpdating from the ComponentState property of the component.

Normally, an application programmer should not call this method directly, it is called automatically by the streaming system.

Updating ComponentState
For compatibilty only. This method does nothing, and is provided for compatibility only. Called when a name change must be validated ValidateRename checks whether NewName is a valid replacement for CurName for component AComponent. Two owned components of a component can not have the same name. If a child component with the same name is found, then an exception is raised. SetName Name ?? ValidateContainer is provided for compatibility only. It doesn't do anything in Free Pascal. Called when an insert must be validated.

ValidateInsert should be implemented by descendent components to see whether the AComponent component may be inserted in the list of owned components.

This procedure does nothing in the TComponent implementation, it should be overridden by descendant components.

Insert
Writes the component to a stream.

WriteState writes the component's current state to a stream through the writer object writer. Values for all published properties of the component can be written to the stream. Normally there is no need to call WriteState directly. The streaming system calls WriteState itself.

The implementation of WriteState simply calls . Descendent classes can, however, override WriteStateto provide additional processing of stream data.

ReadState
Creates a new instance of the component. Create creates a new instance of a TComponent class. If AOwner is not Nil, the new component attempts to insert itself in the list of owned components of the owner. Insert Owner Sets the csSubComponent style. SetSubComponent includes csSubComponent in the ComponentStyle property if ASubComponent is True, and excludes it again if ASubComponent is False. Destroys the instance of the component. Destroy sends a opRemove notification to all components in the free-notification list. After that, all owned components are destroyed by calling DestroyComponents (and hence removed from the list of owned components). When this is done, the component removes itself from its owner's child component list. After that, the parent's destroy method is called. Notification Owner DestroyComponents Components Destroy child components.

DestroyComponents calls the destructor of all owned components, till no more components are left in the Components array.

Calling the destructor of an owned component has as the effect that the component will remove itself from the list of owned components, if nothing has disrupted the sequence of destructors.

If an overridden 'destroy' method does not call it's intherited destructor or raises an exception, it's destructor will not be called, which may result in an endless loop. Destroy Components
Called when the component is being destroyed

Destroying sets the csDestroying flag in the component's state property, and does the same for all owned components.

It is not necessary to call Destroying directly, the destructor Destroy does this automatically.

State Destroy
Finds and returns the named component in the owned components. FindComponent searches the component with name AName in the list of owned components. If AName is empty, then Nil is returned. Components Name Ask the component to notify called when it is being destroyed. FreeNotification inserts AComponent in the freenotification list. When the component is destroyed, the Notification method is called for all components in the freenotification list. Components Notification Part of the IVCLComObject interface. Provided for Delphi compatibility, but is not yet implemented. Returns the parent component. GetParentComponent can be implemented to return the parent component of this component. The implementation of this method in TComponent always returns Nil. Descendent classes must override this method to return the visual parent of the component. HasParent Owner Does the component have a parent ? HasParent can be implemented to return whether the parent of the component exists. The implementation of this method in TComponent always returns False, and should be overridden by descendent classes to return True when a parent is available. If HasParent returns True, then GetParentComponent will return the parent component. HasParent Owner Insert the given component in the list of owned components. InsertComponent attempts to insert AComponent in the list with owned components. It first calls ValidateComponent to see whether the component can be inserted. It then checks whether there are no name conflicts by calling ValidateRename. If neither of these checks have raised an exception the component is inserted, and notified of the insert. RemoveComponent Insert ValidateContainer ValidateRename Notification Remove the given component from the list of owned components. RemoveComponent will send an opRemove notification to AComponent and will then proceed to remove AComponent from the list of owned components. InsertComponent Remove ValidateRename Notification Part of the IVCLComObject Interface. Provided for Delphi compatibility, but not implemented. Indexed list (zero-based) of all owned components. Components provides indexed access to the list of owned components. Index can range from 0 to ComponentCount-1. ComponentCount Owner Count of owned components ComponentCount returns the number of components that the current component owns. It can be used to determine the valid index range in the Component array. Components Owner Index of component in it's owner's list. ComponentIndex is the index of the current component in its owner's list of components. If the component has no owner, the value of this property is -1. Components ComponentCount Owner Current component's state.

ComponentState indicates the current state of the component. It is a set of flags which indicate the various stages in the lifetime of a component. The following values can occur in this set:

Component states
FlagMeaning
csLoadingThe component is being loaded from stream
csReadingComponent properties are being read from stream.
csWritingComponent properties are weing written to stream.
csDestroyingThe component or one of it's owners is being destoyed.
csAncestorThe component is being streamed as part of a frame
csUpdatingThe component is being updated
csFixupsReferences to other components are being resolved
csFreeNotificationThe component has freenotifications.
csInlineThe component is being loaded as part of a frame
csDesignInstance? not used.

The component state is set by various actions such as reading it from stream, destroying it etc.

SetAncestor SetDesigning SetInline SetDesignInstance Updating Updated Loaded
Current component's style. Information for IDE designer. DesignInformation can be used by an IDE to store design information in the component. It should not be used by an application programmer. Tag Owner of this component. Owner returns the owner of this component. The owner cannot be set except by explicitly inserting the component in another component's owned components list using that component's InsertComponent method, or by removing the component from it's owner's owned component list using the RemoveComponent method. Components InsertComponent RemoveComponent Not implemented. VCLComObject is not yet implemented in Free Pascal. Name of the component.

Name is the name of the component. This name should be a valid identifier, i.e. must start with a letter or underscore, and can contain only letters, numbers and the underscore character. When attempting to set the name of a component, the name will be checked for validity. Furthermore, when a component is owned by another component, the name must be either empty or must be unique among the child component names.

By "letters", 7-bit letters are meant.

Attempting to set the name to an invalid value will result in an exception being raised. ValidateRename Owner
Tag value of the component. Tag can be used to store an integer value in the component. This value is streamed together with all other published properties. It can be used for instance to quickly identify a component in an event handler. Name Abstract base class for all Actions.

TBasicAction implements a basic action class from which all actions are derived. It introduces all basic methods of an action, and implements functionality to maintain a list of clients, i.e. components that are connected with this action.

Do not create instances of TBasicAction. Instead, create a descendent class and create an instance of this class instead.

List with components linked to this action. FClients is a list of classes which represent links to various components that are connected to this action. The elements in this list should not be manipulated directly, but should be managed with the RegisterChanges and UnRegisterChanges methods. RegisterChanges UnRegisterChanges Calls the OnChange handler.

Change calls the OnChange handler if one is assigned.

Application programmers should not call Change directly. It is called automatically if a property of an action component changes.

Descendent classes of TBasicAction should call explicitly call Change if one of their properties that affect client controls changes its value.

Assigns an OnExecute event handler SetOnExecute sets the OnExecute handler of the component. It also propagates this event to all client controls, and finally triggers the OnChange event. OnExecute OnChange Occurs when one of the action's properties changes.

OnChange is the event that is triggered when one of the action's properties changes. This event should be used by client controls or descendent classes to respond to these changes in the properties of the action.

Application programmers should never use the OnChange event directly.

Creates a new instance of a class.

Create calls the inherited constructor, and then initializes the list of clients controls (or action lists).

Under normal circumstances it should not be necessary to create a TBasicAction descendent manually, actions are created in an IDE.

Destroy AssignClient
Destroys the action.

Destroy cleans up the list of client controls and then calls the inherited destructor.

An application programmer should not call Destroy directly; Instead Free should be called, if it needs to be called at all. Normally the controlling class (e.g. a TActionList) will destroy the action.

Determines whether Target can be handled by this action

HandlesTarget returns True if Target is a valid client for this action and if so, if it is in a suitable state to execute the action. An application programmer should never need to call HandlesTarget directly, it will be called by the action itself when needed.

In TBasicAction this method is empty; descendent classes should override this method to implement appropriate checks.

UpdateTarget ExecuteTarget
Notify client controls when the action updates itself.

UpdateTarget should update the client control specified by Target when the action updates itself. In TBasicAction, the implementation of UpdateTarget is empty. Descendent classes should override and implement UpdateTarget to actually update the Target object.

An application programmer should never need to call HandlesTarget directly, it will be called by the action itself when needed.

HandlesTarget ExecuteTarget
Executes the action on the Target object

ExecuteTarget performs the action on the Target object. In TBasicAction this method does nothing. Descendent classes should implement the action to be performed. For instance an action to post data in a dataset could call the Post method of the dataset.

An application programmer should never call ExecuteTarget directly.

HandlesTarget UpdateTarget Execute
Triggers the OnExecute event Execute triggers the OnExecute event, if one is assigned. It returns True if the event handler was called, False otherwise. Registers a new client with the action. RegisterChanges adds Value to the list of clients. UnregisterChanges Unregisters a client from the list of clients UnregisterChanges removes Value from the list of clients. This is called for instance when the action is destroyed, or when the client is assigned a new action. UnregisterChanges Destroy Triggers the OnUpdate event

Update triggers the OnUpdate event, if one is assigned. It returns True if the event was triggered, or False if no event was assigned.

Application programmers should never run Update directly. The Update method is called automatically by the action mechanism; Normally this is in the Idle time of an application. An application programmer should assign the OnUpdate event, and perform any checks in that handler.

OnUpdate Execute UpdateTarget
Returns the component that initiated the action. ActionComponent is set to the component that caused the action to execute, e.g. a toolbutton or a menu item. The property is set just before the action executes, and is reset to nil after the action was executed. Execute OnExecute Event triggered when the action executes.

OnExecute is the event triggered when the action is activated (executed). The event is triggered e.g. when the user clicks e.g. on a menu item or a button associated to the action. The application programmer should provide a OnExecute event handler to execute whatever code is necessary when the button is pressed or the menu item is chosen.

Note that assigning an OnExecute handler will result in the Execute method returning a True value. Predefined actions (such as dataset actions) will check the result of Execute and will not perform their normal task if the OnExecute handler was called.

Execute OnUpdate
Event trigged when the application is idle. OnUpdate is the event triggered when the application is idle, and the action is being updated. The OnUpdate event can be used to set the state of the action, for instance disable it if the action cannot be executed at this point in time. Update OnExecute Link between actions and action clients (e.g. controls)

TBasicActionLink links an Action to its clients. With each client for an action, a TBasicActionLink class is instantiated to handle the communication between the action and the client. It passes events between the action and its clients, and thus presents the action with a uniform interface to the clients.

An application programmer should never use a TBasicActionLink instance directly; They are created automatically when an action is associated with a component. Component programmers should create specialized descendents of TBasicActionLink which communicate changes in the action to the component.

The action with which this link is associated FAction contains a reference to the action with which this link is associated. It should never be manipulated directly. It will be set automatically by the SetAction write method for the Action property. SetAction Action Assigns a control (client) to the action link. AssignClient assigns a control to the actionlink and hence to the action. Descendent classes can override AssignClient to check whether the new client is a suitable client for this action. Action Executed whenever the Action is changed.

Change is executed whenever the action changes. It executes the OnChange handler, if one is assigned.

Component programmers may decide to override the Change procedure in descendent classes to perform aditional actions when the properties of the action changes.

OnChange
Returns whether the client has it's OnExecute property linked. IsOnExecuteLinked always returns true in TBasicActionLink. Descendent classes can override this method to provide a different result. OnExecute Sets the action with which the actionlink is associated. SetAction is the write handler for the Action property. It sets the Action property to it's new value, after unregistering itself with the old action, if there was one. Action Assigns the OnExecute handler to the client SetOnExecute must be overridden by descendent classes to pass the OnExecute handler of the associated action to the client control. It will attach the OnExecute handler to whatever handler is appropriate for the client control. OnExecute Creates a new instance of the TBasicActionLink class

Create creates a new instance of a TBasicActionLink and assigns AClient as the client of the link.

Application programmers should never instantiate TBasicActionLink classes directly. An instance is created automatically when an action is assigned to a control (client).

Component programmers can override the create constructor to initialize further properties.

Destroy
Destroys the TBasicActionLink instance.

Destroy unregisters the TBasicActionLink with the action, and then calls the inherited destructor.

Application programmers should never call Destroy directly. If a link should be destroyed at all, the Free method should be called instead.

Create
Calls the action's Execute method.

Execute sets the ActionComponent property of the associated Action to AComponent and then calls the Action's execute method. After the action has executed, the ActionComponent property is cleared again.

The return value of the function is the return value of the Action's execute method.

Application programmers should never call Execute directly. This method will be called automatically when the associated control is activated. (e.g. a button is clicked on)

Component programmers should call Execute whenever the action should be activated.

Action
Calls the action's Update method

Update calls the associated Action's Update methoda.

Component programmers can override the Update method to provide additional processing when the Update method occurs.

The action to which the link was assigned. Action represents the Action which was assigned to the client. Setting this property will unregister the client at the old action (if one existed) and registers the client at the new action. Event handler triggered when the action's properties change

OnChange is the event triggered when the action's properties change.

Application programmers should never need to assign this event. Component programmers can assign this event to have a client control reflect any changes in an Action's properties.

Change
Used when registering ActveX component types. This type is provided for compatibility only, and is currently not used in Free Pascal. Callback procedure used when handling component registration. RegisterComponentsProc can be set by an IDE to be notified when new components are being registered. Application programmers should never have to set RegisterComponentsProc Callback procedure used when handling iconless component registration. RegisterNoIconProc can be set by an IDE to be notified when new components are being registered, and which do not need an Icon in the component palette. Application programmers should never have to set RegisterComponentsProc Returns a TPoint record with the given coordinates. Point returns a record with the given coordinates AX and AY filled in. Returns a TSmallPoint record with the given coordinates. SmallPoint returns a record with the given coordinates AX and AY filled in. Returns a TRect record with the given coordinates.

Rect returns a record with the given top-left (ALeft,ATop) and bottom-right (ABottom,ARight) corners filled in.

No checking is done to see whether the coordinates are valid.

Returns a TRect structure with the bounding rect of the given location and size. Bounds returns a record with the given origin (ALeft,ATop) and dimensions (AWidth,AHeight) filled in. The bottom-right corner is calculated by adding AWidth to ALeft and AHeight to ATop. As a result, a rectangle with width/height set to 0 is exactly 1 pixel. Registers a class with the streaming system. RegisterClass registers the class AClass in the streaming system. After the class has been registered, it can be read from a stream when a reference to this class is encountered. Registers multiple classes with the streaming system. RegisterClasses registers the specified classes AClass in the streaming system. After the classes have been registered, they can be read from a stream when a reference to this class is encountered. Registers a class alias with the streaming system. RegisterClassAlias registers a class alias in the streaming system. If a reference to a class Alias is encountered in a stream, then an instance of the class AClass will be created instead by the streaming code. Unregisters a class from the streaming system. UnregisterClass removes the class AClass from the class definitions in the streaming system. Unregisters multiple classes from the streaming system. UnregisterClasses removes the classes in AClasses from the class definitions in the streaming system. Unregisters classes registered by module. UnRegisterModuleClasses unregisters all classes which reside in the module Module. For each registered class, the definition pointer is checked to see whether it resides in the module, and if it does, the definition is removed. Returns the class pointer of a class with given name.

FindClass searches for the class named ClassName in the list of registered classes and returns a class pointer to the definition. If no class with the given name could be found, an exception is raised.

The function does not raise an exception when it does not find the class, but returns a Nil pointer instead.

Returns the class pointer of a class with given name.

GetClass searches for the class named ClassName in the list of registered classes and returns a class pointer to the definition. If no class with the given name could be found, Nil is returned.

The function will raise an exception if the does not find the class.

Registers components for the component palette.

RegisterComponents registers the component on the appropriate component page. The component pages can be used by an IDE to display the known components so an application programmer may pick and use the components in his programs.

Registercomponents inserts the component class in the correct component page. If the RegisterComponentsProc procedure is set, this is called as well. Note that this behaviour is different from Delphi's behaviour where an exception will be raised if the procedural variable is not set.

Registers components that have no icon on the component palette. RegisterNoIcon performs the same function as except that it calls instead of Register non-activex component. Not yet implemented in Free Pascal Record used when associating names with integer values. TIdentMapEntry is used internally by the and calls to store the mapping between the identifiers and the integers they represent. Integer value Name of the integer value. Callback for converting identifiers to integers.

TIdentToInt is a callback used to look up identifiers (Ident) and return an integer value corresponding to this identifier (Int). The callback should return True if a value corresponding to integer Ident was found, False if not.

A callback of type TIdentToInt should be specified when an integer is registered using the call.

Callback for converting integers to identifiers.

TIdentToInt is a callback used to look up integers (Ident) and return an identifier (Ident) that can be used to represent this integer value in an IDE. The callback should return True if a value corresponding to integer Ident was found, False if not.

A callback of type TIntToIdent should be specified when an integer is registered using the call.

Callback type to search for a component.

TFindGlobalComponent is a callback used to find a component in a global scope. It is used when the streaming system needs to find a component which is not part of the component which is currently being streamed. It should return the component with name Name, or Nil if none is found.

The variable is a callback of type TFindGlobalComponent. It can be set by the IDE when an unknown reference is found, to offer the designer to redirect the link to a new component.

ID of main thread. Unused at this point. Callback used when a component must be found.

FindGlobalComponent is a callback of type . It can be set by the IDE when an unknown reference is found, to offer the user to redirect the link to a new component.

It is a callback used to find a component in a global scope. It is used when the streaming system needs to find a component which is not part of the component which is currently being streamed. It should return the component with name Name, or Nil if none is found.

Registers some integer-to-identifier mappings.

RegisterIntegerConsts registers a pair of callbacks to be used when an integer of type IntegerType must be mapped to an identifier (using IntToIdentFn) or when an identifier must be mapper to an integer (using IdentToIntFn).

Component programmers can use RegisterIntegerConsts to associate a series of identifier strings with integer values for a property. A necessary condition is that the property should have a separate type declared using the type integer syntax. If a type of integer is defined in this way, an IDE can show symbolic names for the values of these properties.

The IntegerType should be a pointer to the type information of the integer type. The IntToIdentFn and IdentToIntFn are two callbacks that will be used when converting between the identifier and integer value and vice versa. The functions and can be used to implement these callback functions.

Looks up an integer value in a integer-to-identifier map list. IdentToInt searches Map for an entry whose Name field matches Ident and returns the corresponding integer value in Int. If a match was found, the function returns True, otherwise, False is returned. Looks up an identifier for an integer value in a identifier-to-integer map list. IdentToInt searches Map for an entry whose Value field matches Int and returns the corresponding identifier in Ident. If a match was found, the function returns True, otherwise, False is returned. Initializes a component descending from RootAncestor

InitInheritedComponent should be called from a constructor to read properties of the component Instance from the streaming system. The RootAncestor class is the root class from which Instance is a descendent. This must be one of TDatamodule, TCustomForm or TFrame.

The function returns True if the properties were successfully read from a stream or False if some error occurred.

Provided for Delphi compatibility only This function is provided for Delphi compatibility. It always returns false. Read component properties from a resource in the current module This function is provided for Delphi compatibility. It always returns Nil. Read component properties from a resource in the specified module This function is provided for Delphi compatibility. It always returns Nil. Read component properties from a specified resource file ReadComponentResFile starts reading properties for Instance from the file FileName. It creates a filestream from FileName and then calls the method to read the state of the component from the stream. Write component properties to a specified resource file WriteComponentResFile starts writing properties of Instance to the file FileName. It creates a filestream from FileName and then calls method to write the state of the component to the stream. Called to resolve unresolved references after forms are loaded. GlobalFixupReferences runs over the list of unresolved references and tries to resolve them. This routine should under normal circumstances not be called in an application programmer's code. It is called automatically by the streaming system after a component has been instantiated and its properties read from a stream. It will attempt to resolve references to other global components. Returns the names of elements that need to be resolved for the root component. GetFixupReferenceNames examines the list of unresolved references and returns the names of properties that must be resolved for the component Root in the list Names. The list is not cleared prior to filling it. Returns the names of elements that need to be resolved for the root component, whose reference contains ReferenceRootName GetFixupInstanceNames examines the list of unresolved references and returns the names of classes that contain unresolved references to the Root component in the list Names. The list is not cleared prior to filling it. Redirects references under the root object from OldRootName to NewRootName

RedirectFixupReferences examines the list of unresolved references and replaces references to a root object named OldRootName with references to root object NewRootName.

An application programmer should never need to call RedirectFixupReferences. This function can be used by an IDE to support redirection of broken component links.

Removes references to rootname from the fixup list.

RemoveFixupReferences examines the list of unresolved references and removes references to a root object pointing at Root or a root component named RootName.

An application programmer should never need to call RemoveFixupReferences. This function can be used by an IDE to support removal of broken component links.

Removes Instance from the fixup list. RemoveFixups removes all entries for component Instance from the list of unresolved references.a Finds the component with name path starting at the indicated root component. FindNestedComponent will descend through the list of owned components (starting at Root) and will return the component whose name path matches NamePath. As a path separator the characters . (dot), - (dash) and > (greater than) can be used Not yet implemented Not yet implemented. Not yet implemented. Returns True if two collections are equal. CollectionsEqual is not yet implemented. It simply returns False Converts an object stream from a binary to a text format. ObjectBinaryToText reads an object stream in binary format from Input and writes the object stream in text format to Output. No components are instantiated during the process, this is a pure conversion routine. Converts an object stream from a text to a binary format. Converts an object stream from a (windows) resource to a text format. ObjectResourceToText reads the resource header from the Input stream and then passes the streams to Converts an object stream from a text to a (windows) resource format.

ObjectTextToResource reads an object stream in text format from Input and writes a resource stream to Output.

Note that for the current implementation of this method in Free Pascal, the output stream should support positioning. (e.g. it should not be a pipe)

Finds the start of a line in Buffer before BufPos. LineStart reversely scans Buffer starting at BufPos for a linefeed character. It returns a pointer at the linefeed character. Type for an Array of pointers. Pointer to an array of pointers. Range type to specify help contexts. Enumeration type specifying the kind of help requested. Pointer to a . class reference. class reference. Kind of list notification event. Callback type for the list sort algorithm. Specifies the origin of the method. Offset is interpreted relative to the start of the stream. Offset is interpreted relative to the end of the stream. Offset is interpreted relative to the current position in the stream. Enumeration type to identify shortcut key combinations. Callback type used in stringlist compares. System routines System types RTTI information Resource strings with messages Keyboard/Mouse shift state enumerator Shift key pressed Alt key pressed Ctrl key pressed Left mouse button pressed. Right mouse button pressed. Middle mouse button pressed. Double mouse click. Meta key pressed. Super key pressed. Hyper key pressed. Alt-GR key pressed. Caps lock key pressed Num lock key pressed Scroll lock key pressed Triple mouse click Quadruple mouse click Extra key 1 5A Extra key 2 Help type: Keyword help Help type: Context ID help. List change notification: Element added to the list. List change notification: Element extracted from the list. List change notification: Element deleted from the list. Remove the first occurrence of a pointer from the list. Extract searched for an occurence of item, and if a match is found, the match is deleted from the list. If no match is found, nothing is deleted. If Item was found, the result is Item. If Item was not found, the result is Nil. A lnExtracted notification event is triggered if an element is extracted from the list. Copy the contents of other lists. Assign can be used to merge or assign lists It is an extended version of the usual TPersistent.Assign mechanism. The arguments ListA and ListB are used as sources of pointers to add or remove elements from the current list, depending on the operation AOperation. The available operations are documented in the type. Helper class for storing published properties

TRecall is a helper class used to copy published properties of a class (the reference object) in another class (the storage object). The reference object and storage object must be assignable to each other.

The TRecall can be used to store the state of a persistent class, and restore it at a later time.

When a TRecall object is created, it gets passed a reference instance and a storage instance. It immediatly stores the properties of the reference object in the storage object.

The Store method can be called throughout the lifetime of the reference object to update the stored properties.

When the TRecall instance is destroyed then the properties are copied from the storage object to the reference object. The storage object is freed automatically.

If the properties should not be copied back from the storage to the reference object, the Forget can be called.

Creates a new instance of TRecall. Create creates a new instance of TRecall and initializes the Reference and Storage instances. It calls Store to assign the reference object properties to the storage instance. Copies the stored properties to the reference object and destroys the TRecall instance. Destroy assigns the storage instance to the reference instance, if the latter is still valid. After this, it frees the storage and calls the inherited destroy. Destroy does not check whether the reference instance is still valid. If the reference pointer was invalidated, call to clear the reference instance. Assigns the reference instance to the storage instance.

Store assigns the reference instance to the storage instance. This will only work if the two classes can be assigned to each other.

This method can be used to refresh the storage.

Store does not check whether the reference instance is still valid. If the reference pointer was invalidated, call to clear the reference instance.
Clear the reference property.

Forget sets the Reference property to Nil. When the TRecall instance is destroyed, the reference instance will not be restored.

Note that after a call to Forget, a call to Store has no effect.

None.
The reference object. Reference is the instance of the reference object. Do not free the reference directly. Call Forget to clear the reference and then free the reference object. Collection change notifcation enumeration. TCollectionNotification is used in the class to send notifications about changes to the collection. An item is added to the collection. An item is extracted from the collection. An item is deleted from the collection. Owner of the collection. Owner returns a reference to the owner of the collection. This property is required by the object inspector to be able to show the collection. Delete an item from the collection. Delete deletes the item at (zero based) position Index from the collection. This will result in a cnDeleted notification. If an invalid index is specified, an EListError exception is raised. Insert an item in the collection.

Insert creates a new item instance and inserts it in the collection at position Index, and returns the new instance.

In contrast, adds a new item at the end.

None.
TCollection descendent which maintains owner information. TOwnedCollection automatically maintains owner information, so it can be displayed in an IDE. Collections that should be displayed in an IDE should descend from TOwnedCollection or must implement a GetOwner function. Create a new TOwnerCollection instance. Create creates a new instance of TOwnedCollection and stores the AOwner references. It will the value returned in the property of the collection. The ItemClass class reference is passed on to the inherited constructor, and will be used to create new instances in the Insert and Add methods. Stream which uses a second stream as a source TOwnerStream can be used when creating stream chains such as when using encryption and compression streams. It keeps a reference to the source stream and will automatically free the source stream when ready (if the SourceOwner property is set to True). Create a new instance of TOwnerStream. Create instantiates a new instance of TOwnerStream and stores the reference to AStream. If SourceOwner is True, the soure stream will also be freed when the instance is destroyed. Destroys the TOwnerStream instance and the source stream. Destroy frees the source stream if the SourceOwner property is True. Reference to the source stream.

Source is the source stream. It should be used by descendent streams to access the source stream to read from or write to.

Do not free the Source reference directly if SourceOwner is True. In that case the owner stream instance will free the source stream itself.

Indicates whether the ownerstream owns it's source SourceOwner indicates whether the TOwnerStream owns it's Source stream or not. If this property is True then the Source stream is freed when the TOwnerStream instance is freed. Overrides the Seek method. seek uses the FileSeek method to position the stream on the desired position. Note that handle stream descendents (notably pipes) can override the method to prevent the seek. return the size of the stream. GetSize returns the size of the reseved memory. It should not be used directly. UTF8 encoded unicode string. Return the type of the next value.

NextValue returns the type of the next value in a binary stream, but does not read the value.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read the next value in the stream

NextValue reads the next value in a binary stream and returns the type of the read value.

This method is simply the implementation for a binary stream of the abstract method introduced in

Start reading the root component.

BeginRootComponent starts reading the root component in a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Start reading a component.

This method is simply the implementation for a binary stream of the abstract method introduced in

Start reading a property.

This method is simply the implementation for a binary stream of the abstract method introduced in

Start reading a binary value.

ReadBinary reads a binary valye from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a float value

ReadFloat reads a float value from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a single-size float value

ReadSingle reads a single-sized float value from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a date.

ReadDate reads a date value from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read an identifier

ReadIdent reads an identifier from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read an 8-bits integer.

Read8Int reads an 8-bits signed integer from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a 16-bits integer.

Read16Int reads a 16-bits signed integer from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a 32-bits integer.

Read32Int reads a 32-bits signed integer from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a 64-bits integer.

Read64Int reads a 64-bits signed integer from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a set

ReadSet reads a set from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a short string

ReadStr reads a short string from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Read a string

ReadStr reads a string of type StringType from a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Skip a component's data

SkipComponent skips the data of a component in a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in .

Skip a value's data

SkipComponent skips the data of the next value in a binary stream.

This method is simply the implementation for a binary stream of the abstract method introduced in

Callback for the event. TSetMethodPropertyEvent is the prototype for the event. Reader is the sender of the event, Instance is the instance that is being streamed. PropInfo is a pointer to the RTTI information for the property being read, and TheMethodName is the name of the method that the property should be set to. Handled should be set to True if the handler set the property succesfully. Callback for the event. TPropertyNotFoundEvent is the prototype for the event. Reader is the sender of the event, Instance is the instance that is being streamed. PropInfo is a pointer to the RTTI information for the property being read. Handled should be set to True if the handler redirected the unknown property succesfully, and Skip should be set to True if the value should be skipped. IsPath determines whether the property refers to a sub-property. Callback for the event handler TReadWriteStringPropertyEvent is the prototype for the event handler. Reader is the sender of the event, Instance is the instance that is being streamed. PropInfo is a pointer to the RTTI information for the property being read. Content is the string as it was read from the stream. Handler for treating missing properties.

OnPropertyNotFound can be used to take appropriate action when a property is read from a stream and no such property is found in the RTTI information of the Instance that is being read from the stream. It can be set at runtime, or at designtime by an IDE.

For more information about the meaning of the various arguments to the event handler, see .

Handler for setting method properties. OnSetMethodProperty can be set to handle the setting of method properties. This handler can be used by an IDE to prevent methods from actually being assigned when an object is being streamed in the designer. Handler for translating strings when read from the stream. OnReadStringProperty is called whenever a string property is read from the stream. It can be used e.g. by a translation mechanism to translate the strings on the fly, when a form is loaded. See for a description of the various parameters. Callback for the event. TWriteMethodPropertyEvent is the prototype for the event. Writer is the sender of the event, Instance is the instance that is being streamed. PropInfo is a pointer to the RTTI information for the property being written, and MethodValue is the value of the method that the property was set to. DefMethodCodeValue is set to the default value of the property (Nil or the parent value). Handled should be set to True if the handler set the property succesfully. Handler from writing method properties. OnWriteMethodProperty can be set by an IDE or some streaming mechanism which handles dummy values for method properties; It can be used to write a real value to the stream which will be interpreted correctly when the stream is read. See for a description of the arguments. Event handler for translating strings written to stream. OnWriteStringProperty is called whenever a string property is written to the stream. It can be used e.g. by a translation mechanism to translate the strings on the fly, when a form is written. See for a description of the various parameters. Exception raised when a thread is destroyed illegally. Synchronize callback type Exception that occured during thread execution FatalException contains the exception that occurred during the thread's execution. Overrides standard BeforeDestruction. BeforeDestruction is overridden by TComponent to set the csDestroying flag in Standard action execution method. ExecuteAction checks whether Action handles the current component, and if yes, calls the ExecuteAction method, passing itself as a parameter. The function returns True if the action handles the current component. Remove a component from the Free Notification list. RemoveFreeNotification removes AComponent from the freenotification list. Updates the state of an action. UpdateAction checks whether Action handles the current component, and if yes, calls the UpdateTarget method, passing itself as a parameter. The function returns True if the action handles the current component. Container for non-visual components.

TDataModule is a container for non-visual objects which can be used in an IDE to group non-visual objects which can be used by various other containers (forms) in a project. Notably, data access components are typically stored on a datamodule. Web components and services can also be implemented as descendents of datamodules.

TDataModule introduces some events which make it easier to program, and provides the needed streaming capabilities for persistent storage.

An IDE will typically allow to create a descendent of TDataModule which contains non-visual components in it's published property list.

Create a new instance of a TDataModule. Create creates a new instance of the TDatamodule and calls . After that it reads the published properties from a stream using if a descendent class is instantiated. If the OldCreateOrder property is True, the event is called. An exception can be raised during the streaming operation. CreateNew creates a new instance of the class, but bypasses the streaming mechanism. The CreateMode parameter (by default zero) is not used in TDataModule. If the handler is set, then it is called, with the newly created instance as an argument. Destroys the TDataModule instance.

Destroy destroys the TDataModule instance. If the OldCreateOrder property is True the OnDestroy event handler is called prior to destroying the data module.

Before calling the inherited destroy, the handler is called if it is set, and Self is passed as a parameter.

An event can be raised during the OnDestroy event handler.
Overrides standard TObject behaviour. AfterConstruction calls the OnCreate handler if the OldCreateOrder property is False. BeforeDestruction calls the OnDestroy handler if the OldCreateOrder property is False. Position property needed for manipulation in an IDE. DesignOffset is the position of the datamodule when displayed in an IDE. It is streamed to the form file, and should not be used at run-time. Size property needed for manipulation in an IDE. DesignSize is the size of the datamodule when displayed in an IDE. It is streamed to the form file, and should not be used at run-time. Event handler, called when the datamodule is created. The OnCreate event is triggered when the datamodule is created and streamed. The exact moment of triggering is dependent on the value of the OldCreateOrder property. Event handler, called when the datamodule is destroyed. The OnDestroy event is triggered when the datamodule is destroyed The exact moment of triggering is dependent on the value of the OldCreateOrder property. Determines when OnCreate and OnDestroy are triggered.

OldCreateOrder determines when exactly the OnCreate and OnDestroy event handlers are called.

If set to True, then the OnCreate event handler is called after the data module was streamed. If it is set to False, then the handler is called prior to the streaming process.

If set to True, then the OnDestroy event handler is called before the data module is removed from the streaming system. If it is set to False, then the handler is called after the data module was removed from the streaming process.

Handler called when a new TDataModule instance is created. AddDataModule can be set by an IDE or a streaming mechanism to receive notification when a new instance of a descendent is created. Handler called when a TDataModule instance is freed. RemoveDataModule can be set by an IDE or a streaming mechanism to receive notification when an instance of a descendent is freed. Handler for exceptions when a TDataModule streaming error occurs. ApplicationHandleException can be set by an application object to handle any exceptions that may occur when a is created. Unused. Check whether there are any synchronize calls in the synchronize queue.

CheckSynchronize should be called regularly by the main application thread to handle any calls that may be waiting for execution by the main thread. If any such calls are waiting for execution by the main thread, they are executed at once, in the order that they were scheduled.

The function returns True if any Synchronize method was executed.

TimeOut is the maximum amount of time (in milliseconds) that the CheckSynchronize routine will wait for synchronisation requests to appear in the queue.

Calling this routine more often will ensure that synchronize requests are handled faster.

This routine may not be called from any thread other than the main thread, as it will execute the waiting requests.

Threads may call the to signal the main thread that the synchronisation queue contains items, and thus speed up the execution of the synchronize calls.

Handler which is called if a thread wants to synchronize with the main application thread.

WakeMainThread is a handler, which, when set, is called by the routine to signal the main thread that a synchronization routine is waiting in the queue.

This handler is by default empty. An actual implementation depends on the main program logic (usually an event loop) and must be provided by the event loop logic: the event loop will normally call at regular intervals. The WakeMainThread can make sure this happens as soon as possible.

While this handle should alert the main program thread that a thread is waiting for synchronization, the call is executed by the thread, and should therefore NOT synchronize the thread, but should somehow signal the main thread that a thread is waiting for synchronization. For example, by sending a message.

Start new class group.

StartClassGroup starts a new class group and adds AClass to it.

The class registration and streaming mechanism allows to organize the classes in groups. This allows an IDE to form groups of classes, which can be enabled or disabled. It is not needed at Run-Time.

Add class to the group of another class.

GroupDescendentsWith adds AClass to the group that AClassGroup belongs to. If AClassGroup belongs to more than 1 group, then it is added to the group which contains the nearest ancestor.

The class registration and streaming mechanism allows to organize the classes in groups. This allows an IDE to form groups of classes, which can be enabled or disabled. It is not needed at Run-Time.

Activates a class group

ActivateClassGroup activates the group of classes to which AClass belongs. The function returns the class that was last used to activate the class group.

The class registration and streaming mechanism allows to organize the classes in groups. This allows an IDE to form groups of classes, which can be enabled or disabled. It is not needed at Run-Time.

If AClass does not belong to a class group, an exception is raised.
Returns the class group to which an instance or class belongs ClassGroupOf returns the class group to which AClass or Instance belongs. The result is Nil if no matching class group is found. Callback type for RegisterInitComponentHandler TInitComponentHandler is a callback type. It is used in the call to initialize a component. Callbacks of this type are registered with the call. Register a component searching handler RegisterFindGlobalComponentProc registers a global component search callback AFindGlobalComponent. When is called, then this callback will be used to search for the component. None. Remove a previously registered component searching handler. UnRegisterFindGlobalComponentProc unregisters the previously registered global component search callback AFindGlobalComponent. After this call, when is called, then this callback will be no longer be used to search for the component. None. Register a component initialization handler RegisterInitComponentHandler registers a component initialization handler Handler for the component ComponentClass. This handler will be used to initialize descendents of ComponentClass in the call. Convert a binary buffer to a hexadecimal string

BinToHex converts the byte values in BinValue to a string consisting of 2-charachter hexadecimal strings in HexValue. BufSize specifies the length of BinValue, which means that HexValue must have size 2*BufSize.

For example a buffer containing the byte values 255 and 0 will be converted to FF00.

No length checking is done, so if an invalid size is specified, an exception may follow.
Convert a hexadecimal string to a binary buffer HexToBin scans the hexadecimal string representation in HexValue and transforms every 2 character hexadecimal number to a byte and stores it in BinValue. The buffer size is the size of the binary buffer. Scanning will stop if the size of the binary buffer is reached or when an invalid character is encountered. The return value is the number of stored bytes. No length checking is done, so if an invalid size is specified, an exception may follow. X coordinate Y coordinate Subrange type based on TAlignment TLeftRight is a subrange type based on the enumerated type. It contains only the left and right alignment constants. BIDI description TBiDiMode describes bi-directional support for displaying texts. Texts read from left to right. Texts read from right to left. Texts read from right to left, but not right-aligned Texts read from right to left Method callback type for TFPList.ForEachCall TListCallback is the method callback prototype for the function that is passed to the call. The data argument will be filled with all the pointers in the list (one per call) and the arg argument is the Arg argument passed to the ForEachCall call. Data pointer from the list. Parameter passed to the ForEachCall call. Static method callback type for TFPList.ForEachCall TListCallback is the procedurald callback prototype for the function that is passed to the call. The data argument will be filled with all the pointers in the list (one per call) and the arg argument is the Arg argument passed to the ForEachCall call. Call a procedure or method for each pointer in the list. ForEachCall iterates over all pointers in the list and calls proc2call, passing it the pointer and the additional arg data pointer. Proc2Call can be a method or a static procedure. None. Describes what to do with duplicates Duplicates describes what the threadlist should do when a duplicate pointer is added to the list. It is identical in behaviour to the Duplicates property of . TPersistent descendent which implements the IInterface interface TInterfacedPersistent is a direct descendent of which implements the interface. In particular, it implements the QueryInterface as a public method. IInterface Implementation of IInterface.QueryInterface QueryInterface simply calls GetInterface using the specified IID, and returns the correct values. TObject.GetInterface Overrides the standard AfterConstruction method. AfterConstruction is overridden to do some extra interface housekeeping: a reference to the IInterface interface of the owning class is obtained (if it exists). Add a reference to the indicated strings. Release the reference to the strings. Persistence streaming interface. IStreamPersist defines an interface for object persistence streaming to a stream. Any class implementing this interface is expected to be able to save or load it's state from or to a stream. Load persistent data from stream. LoadFromStream is the method called when the object should load it's state from the stream stream. It should be able to read the data which was written using the SavetoStream method. Save persistent data to stream. SaveFromStream is the method called when the object should load it's state from the stream stream. The data written by this method should be readable by the LoadFromStream method. Read a currency value from the stream. ReadCurrency is called when a currency-typed value should be read from the stream. This abstract method should be overidden by descendent classes, and should return the currency value read from the stream. Read a widestring value from the stream. ReadWideString is called when a widestring-typed value should be read from the stream. This abstract method should be overidden by descendent classes. Read a currency value from the stream. var>ReadCurrency reads a currency-typed value from a binary stream. It is the implementation of the method introduced in . Read a widestring value from the stream. var>ReadWideString reads a widestring-typed value from a binary stream. It is the implementation of the method introduced in . Read a currency value from the stream. ReadCurrency reads a currency typed value from the stream and returns the result. This method does nothing except call the driver method of the driver being used. Read a WideString value from the stream. ReadWidestring reads a widestring typed value from the stream and returns the result. This method does nothing except call the driver method of the driver being used. Write a currency value to the stream WriteCurrency is called when a currency-typed value should be written to the stream. This abstract method should be overidden by descendent classes. Write a widestring value to the stream WriteCurrency is called when a currency-typed value should be written to the stream. This abstract method should be overidden by descendent classes. Write a currency-valued type to a stream WriteCurrency writes a currency-typed value to a binary stream. It is the implementation of the method introduced in . Write a widestring-valued type to a stream WriteWidestring writes a widestring-typed value to a binary stream. It is the implementation of the method introduced in . Write a currency value to the stream WriteCurrency writes a currency typed value to the stream. This method does nothing except call the driver method of the driver being used. Write a widestring value to the stream WriteWidestring writes a currency typed value to the stream. This method does nothing except call the driver method of the driver being used. Subcomponent - streamed as part of the owning component Transient component Designer notification interface IDesignerNotify is an interface that can be used to communicate changes to a designer mechanism. It offers functionality for detecting changes, and notifications when the component is destroyed. Notify that the component is modified. Modified can be used to notify a designer of changes, indicating that components should be streamed. Notification of owner changes Notification is the interface counterpart of which is used to communicate adds to the components. Interface for maintaining a list of interfaces.

IInterfaceList is an interface for maintaining a list of interfaces, strongly resembling the standard class. It offers the same list of public methods as TList, with the exception that it uses interfaces instead of pointers.

All interfaces in the list should descend from IUnknown.

More detailed descriptions of how the various methods behave can be found in the TList reference.

Retrieve an interface pointer from the list. Get returns the interface pointer at position i in the list. It serves as the Read method for the Items property. Return the capacity of the list. GetCapacity returns the current capacity of the list. It serves as the Read method for the Capacity property. Return the current number of elements in the list. It serves as the Read method for the Count property. Write an item to the list Put writes the interface Item at position I in the list. It servers as the Write method for the Items property. Set the capacity of the list SetCapacity sets the capacity of the list to NewCapacity. It serves as the Write method for the Capacity property. Set the number of items in the list SetCount sets the count of the list to NewCount. It serves as the Write method for the Capacity Clear the list Clear removes all interfaces from the list. All interfaces in the list will be cleared (i.e. their reference count will decrease with 1) Remove an interface from the list Delete removes the interface at position Index from the list. It does this by explicitly clearing the interface and then removing the slot. Exchange 2 interfaces in the list Exchange exchanges 2 interfaces in the list at locations index1 and Index2. Return the first non-empty interface in the list. First returns the first non-empty interface in the list. Return the index of an interface. IndexOf returns the location in the list of the interface Item. If there is no such interface in the list, then -1 is returned. Add an interface to the list Add adds the interface Item to the list, and returns the position at which it has been added. Insert an interface in the list. Insert inserts the interface Item in the list, at position I, shifting all items one position. Returns the last non-nil interface in the list. Last returns the last non-empty interface in the list. Remove an interface from the list Remove searches for the first occurrence of Item in the list and deletes it. Lock the list Lock locks the list. After a call to lock, the object list can only be accessed by the current thread, untill UnLock is called. Unlock the list. Unlock unlocks a locked list. After a call to UnLock, other threads are again able to access the list. Capacity of the list Capacity is the maximum number of elements the list can hold without needing to reallocate memory for the list. It can be set to improve speed when adding a lot of items to the list. Current number of elements in the list. Count is the current number of elements in the list. Setting it to a larger number will allocate empty slots. Setting it to a smaller number will clear any interfaces that fall outside the new border. Provides Index-based, sequential, access to the interfaces in the list. Items is the default property of the interface list and provides index-based array access to the interfaces in the list. Allowed values for Index include 0 to Count-1 Standard implementation of the IInterfaceList interface.

TInterfaceList is a standard implementation of the interface. It uses a instance to store the list of interfaces.

Create a new instance of TInterfaceList Create creates a new instance of the TInterfaceList class. It sets up the internal structures needed to store the list of interfaces. Destroy Destroys the list of interfaces

Destroy first calls Clear and then frees the TInterfaceList instance from memory.

Note that the Clear method decreases the reference count of all interfaces.

Create Clear
Removes all interfaces from the list. Clear is the implementation of the method. It removes all interfaces from the list. It does this by setting each element in the list to Nil, in this way the reference count of each interface in the list is descreased. Add Destroy Delete an interface from the list. Delete is the implementation of the method. It clears the slot first and then removes the element from the list. Exchange 2 interfaces in the list Exchange is the implementation of the method. It exchanges the position of 2 interfaces in the list. Returns the first non-Nil element in the list. First is the implementation of the method. It returns the first non-Nil element from the list. Returns the index of an interface. IndexOf is the implementation of the method. It returns the zero-based index in the list of the indicated interface, or -1 if the index is not in the list. Add an interface to the list Add is the implementation of the method. It adds an interface to the list, and returns the location of the new element in the list. This operation will increment the reference count of the interface. Insert an interface to the list Insert is the implementation of the method. It inserts an interface in the list at the indicated position. This operation will increment the reference count of the interface. Returns the last non-Nil element in the list. Last is the implementation of the method. It returns the last non-Nil element from the list. Remove an interface from the list Remove is the implementation of the method. It removes the first occurrence of the interface from the list. Lock the list Lock locks the list. It is the implementation of the method. It limits access to the list to the current thread. UnLocks a locked list UnLock unlocks the list. It is the implementation of the method. After a call to unlock, the current thread releases the list for manipulation by other threads. Expands the list Expand calls the expand method from the internally used list. It returns itself. The current capacity of the list. Capacity is the number of elements that the list can contain without needing to allocate more memory. The current number of elements in the list. Count is the number of elements in the list. This can include Nil elements. Note that the elements are zero-based, and thus are indexed from 0 to Count-1. Array-based access to the list's items. Items provides indexed access to the elements in the list. Note that the elements are zero-based, and thus are indexed from 0 to Count-1. The items are read-write. It is not possible to add elements to the list by accessing an element with index larger or equal to Count. Check whether two TPoint variables are equal. PointsEqual compares the P1 and P2 points (of type or ) and returns True if the X and Y coordinates of the points are equal, or False otherwise. Check whether a point is invalid. InvalidPoint returns True if the X and Y coordinates (of the TPoint or TSmallPoint records, if one of these versions is used) are -1. Global namespace An interface protecting the global namespace. Used when reading/writing to the global namespace list during streaming of forms. Split a string in different words. ExtractStrings splits Content (a null-terminated string) into words, and adds the words to the Strings stringlist. The words are separated by Separators and any characters in whitespace are stripped from the strings. The space and CR/LF characters are always considered whitespace. No length checking is performed on Content. If no null-termination character is present, an access violation may occur. Likewise, if Strings is not valid, an access violation may occur. Read raw data from stream Read is introduced for Delphi compatibility to read raw data from the component stream. This should not be used in production code as it will totally mess up the streaming. Read raw data from stream Read is introduced for Delphi compatibility to read raw data from the component stream. This should not be used in production code as it will totally mess up the streaming. Read raw data from stream Read is introduced for Delphi compatibility to read raw data from the component stream. This should not be used in new production code as it will totally mess up the streaming. Read widechar from the stream TReader.ReadWideChar reads a widechar from the stream. This actually reads a widestring and returns the first character. Write raw data to stream Write is introduced for Delphi compatibility to write raw data to the component stream. This should not be used in new production code as it will totally mess up the streaming. Write raw data to stream Write is introduced for Delphi compatibility to write raw data to the component stream. This should not be used in new production code as it will totally mess up the streaming. Write raw data to stream Write is introduced for Delphi compatibility to write raw data to the component stream. This should not be used in new production code as it will totally mess up the streaming. Write widechar to stream WriteWideChar writes a widechar to the stream. This actually writes a widestring of length 1. Code to be executed after construction but before execute. AfterConstruction is overridden in TThread but currently does not do anything useful. List assign operation This type determines what operation or performs. Clear list and copy all strings from second list. Remove all elements not first second list Add all elements from second (and optional third) list, eliminate duplicates Remove elements in second lists, Add all elements from second list not in first list Just keep all elements that exist only in source list Keep all elements that exists only in list2 Add all pointers from another list AddList adds all pointers from AList to the list. If a pointer is already present, it is added a second time. Add all pointers from another list AddList adds all pointers from AList to the list. If a pointer is already present, it is added a second time. Extract the name part of a string ExtractName returns the name part (the part before the NameValueSeparator character) of the string. If the character is not present, an empty string is returned. The resulting string is not trimmed, it can end or start with spaces. NameValueSeparator Determines which line breaks to use in the Text property

TextLineBreakStyle determines which linebreak style is used when constructing the Text property: the same rules are used as in the writing to text files:

tlbsLF
Lines are separated with a linefeed character #10.
tlbsCRLF
Lines are separated with a carriage-return/linefeed character pair: #13#10.
tlbsCR
Lines are separated with a carriage-return character #13.

It has no effect when setting the text property.

Text
Determines the ownership of a TStreamAdapter The ownership of a streamadapter determines what happens with the stream on which a acts, when the adapter is freed. Stream is referenced only, it is not freed by the adapter Stream is owned: it will be freed when the adapter is freed. Implements IStream for TStream descendents Create a new instance of TStreamAdapter

Create creates a new instance of TStreamAdaptor. It initializes with Stream and initializes StreamOwnerShip with Ownership.

TStreamAdapter is an abstract class: descendents must be created that implement the actual functionality.

StreamOwnerShip
Free the TStreamAdapter instance Explicitly free the TStreamAdapter instance. Normally, this is done automatically if a reference to the IStream interface is freed. Read from the stream. Read implements by reading from the stream specified at creation. This function must be overridden and will raise a runerror 217 when called directly. Write to the stream Write implements by writing to the stream specified at creation. This function must be overridden and will raise a runerror 217 when called directly. Set the stream position Seek implements by setting the position of the stream specified at creation. This function must be overridden and will raise a runerror 217 when called directly. Set the stream size SetSize implements by setting the size of the stream specified at creation. This function must be overridden and will raise a runerror 217 when called directly. Copy data to destination stream CopyTo implements . This function must be overridden and will raise a runerror 217 when called directly. Commit data to the stream Commit implements . This function must be overridden and will raise a runerror 217 when called directly. Revert operations on the stream Revert implements . This function must be overridden and will raise a runerror 217 when called directly. Lock a region of the stream LockRegion implements . This function must be overridden and will raise a runerror 217 when called directly. Unlock a region of the stream UnLockRegion implements . This function must be overridden and will raise a runerror 217 when called directly. Return statistical data about the stream Stat implements . This function must be overridden and will raise a runerror 217 when called directly. Clone the stream Clone implements . This function must be overridden and will raise a runerror 217 when called directly. Stream on which adaptor works This is the stream on which the adaptor works. It was specified at rreation. Determines what happens with the stream when the adaptor is freed StreamOwnership determines what happens when the adaptor Path to the property that is currently being written PropertyPath is set to the property name of the class currently being written to stream. This is only done when descendent class properties are written. Interface for checking component references IInterfaceComponentReference is an interface to return the component that implements a given interface. It is implemented by . . Return component instance GetComponent returns the component instance. None. Checks if the current component is the implementor of the interface IsImplementorOf returns True if the current component implements the given interface. The interface should descend from and the GetComponent method should return the current instance. Interface implementation of Notification ReferenceInterface can be used to notify an interface of a component operation: it is the equivalent of the method of TComponent for interfaces. If the interface implements , then the component that implements the interface is notified of the given operation Op. None. Return the integer to string converter for an integer type FindIntToIdent returns the handler that handles the conversion of an integer to a string representation that can be used in component streaming, when is called. Nil is returned if no handler is registered for the given type. Return the string to integer converter for an integer type FindIdentToInt returns the handler that handles the conversion of a string representation to an integer that can be used in component streaming, when is called. Nil is returned if no handler is registered for the given type. Callback to sort collection items

TCollectionSortCompare is the prototype for a callback used in the method. The procedure should compare Item1 and Item2 and return an integer:

Result < 0
if Item1 comes before Item2
Result = 0
if Item1 is at the same level as Item2
Result > 0
if Item1 comes after Item2
Sort the items in the collection

Sort sorts the items in the collection, and uses the Compare procedure to compare 2 items in the collection. It is more efficient do use this method than to perform the sort manually, because the list items are manipulated directly.

For more information on how the Compare function should behave, see the type.

Should only the delimiter character be considered a delimiter

StrictDelimiter can be used to indicate that only the delimiter character should be considered a delimiter when setting DelimitedText: under normal circumstances, quotes and spaces are considered specially (see the property for more information).

When StrictDelimiter is set to True then only the Delimiter character is considered when splitting the text in items: no quoting whatsoever is performed when writing the DelimitedText property. However, when reading the DelimitedText property, quoted strings are taken into account (so a quoted string can contain a delimiter that is treated as text instead of a delimiter).

DelimitedText CommaText Delimiter
UnicodeString value QWord (64-bit word) value Read a unicode string value

ReadUnicodeString should read a UnicodeString value from the stream. (indicated by the vaUString value type).

Descendent classes should override this method to actually read a UnicodeString value.

Read a unicode string value ReadUnicodeString is overridden by TBinaryObjectReaderto read a UnicodeString value from the binary stream. Read unicode character ReadUnicodeChar reads a single unicode character from the stream. It does this by reading a UnicodeString string from the stream and returning the first character. If the string has a length different from 1, an EReadError exception will occur. Read a variant from the stream ReadVariant reads the next value from the stream and returns it as a variant. No variant array can be read from the stream, only single values. If no variant manager is installed, the function will raise an EReadError exception. If the next value is not a simple value, again an EReadError exception is raised. exception is Read a UnicodeString value from the stream ReadUnicodeString reads a UnicodeString string from the stream. The stream can contain a string from any type, it will be converted to UniCodeString. Write an unsigned 64-bit integer WriteUInt64 must be overridden by descendent classes to write a 64-bit unsigned Value (valuetype vaQWord) to the stream. None. Write a variant to the stream WriteVariant must be overridden by descendent classes to write a simple variant type to the stream. WriteVariant does not write arrays types or complex types. Write a unicode string to the stream. WriteUnicodeString must be overridden by descendent classes to write a unicodestring (valuetype vaUString) value to the stream. Write an unsigned 64-bit integer WriteUInt64 is overridden by TBinaryObjectWriter to write an unsigned 64-bit integer (QWord) to the stream. It tries to use the smallest possible storage for the value that is passed. (largest valuetype will be vaQWord). Write a unicode string to the stream. WriteUnicodeString is overridden TBinaryObjectWriter to write a unicodestring (valuetype vaUString) value to the stream. It simply writes the character length and then all widecharacters. Write a variant to the stream WriteVariant is overridden by TBinaryObjectWriter to write a simple variant type to the stream. WriteVariant does not write arrays types or complex types. Only null, integer (ordinal) float and string types are written. If a non-supported type is written, then an EWriteError exception is. Write a unicode string to the stream. WriteUnicodeString writes Value, a UnicodeString string to the stream. It simply passes the string on to the WriteUnicodeString method of the writer driver class. Write a variant to the stream WriteVariant writes Value, a simple variant, o the stream. It simply passes the string on to the WriteVariant method of the writer driver class. Implements IEnumerator for the TFPList class. TFPListEnumerator implements the interface for the class, so the TFPList class can be used in a for ... in loop. It is returned by the method of TFPList. Initialize a new instance of TFPListEnumerator Create initializes a new instance of TFPListEnumerator and keeps a reference to the list AList that will be enumerated. Return the current pointer in the list GetCurrent returns the current pointer in the enumerator. No checking is done on the validity of the current position. MoveNext Move the position of the enumerator to the next position in the list. MoveNext puts the pointer on the next item in the list, and returns True if this succeeded, or False if the pointer is past the last element in the list. Note that if False is returned, calling GetCurrent will result in an exception. GetCurrent Current pointer in the list Current redefines GetCurrent as a property. GetCurrent Create an IEnumerator instance GetEnumerator is the implementation of the IEnumerable interface for TFPList. It creates a instance and returns it's IEnumerator interface. IEnumerator IEnumerable Implements IEnumerator for the TList class. TListEnumerator implements the interface for the class, so the TList class can be used in a for ... in loop. It is returned by the method of TList. Initialize a new instance of TListEnumerator Create initializes a new instance of TListEnumerator and keeps a reference to the list AList that will be enumerated. Return the current pointer in the list GetCurrent returns the current pointer in the enumerator. No checking is done on the validity of the current position. MoveNext Move the position of the enumerator to the next position in the list. MoveNext puts the pointer on the next item in the list, and returns True if this succeeded, or False if the pointer is past the last element in the list. Note that if False is returned, calling GetCurrent will result in an exception. GetCurrent Current pointer in the list Current redefines GetCurrent as a property. GetCurrent Create an IEnumerator instance GetEnumerator is the implementation of the IEnumerable interface for TList. It creates a instance and returns it's IEnumerator interface. IEnumerator IEnumerable Implements IEnumerator for the TCollection class. TCollectionEnumerator implements the interface for the class, so the TCollection class can be used in a for ... in loop. It is returned by the method of TCollection. Initialize a new instance of TCollectionEnumerator Create initializes a new instance of TCollectionEnumerator and keeps a reference to the collection ACollection that will be enumerated. Return the current pointer in the list GetCurrent returns the current instance in the enumerator. No checking is done on the validity of the current position. MoveNext Move the position of the enumerator to the next position in the collection. MoveNext puts the pointer on the next item in the collection, and returns True if this succeeded, or False if the pointer is past the last element in the list. Note that if False is returned, calling GetCurrent will result in an exception. GetCurrent Current pointer in the list Current redefines GetCurrent as a property. GetCurrent Create an IEnumerator instance GetEnumerator is the implementation of the IEnumerable interface for TCollection. It creates a instance and returns it's IEnumerator interface. IEnumerator IEnumerable Exchange 2 items in the collection Exchange exchanges the items at indexes Index1 and Index2 in the collection. If one of the two indexes is invalid (less than zero or larger than the number of items) an EListError exception is raised. Items Implements IEnumerator for the TStrings class. TStringsEnumerator implements the interface for the class, so the TStrings class can be used in a for ... in loop. It is returned by the method of TStrings. Initialize a new instance of TStringsEnumerator Create initializes a new instance of TStringsEnumerator and keeps a reference to the stringlist AStrings that will be enumerated. Return the current pointer in the list GetCurrent returns the current string item in the enumerator. No checking is done on the validity of the current position. MoveNext Move the position of the enumerator to the next position in the list. MoveNext puts the pointer on the next item in the stringlist, and returns True if this succeeded, or False if the pointer is past the last element in the list. Note that if False is returned, calling GetCurrent will result in an exception. GetCurrent Current pointer in the list Current redefines GetCurrent as a property. GetCurrent Create an IEnumerator instance GetEnumerator is the implementation of the IEnumerable interface for TStrings. It creates a instance and returns it's IEnumerator interface. IEnumerator IEnumerable Read a QWord value from the stream and return its value ReadQWord reads a QWord value (8 bytes) from the stream and returns it's value. If not enough bytes are available on the stream, an exception will be raised. Write a QWord value to the stream WriteQWord writes the word W (i.e. 8 bytes) to the stream. This is a utility function which simply calls the Write function. The word can be read from the stream using the ReadQWord function. If an error occurs when attempting to write, an exception will be raised. Proxy stream for the IStream interface TProxyStream is a proxy class for the interface. It implements all stream methods by relaying them to the IStream interface. Create a new instance of the TProxyStream class. Create initializes a new instance of the TProxyStream class. It saves var stream for use in the other methods. Check errors Check will check the result of the IStream interface. This method must be overridden by descendent classes to return interface-specific errors. Read a set value from the stream ReadSet reads a set of elements with type EnumType and returns them as an integer where each element is encoded in a bit of the integer. Thus, at most an enumerated type with 32 elements can be read with this function. No checking is performed on the validity of EnumType. It is assumed to be a valid PTypeInfo pointer. Write a set value to the stream WriteSet writes a set Value consisting of elements with type EnumType. The set must be encoded as an integer where each element is encoded in a bit of the integer. Thus, at most an enumerated type with 32 elements can be written with this method. No checking is performed on the validity of EnumType. It is assumed to be a valid PTypeInfo pointer. Implements IEnumerator for the TComponent class. TComponentEnumerator implements the interface for the class, so the TComponent class can be used in a for ... in loop over the child components of the component. It is returned by the method of TComponent. Initialize a new instance of TComponentEnumerator Create initializes a new instance of TComponentEnumerator and keeps a reference to the component AComponent that will be enumerated. Return the current pointer in the list GetCurrent returns the current child component instance in the enumerator. No checking is done on the validity of the current position. MoveNext Move the position of the enumerator to the next position in the children of the component. MoveNext puts the pointer on the next child in the components child components, and returns True if this succeeded, or False if the pointer is past the last child in the list. Note that if False is returned, calling GetCurrent will result in an exception. GetCurrent Current pointer in the list Current redefines GetCurrent as a property. GetCurrent Create an IEnumerator instance GetEnumerator is the implementation of the IEnumerable interface for TComponent. It creates a instance and returns it's IEnumerator interface. The enumerator enumerates all child components of the component instance. IEnumerator IEnumerable Implements IEnumerator for the TInterfaceList class. TInterfaceListEnumerator implements the interface for the class, so the TInterfaceList class can be used in a for ... in loop over the child components of the component. It is returned by the method of TInterfaceList. Initialize a new instance of TInterfaceListEnumerator Create initializes a new instance of TInterfaceListEnumerator and keeps a reference to the component AComponent that will be enumerated. Return the current pointer in the list GetCurrent returns the current interface in the list. No checking is done on the validity of the current position. MoveNext Move the position of the enumerator to the next position in the children of the component. MoveNext puts the pointer on the next interface in the list, and returns True if this succeeded, or False if the pointer is past the last interface in the list. Note that if False is returned, calling GetCurrent will result in an exception. GetCurrent Current pointer in the list Current redefines GetCurrent as a property. GetCurrent Create an IEnumerator instance GetEnumerator is the implementation of the IEnumerable interface for TInterfaceList. It creates a instance and returns it's IEnumerator interface. The enumerator enumerates all interfaces in the list. IEnumerator IEnumerable Class pointer for TDataModule TDataModuleClass defines the class pointer for . Encoding of the object text file TObjectTextEncoding is an enumerated type which denotes the encoding of non ascii characters in an object stream file. It is needed for correct encoding when reading string values in the text stream. Characters are in DFM (Delphi) format: widechar encoded. Characters are in LFM format: UTF-8 encoded. Class of Exception TExceptionClass is the class pointer for the Exception class, defined in the SysUtils unit. Exception Determines whether the stringlist owns it's objects or not. OwnsObjects can be set to true to let the stringlist instance own the objects in the list: if an element is removed from the list, the associated object (if there is any) will be freed as well. The same is true if the list is cleared or destroyed. Com automation Object interface IVCLComObject is used by TComponent to implement the IUnknown interface used by COM automation servers. Partially, it is the translation to pascal of the IDispatch interface definition by Microsoft. If TComponent needs to return an IUnknown interface, it creates a IVCLComObject interface instead. The IDispatch:GetTypeInfoCount call for automation servers GetTypeInfoCount must return in Count either 0 or 1 to indicate that it provides type information (1) or not (0). On error, a nonzero (different from S_OK) return value must be returned. The IDispatch:GetTypeInfo call for automation servers GetTypeInfo must return the Index-th entry in the type information of the component in TypeInfo. The LocaleID argument can be used to indicate the locale of the caller, as different type information can be returned depending on the locale. On error, a nonzero (different from S_OK) return value must be returned. The IDispatch:GetIDsOfNames call for automation servers. GetIDsOfNames must return in DispIDs the dispatch Ids for the NameCount names of the methods listed in Names. The LocaleID indicates the locale of the caller. On error, a nonzero (different from S_OK) return value must be returned. The IDispatch:Invoke call for automation servers.

Invoke must invoke the method designated by DispID. IID can be ignored. LocaleID is used by the caller to indicate the locale it is using. The Flags argument describes the context in which Invoke is called: a method, or property getter/setter. The Params argument contains the parameters to the call. The result should be in VarResult. On error, ExcepInfo and ArgError should be filled.

The function should return 0 (S_OK) if all went well.

This method can be invoked if an exception occurs during Invoke SafeCallException is called to handle an exception during invocation of the Invoke method. The TObject implementation of this method returns E_UNEXPECTED. Is called by TComponent.FreeOnRelease FreeOnRelease is called by for the IVCLComObject interface implemented by TComponent. Interface reference implemented by the component ComObject returns the COM interface represented by the component. If the component does not represent a COM interface, reading this property will raise an . Called to create an instance of IVCLComObject CreateVCLComObjectProc is called by TComponent if it needs to create a IVCLComObject interface for itself (when the ComObject property is read). It passes itself as the Component parameter. Observed interface GUID as a string Observer interface GUID as a string Operation which is reported to an observer TFPObservedOperation enumerates the possible operations that can be reported to an observer. Which of these operations is reported depends on the implementation of the observed object. The observed object has changed. The observed object is being freed. An item is added to the observed object (generally a list). An item is deleted from the observed object (generally a list). Custom event. Interface implemented by an object that can be observed.

IFPObserved is an interface which can be implemented in objects that must be observable. Objects that wish to observe the object can register themselves with the call, and must be detached using the call.

This interface is not reference counted, so care must be taken that the ooFree message is sent with when the object is freed.

Attach a new observer to the object

FPOAttachObserver must be called with an object instance AObserver that implements the interface. The FPOObservedChanged method of the interface will be called whenever is used to notify observers of a change. Objects implementing this interface should check that AObserver actually implements the interface.

Do not make assumptions on how the interface behaves if FPOAttachObserver is called more than once with the same interface. It may add the object to the list of observers unconditionally (in which case it will be notified twice) or it may check that it is not yet in the list.

If AObserver does not implement the interface, an exception must be raised. No other errors should be raised, other than a possible out of memory error. FPOObservedChanged
Remove an observer from the list of observers.

FPODetachObserver removes the AObserver object from the list of observers. If it was not in the list, then this is silently accepted. Once removed, it will no longer receive notifications when FPOObservedChanged is called.

If the object was added more than once using , then it depends on the implementor of the interface whether or FPODetachObserver must be called an equal number of times.

FPOObservedChanged
Notify all observers FPONotifyObservers notifies all observers of the object that a change has occurred. It calls FPOObservedChanged on the interface of all attached objects, and passes on ASender (normally this is Self), AOperation and Data. What Data is, depends on the implementor of the interface. FPOObservedChanged Interface for an object to observe other objects. IFPObserver is the interface an object must implement if it wishes to receive change notifications from another object. The presence of this interface will be checked when the object registers itself using . The change notifications arrive because the method is called by the observed object. FPOAttachObserver Entry point for change notifications FPOObservedChanged is the method that is called by an observed object () when it calls FPONotifyObservers The Sender is the object under observation, the Operation and Data are the parameters used in the call to FPONotifyObservers. FPONotifyObservers Error raised when an observer error occurs EObserver is an error that is raised when an object is registered as an observer, and it does not implement the interface. Search direction for IndexOfItem TFPList.TDirection is used to indicate where the search algorithm starts it search: at the beginning of the list or at the end of the list. Start search at the beginning Start search at the end. Search an item in the list

IndexOfItem has the same function as the function: it searches for Item in the list, and returns the index of the first found matching pointer. If none is found, -1 is returned.

In difference with the IndexOf function, it accepts a parameter Direction indicating the search direction: from the beginning of the list till the end of the list, or from the end of the list till the beginning. The IndexOf function starts at the beginning of the list. The search direction is only important if the item can appear multiple times in the list.

Add an observer to the list of observers FPOAttachObserver is part of the implementation of the interface in Tlist. It adds a new observer to the list of observers. Calling this multiple times will add the observed object multiple times to the list. An EObserver exception may be raised if AObject does not implement the interface. Remove an observer from the list of observers FPODetachObserver is part of the implementation of the interface in Tlist. It removes the first found instance of the observer from the list of observers. Notify observers of changes in the list

FPONotifyObservers is called to notify observers of changes in the list. The following notifications are sent:

ooAddItem
when a pointer is added. Data is the pointer that is added.
ooDeleteItem
when a pointer is deleted or extracted. Data is the pointer that is deleted or extracted.
ooChange
called when 2 pointers are exchanged.
ooFree
Called when the list is freed.
Add an observer to the list of observers. FPOAttachObserver is part of the implementation of the interface in TPersistent. It adds a new observer to the list of observers. Calling this multiple times will add the observed object multiple times to the list. An EObserver exception may be raised if AObject does not implement the interface. Remove an observer from the list of observers FPODetachObserver is part of the implementation of the interface in TPersistent. It removes the first found instance of the observer from the list of observers. Notify observers of changes.

FPONotifyObservers can be called to notify observers of changes in the object. This method simply passes on the parameters that it receives to all attached interfaces.

TPersistent does not call FPONotifyObservers. It is implemented for the benefit of descendant classes.

Add text to the string list. AddText adds S to the strings. It is identical in function to setting but does not clear the list of strings first: S is split into lines, and each line is added to the list. Stream of bytes TBytesStream is a stream that uses an array of byte () to keep the stream data. it overrides the memory allocation routine to use the array of bytes. The array of bytes is exposed through the property. Create a new instance of the stream, initializing it with an array of bytes Create creates a new instance and initializes the memory with the data in ABytes. The stream data as an array of bytes. Bytes provides byte-sized access to the array of bytes that represent the stream data. As a pointer value, it equals , meaning that Memory points to the first byte in the array. Write a string to the binary stream WriteStr writes a string value to the binary stream. It is exposed so it can be used in DefineProperties.