EF.YAML
Simple YAML reader and writer providing persistence for EF trees.
TEFYAMLParser class
A parser for yaml data streams.
procedure AfterConstruction;Creates the internal indent and annotation lists and resets the parser.
destructor Destroy;Frees the internal indent and annotation lists.
procedure Reset;Resets the parser, maeking it ready for parsing a new data stream.
function ParseLine(const ALine: string;Parses a yaml line and returns name and value. Also sets the LastValueType and LastIndentIncrement properties.
property LastValueType: TEFYAMLValueType read FLastValueType;Reports the type (not the data type) of the last parsed value, which may be a single-line or multi-line (two kinds) value.
property LastIndentIncrement: Integer read FLastIndentIncrement;Reports the indent increment of the last parsed line.
property LastAnnotations: TStrings read FLastAnnotations;Contains all the annotations read since last reset. The caller is responsible for resetting this list at appropriate times.
property LastValueQuoted: Boolean read FLastValueQuoted;Returns true if the last read value was quoted. Single-line values are unquoted when reading; querying this property allows to find out if a value was originally quoted (for example, to make sure it is quoted back when writing) or not.
TEFYAMLReader class
Reads yaml data from files or streams and constructs tree objects.
class constructor Create;Class constructor that initializes the default format settings shared by all readers.
destructor Destroy;Frees the internal parser.
property Parser: TEFYAMLParser read GetParser;The underlying line parser, created on first access.
procedure LoadTreeFromFile(const ATree: TEFTree;Loads YAML from the specified file into ATree, replacing its current children.
procedure LoadTreeFromStream(const ATree: TEFTree;Loads YAML read from AStream into ATree, replacing its current children.
procedure LoadTreeFromString(const ATree: TEFTree;Loads YAML contained in AString into ATree, replacing its current children.
class function LoadTree(const AFileName: string): TEFTree;Creates a new tree and loads it from the specified YAML file.
class function LoadTreeFromString(const AString: string): TEFTree;Creates a new tree and loads it from the specified YAML string.
class procedure LoadTree(const ATree: TEFTree;Loads the specified YAML file into the given tree, using a temporary reader instance.
class procedure ReadTree(const ATree: TEFTree;Loads the specified YAML string into the given tree, using a temporary reader instance.
TEFYAMLWriter class
Writes a tree to a yaml file or stream.
procedure AfterConstruction;Initializes the default indentation (2 chars) and value spacing (1 char).
procedure SaveTreeToFile(const ATree: TEFTree;Writes ATree as YAML to the specified file, creating the target directory if needed.
procedure SaveTreeToStream(const ATree: TEFTree;Writes ATree as YAML (UTF-8) to the specified stream.
class procedure SaveTree(const ATree: TEFTree;Writes ATree as YAML to the specified file, using a temporary writer instance.
class function TreeAsString(const ATree: TEFTree): string;Returns ATree serialized as a YAML string (without the encoding preamble).
TEFTreeHelper class
Class helper that adds YAML load/save convenience methods to TEFTree.
function LoadFromYamlFile(const AFileName: string): TEFTree;Loads this tree from the specified YAML file and returns Self.
function SaveToYamlFile(const AFileName: string): TEFTree;Saves this tree to the specified YAML file and returns Self.
property AsYamlString: string read GetAsYamlString write SetAsYamlString;The tree serialized as / deserialized from a YAML string.
