|
template<typename Serializable > |
static Serializable | LoadYamlFile (const std::string &filename, const std::optional< std::string > &child_name=std::nullopt, const std::optional< Serializable > &defaults=std::nullopt, const std::optional< LoadYamlOptions > &options=std::nullopt) |
| Loads data from a YAML-formatted file. More...
|
|
template<typename Serializable > |
static Serializable | LoadYamlString (const std::string &data, const std::optional< std::string > &child_name=std::nullopt, const std::optional< Serializable > &defaults=std::nullopt, const std::optional< LoadYamlOptions > &options=std::nullopt) |
| Loads data from a YAML-formatted string. More...
|
|
template<typename Serializable > |
void | SaveYamlFile (const std::string &filename, const Serializable &data, const std::optional< std::string > &child_name=std::nullopt, const std::optional< Serializable > &defaults=std::nullopt) |
| Saves data as a YAML-formatted file. More...
|
|
template<typename Serializable > |
std::string | SaveYamlString (const Serializable &data, const std::optional< std::string > &child_name=std::nullopt, const std::optional< Serializable > &defaults=std::nullopt) |
| Saves data as a YAML-formatted string. More...
|
|
template<typename Serializable > |
void | SaveJsonFile (const std::string &filename, const Serializable &data) |
| Saves data as a JSON-formatted file. More...
|
|
template<typename Serializable > |
std::string | SaveJsonString (const Serializable &data) |
| Saves data as a JSON-formatted string. More...
|
|
void SaveYamlFile |
( |
const std::string & |
filename, |
|
|
const Serializable & |
data, |
|
|
const std::optional< std::string > & |
child_name = std::nullopt , |
|
|
const std::optional< Serializable > & |
defaults = std::nullopt |
|
) |
| |
Saves data as a YAML-formatted file.
Refer to YAML Serialization for background.
The YAML will consist of a single document with a mapping node at the root. If a child_name
is not provided (the default), then the serialized data will appear directly within that top-level mapping node. If a child_name
is provided, then the top-level mapping node will contain only one entry, whose key is child_name
and value is the serialized data
.
- Parameters
-
filename | Filename to be written to. |
data | User data to be serialized. |
child_name | (optional) If provided, the YAML document will be {child_name: { data }} rather than just { data } . |
defaults | (optional) If provided, then only data that differs from the given defaults will be serialized. |
- Template Parameters
-
Serializable | must implement a Serialize function. |
std::string SaveYamlString |
( |
const Serializable & |
data, |
|
|
const std::optional< std::string > & |
child_name = std::nullopt , |
|
|
const std::optional< Serializable > & |
defaults = std::nullopt |
|
) |
| |
Saves data as a YAML-formatted string.
Refer to YAML Serialization for background.
The YAML will consist of a single document with a mapping node at the root. If a child_name
is not provided (the default), then the serialized data will appear directly within that top-level mapping node. If a child_name
is provided, then the top-level mapping node will contain only one entry, whose key is child_name
and value is the serialized data
.
- Parameters
-
data | User data to be serialized. |
child_name | (optional) If provided, the YAML document will be {child_name: { data }} rather than just { data } . |
defaults | (optional) If provided, then only data that differs from the given defaults will be serialized. |
- Returns
- the YAML document as a string.
- Template Parameters
-
Serializable | must implement a Serialize function. |