Fixposition SDK 0.0.0-heads/main-0-g7b59b93
Collection of c++ libraries and apps for use with Fixposition products
Loading...
Searching...
No Matches
fpsdk::common::yaml Namespace Reference

YAML utilities. More...

Functions

bool StringToYaml (const std::string &yaml_str, YAML::Node &yaml_node)
 Parse YAML string.
 
std::string YamlToString (const YAML::Node &yaml_node)
 Stringify YAML node.
 
std::vector< std::string > GetKeysFromYaml (const YAML::Node &yaml_node, const std::string &key="")
 Get keys in YAML.
 

Detailed Description

YAML utilities.

Function Documentation

◆ StringToYaml()

bool fpsdk::common::yaml::StringToYaml ( const std::string & yaml_str,
YAML::Node & yaml_node )

Parse YAML string.

Parameters
[in]yaml_strThe YAML string
[out]yaml_nodeThe parsed YAML node
Returns
true if string was successfully parsed into a YAML node, false otherwise

◆ YamlToString()

std::string fpsdk::common::yaml::YamlToString ( const YAML::Node & yaml_node)

Stringify YAML node.

Parameters
[in]yaml_nodeThe YAML node to stringfy
Returns
a, possibly empty, stringification of the YAML node

◆ GetKeysFromYaml()

std::vector< std::string > fpsdk::common::yaml::GetKeysFromYaml ( const YAML::Node & yaml_node,
const std::string & key = "" )

Get keys in YAML.

For example, for the yaml node: key: foo: 1 bar:

  • 1
  • 2 baz: bla: 42

GetKeysFromYaml(node, "key") would return [ "bar", "baz", "foo" ].

Parameters
[in]yaml_nodeThe YAML node
[in]keyThe entry in the node to use, can be empty to use the node itself
Returns
an alphabetically ordered list of all keys found in the parameter space, resp. an empty list if the param is an empty map or not a map