Menu Content/Inhalt
Start arrow HS Object Kernel arrow HS OK - Articles arrow Basics of the construction and functionality of HSOK
Basics of the construction and functionality of HSOK: THSField class Print
20 June 2007
Article Index
THSField class
THSBaseObject class
THSObject class
THSBaseList and descendants
"Weak" and "strong" references
Unicode support
XML support
The kernel object

THSField class

All classes supported by HSOK inherit from THSField. This class inherits directly from TPersistent and thus all THSField descendants may use also Delphi's RTTI and streaming mechanisms when needed. THSField defines methods and properties that are common to all fields in objects supported by HSOK. These are i.a. properties AsVariant, AsString providing access to data and virtual methods Create, ClearData, CopyData, EditData, LoadFromStream, SaveToStream, Compare, WriteAsText, WriteAsXML, ReadAsText, ReadAsXML allowing processing.

Primitive types (String, WideString, Boolean, Byte, SmallInt, Word, Integer, Cardinal, Int64, Double and TDateTime) are represented by corresponding classes inherting from THSField e.g. THSStringField, THSByteField, THSSmallIntField etc. These classes serve as data containers only and have just one property "Value" of a proper type. They override virtual methods of THSSField, providing specific implementation for each type (reading, writing, clearing, copying etc.).

What's interesting you can define new classes supporting own field types in additional, external modules - e.g. the THSGraphicField class representing TGraphic type was defined in this way. After adding these modules to the project they are fully supported by the Class Editor.