rapidyaml  0.8.0
parse and emit YAML, and do it fast
c4::yml::ReferenceResolver Struct Reference

Reusable object to resolve references/aliases in the tree. More...

#include <reference_resolver.hpp>

Public Member Functions

 ReferenceResolver ()=default
 
void resolve (Tree *t_)
 Resolve references: for each reference, look for a matching anchor, and copy its contents to the ref node. More...
 

Detailed Description

Reusable object to resolve references/aliases in the tree.

Definition at line 16 of file reference_resolver.hpp.

Constructor & Destructor Documentation

◆ ReferenceResolver()

c4::yml::ReferenceResolver::ReferenceResolver ( )
default

Member Function Documentation

◆ resolve()

void c4::yml::ReferenceResolver::resolve ( Tree t_)

Resolve references: for each reference, look for a matching anchor, and copy its contents to the ref node.

This method first does a full traversal of the tree to gather all anchors and references in a separate collection, then it goes through that collection to locate the names, which it does by obeying the YAML standard diktat that "an alias node refers to the most recent node in the serialization having the specified anchor"

So, depending on the number of anchor/alias nodes, this is a potentially expensive operation, with a best-case linear complexity (from the initial traversal).


The documentation for this struct was generated from the following file: