This topic covers the implementation details of TLineEndingRec.
Scope: TypeDefinitions.pas; record. Prepared from the curated implementation supplied for this review on 2 October 2026.
EndingType selects the emitted payload: 3 MacroToken; 4 Formatting; 5 Xtags and XtagsDescription. Other ending types have no type-specific payload. The reader nevertheless looks for all these fields independently.
Overriding is serialized for every ending type. This proves the storage form, not that all combinations are accepted by the UI/generator.
Notation and shared helper rules: Reading this reference.
Practical editing guide: Modifying GenTokens in an XML script.
UI choices and stored EndingType values
The radio-button index is not the XML value. IndexToLineEndingType explicitly translates the UI order into TLineEndingType; SaveToXML stores the enum ordinal.
Line ending choice |
UI index (not XML) |
EndingType XML value |
Nothing |
0 |
6 |
Soft Return |
1 |
0 |
Hard Return |
2 |
1 |
Tabulation |
3 |
2 |
Next Column |
4 |
8 |
Next Box |
5 |
7 |
Macro |
6 |
3 |
Formatting |
7 |
4 |
Xtags |
8 |
5 |
Skip Line |
9 |
9 |
TpeLineEndingSettings.GetLineEnding maps cbOverrideTextTokens to Overriding.Enabled and edOverrideTextTokens to Overriding.TextTokens. Paragraph-format enable controls populate the nested Formatting records. The automatic-leading checkbox stores Formats.Leading=0.0; otherwise the numeric leading control supplies the value. Preserve the field-specific scaling used by the XML writer.
User-facing meaning: Line Endings and Paragraph Formatting (HelpContext 175920).
Literal rec_type values emitted within these routines: TLineEndingRec. Nested values may belong to child wrappers rather than this owner itself; the attribute entries below give their exact locations.
Structures used directly by this XML implementation:
Exact XML fields and attributes
The paths below start at this record or property node. A slash identifies a child element; @ identifies an attribute. Curly braces mark a variable index or expression, not literal XML text. Initial values describe initialization; they do not establish what an omitted individual element does. The Implementation toggle below contains the supplied routines for exact branch order and conversions.
EndingType
XML representation: The text of the EndingType element.
Reading: Reads the element into EndingType when the record node exists.
Writing: Stores the numeric value of EndingType (see the value table below) whenever the writer reaches this field.
MacroToken
XML representation: The text of the MacroToken element.
Reading: Reads the element into MacroToken when the record node exists.
Writing: Stores MacroToken when EndingType is letMacro (3).
Xtags
XML representation: The text of the Xtags element.
Reading: Reads the element into Xtags when the record node exists.
Writing: Stores Xtags when EndingType is letXtags (5).
XtagsDescription
XML representation: The text of the XtagsDescription element.
Reading: Reads the element into XtagsDescription when the record node exists.
Writing: Stores XtagsDescription when EndingType is letXtags (5).
@rec_type
XML representation: The rec_type attribute.
Writing: Stores the literal text “TLineEndingRec” whenever the writer reaches this field.
Nested records and repeated elements
Operation |
XML location |
When it is processed |
Read Formatting |
Formatting |
the record node exists; node2 exists |
Read Overriding |
Overriding |
the record node exists; node2 exists |
Write Formatting |
Formatting |
EndingType is letFormatting (4) |
Write Overriding |
Overriding |
Whenever this part of the routine is reached |
Initialization and reset values
This type has no separate initializer in the supplied code. Its starting values come from its enclosing object, inherited initialization, or existing state. Relevant enclosing initializers are identified below.
Enclosing initialization contexts
The following enclosing routines establish or override this record’s starting values. Follow the owner link for the complete initializer. Different enclosing objects can supply different defaults.
TLineEndingOptionsRec.Initialize is documented in TLineEndingOptionsRec.
Value namespaces used by this implementation
These are declared Pascal ordinal values. Use the ordinal only where the field serializer actually writes ord(...), an integer cast or an equivalent value. Set-marker strings and local option lists have their own representation; sentinel members in an enum are not automatically legal XML choices.
TLineEndingType
Ordinal |
Declared member |
0 |
letSoft |
1 |
letHard |
2 |
letTab |
3 |
letMacro |
4 |
letFormatting |
5 |
letXtags |
6 |
letNothing |
7 |
letNextBox |
8 |
letNextColumn |
9 |
letSkipLine |
Storage declarations relevant to interpretation
These are in-memory member and property types, not a list of mandatory XML children. They retain array bounds, fixed buffers and selector types. The field reference above defines what is actually serialized.
Name |
Declared type / bounds |
Kind |
EndingType |
TLineEndingType |
member |
MacroToken |
string |
member |
Xtags |
string |
member |
XtagsDescription |
string |
member |
Formatting |
TXtagsParagraphFormatting |
member |
Overriding |
TOverrideLineEndingText |
member |
The Implementation toggle contains only TLineEndingRec methods. Initializers and helpers belonging to other types are identified separately below. Shared XML-helper limitations are explained in Reading this reference.
Declaration reproduces this record’s complete declaration from the supplied source, including its fields, properties and method signatures.