Skip to content

Kitto.Config.Reader ​

Base class for typed config readers. A config reader reads a subtree of the application configuration (a static YAML file, loaded once and cached on the app-global TKConfig.Instance singleton) ONCE into typed fields, so the runtime accesses values as, e.g., Config.Server.Port instead of repeated Config.GetInteger('Server/Port') tree lookups. The same class carries the [YamlNode]/[YamlSubNode] attributes that KIDE reads via RTTI to drive the Config editor.

Lifecycle: the reader instance is STABLE for the life of TKConfig. On a forced config reload (TKConfig.InvalidateConfig, typically for debugging) the instance is not recreated — Refresh re-reads the fields in place, so any code holding a reference (e.g. a cached Config.Server) keeps working.

Reading is nil-safe: a reader bound to a missing node (ANode = nil) returns the declared defaults, so a subtree absent from the YAML needs no special handling and no placeholder nodes are created in the tree.

TKConfigReader class ​

pascal
constructor Create(const ANode: TEFTree);

Binds the reader to ANode and reads all fields once.

pascal
procedure Refresh(const ANode: TEFTree);

Re-binds to ANode and re-reads all fields IN PLACE (keeps the instance stable across a forced config reload).

Released under Apache License, Version 2.0.