|
Entropic 2.11.1
Local-first agentic inference engine
|
ryml extraction helpers for config parsing. More...
#include <ryml.hpp>#include <c4/std/string.hpp>#include <filesystem>#include <optional>#include <string>#include <unordered_map>#include <vector>

Go to the source code of this file.
Namespaces | |
| namespace | entropic |
| Activate model on GPU (WARM → ACTIVE). | |
Functions | |
| bool | entropic::config::extract (ryml::ConstNodeRef node, c4::csubstr key, std::string &out) |
| Extract a string value from a YAML node. | |
| bool | entropic::config::extract (ryml::ConstNodeRef node, c4::csubstr key, int &out) |
| Extract an int value from a YAML node. | |
| bool | entropic::config::extract (ryml::ConstNodeRef node, c4::csubstr key, float &out) |
| Extract a float value from a YAML node. | |
| bool | entropic::config::extract (ryml::ConstNodeRef node, c4::csubstr key, double &out) |
| Extract a double value from a YAML node. | |
| bool | entropic::config::extract (ryml::ConstNodeRef node, c4::csubstr key, bool &out) |
| Extract a bool value from a YAML node. | |
| bool | entropic::config::extract_path (ryml::ConstNodeRef node, c4::csubstr key, std::filesystem::path &out) |
| Extract a filesystem path with ~ expansion. | |
| bool | entropic::config::extract_tri_state_path (ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::filesystem::path > &out, bool &disabled) |
| Extract a tri-state path (null = default, false = disabled, string = path). | |
| bool | entropic::config::extract_inline_content (ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::string > &out) |
| Extract inline text from an object-form value (gh#141). | |
| bool | entropic::config::extract_string_list (ryml::ConstNodeRef node, c4::csubstr key, std::vector< std::string > &out) |
| Extract a vector of strings from a YAML sequence node. | |
| bool | entropic::config::extract_string_list_opt (ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::vector< std::string > > &out) |
| Extract an optional vector of strings. | |
| bool | entropic::config::extract_string_map (ryml::ConstNodeRef node, c4::csubstr key, std::unordered_map< std::string, std::string > &out) |
| Extract a map of string to string from a YAML mapping node. | |
| bool | entropic::config::extract_string_list_map (ryml::ConstNodeRef node, c4::csubstr key, std::unordered_map< std::string, std::vector< std::string > > &out) |
| Extract a map of string to list of strings from a YAML mapping. | |
| std::filesystem::path | entropic::config::expand_home (const std::filesystem::path &p) |
| Expand ~ to home directory in a path. | |
| std::string | entropic::config::to_string (c4::csubstr s) |
| Convert ryml csubstr to std::string. | |
| std::string | entropic::config::read_file (const std::filesystem::path &path) |
| Read a file into a string. | |
ryml extraction helpers for config parsing.
Wraps ryml's tree API with type-safe extraction functions that provide clear error messages for type mismatches. Each function returns true if the key was found and extracted, false if absent. The output parameter is unchanged when the key is absent.
@dg_internal Implementation detail of librentropic-config. Not a public header.
Definition in file yaml_util.h.
| std::filesystem::path entropic::config::expand_home | ( | const std::filesystem::path & | p | ) |
Expand ~ to home directory in a path.
| p | Input path (may start with ~). |
| p | Input path (may start with ~). |
Definition at line 61 of file yaml_util.cpp.
| bool entropic::config::extract | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| bool & | out | ||
| ) |
Extract a bool value from a YAML node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output bool. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output bool. Unchanged if key is absent. |
Definition at line 176 of file yaml_util.cpp.
| bool entropic::config::extract | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| double & | out | ||
| ) |
Extract a double value from a YAML node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output double. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output double. Unchanged if key is absent. |
Definition at line 153 of file yaml_util.cpp.
| bool entropic::config::extract | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| float & | out | ||
| ) |
Extract a float value from a YAML node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output float. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output float. Unchanged if key is absent. |
Definition at line 130 of file yaml_util.cpp.
| bool entropic::config::extract | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| int & | out | ||
| ) |
Extract an int value from a YAML node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output int. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output int. Unchanged if key is absent. |
Definition at line 107 of file yaml_util.cpp.
| bool entropic::config::extract | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::string & | out | ||
| ) |
Extract a string value from a YAML node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output string. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output string. Unchanged if key is absent. |
Definition at line 85 of file yaml_util.cpp.
| bool entropic::config::extract_inline_content | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::optional< std::string > & | out | ||
| ) |
Extract inline text from an object-form value (gh#141).
Deliberately narrow: it matches ONLY a map carrying a content child, and returns false for everything else. A wider match would change the meaning of existing configs, and app_context has three established spellings (path string, true, false) that all had to keep working.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Receives the content when the object form matched. |
Recognises key: { content: "..." } and yields the content. Any other shape — a scalar, a sequence, or a map without content — is left alone and reported as not-found, so the caller can fall through to its existing parse and every pre-gh#141 spelling keeps its meaning.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Receives the content. Untouched unless the object form matched. |
Definition at line 257 of file yaml_util.cpp.
| bool entropic::config::extract_path | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::filesystem::path & | out | ||
| ) |
Extract a filesystem path with ~ expansion.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output path with ~ expanded. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output path with ~ expanded. Unchanged if key is absent. |
Definition at line 202 of file yaml_util.cpp.
| bool entropic::config::extract_string_list | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::vector< std::string > & | out | ||
| ) |
Extract a vector of strings from a YAML sequence node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output vector. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output vector. Unchanged if key is absent. |
Definition at line 283 of file yaml_util.cpp.
| bool entropic::config::extract_string_list_map | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::unordered_map< std::string, std::vector< std::string > > & | out | ||
| ) |
Extract a map of string to list of strings from a YAML mapping.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output map. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output map. Unchanged if key is absent. |
Definition at line 364 of file yaml_util.cpp.
| bool entropic::config::extract_string_list_opt | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::optional< std::vector< std::string > > & | out | ||
| ) |
Extract an optional vector of strings.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output optional vector. |
If key absent: out unchanged (remains nullopt). If key present with sequence: out = vector of strings. If key present with null: out = nullopt.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output optional vector. |
Definition at line 309 of file yaml_util.cpp.
| bool entropic::config::extract_string_map | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::unordered_map< std::string, std::string > & | out | ||
| ) |
Extract a map of string to string from a YAML mapping node.
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output map. Unchanged if key is absent. |
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output map. Unchanged if key is absent. |
Definition at line 338 of file yaml_util.cpp.
| bool entropic::config::extract_tri_state_path | ( | ryml::ConstNodeRef | node, |
| c4::csubstr | key, | ||
| std::optional< std::filesystem::path > & | out, | ||
| bool & | disabled | ||
| ) |
Extract a tri-state path (null = default, false = disabled, string = path).
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output path. nullopt if absent/null/false. |
| [out] | disabled | Set to true if value is explicitly false. |
Maps to Python's TriStatePath: None | False | Path. YAML values: absent/null = default (out=nullopt, disabled=false), false = disabled (out=nullopt, disabled=true), string = custom path (out=expanded path, disabled=false).
| node | The ryml node to extract from. | |
| key | The key to look up. | |
| [out] | out | Output path. nullopt if absent/null/false. |
| [out] | disabled | Set to true if value is explicitly false. |
Definition at line 223 of file yaml_util.cpp.
| std::string entropic::config::read_file | ( | const std::filesystem::path & | path | ) |
Read a file into a string.
| path | File path. |
| path | File path. |
Definition at line 39 of file yaml_util.cpp.
| std::string entropic::config::to_string | ( | c4::csubstr | s | ) |
Convert ryml csubstr to std::string.
| s | ryml substring. |
| s | ryml substring. |
Definition at line 27 of file yaml_util.cpp.