Skip to content

EF.YAML ​

Simple YAML reader and writer providing persistence for EF trees.

TEFYAMLParser class ​

A parser for yaml data streams.

pascal
procedure AfterConstruction;

Creates the internal indent and annotation lists and resets the parser.

pascal
destructor Destroy;

Frees the internal indent and annotation lists.

pascal
procedure Reset;

Resets the parser, maeking it ready for parsing a new data stream.

pascal
function ParseLine(const ALine: string;

Parses a yaml line and returns name and value. Also sets the LastValueType and LastIndentIncrement properties.

pascal
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.

pascal
property LastIndentIncrement: Integer read FLastIndentIncrement;

Reports the indent increment of the last parsed line.

pascal
property LastAnnotations: TStrings read FLastAnnotations;

Contains all the annotations read since last reset. The caller is responsible for resetting this list at appropriate times.

pascal
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.

pascal
class constructor Create;

Class constructor that initializes the default format settings shared by all readers.

pascal
destructor Destroy;

Frees the internal parser.

pascal
property Parser: TEFYAMLParser read GetParser;

The underlying line parser, created on first access.

pascal
procedure LoadTreeFromFile(const ATree: TEFTree;

Loads YAML from the specified file into ATree, replacing its current children.

pascal
procedure LoadTreeFromStream(const ATree: TEFTree;

Loads YAML read from AStream into ATree, replacing its current children.

pascal
procedure LoadTreeFromString(const ATree: TEFTree;

Loads YAML contained in AString into ATree, replacing its current children.

pascal
class function LoadTree(const AFileName: string): TEFTree;

Creates a new tree and loads it from the specified YAML file.

pascal
class function LoadTreeFromString(const AString: string): TEFTree;

Creates a new tree and loads it from the specified YAML string.

pascal
class procedure LoadTree(const ATree: TEFTree;

Loads the specified YAML file into the given tree, using a temporary reader instance.

pascal
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.

pascal
procedure AfterConstruction;

Initializes the default indentation (2 chars) and value spacing (1 char).

pascal
procedure SaveTreeToFile(const ATree: TEFTree;

Writes ATree as YAML to the specified file, creating the target directory if needed.

pascal
procedure SaveTreeToStream(const ATree: TEFTree;

Writes ATree as YAML (UTF-8) to the specified stream.

pascal
class procedure SaveTree(const ATree: TEFTree;

Writes ATree as YAML to the specified file, using a temporary writer instance.

pascal
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.

pascal
function LoadFromYamlFile(const AFileName: string): TEFTree;

Loads this tree from the specified YAML file and returns Self.

pascal
function SaveToYamlFile(const AFileName: string): TEFTree;

Saves this tree to the specified YAML file and returns Self.

pascal
property AsYamlString: string read GetAsYamlString write SetAsYamlString;

The tree serialized as / deserialized from a YAML string.

Released under Apache License, Version 2.0.