You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::fstream config_file("config.yaml", std::ios::in | std::ios::out);
YAML::Node config_node = YAML::Load(config_file);
config_file.close();
// For example parse over the config, confirm it's correct, maybe correct mistakes, update the config to a new version, etc...
std::fstream config_file_write("config.yaml", std::ios::out | std::ios::trunc);
YAML::Emitter emitter;
emitter << config_node;
config_file_write << emitter.c_str();
Now maybe the user has written some comments in the config file to remind themselves why they set an option to that value. If the config is for example loaded through a GUI and modified or the config is loaded by the application and modified any way and then the config is saved again, the user's comments are lost.
Is there any way to preserve the comments when emitting the original parsed object?
The text was updated successfully, but these errors were encountered:
tambry
changed the title
Preserve comments through parsing emitting
Preserve comments after parsing and re-emit them
Jun 22, 2017
For example I have the following code:
Now maybe the user has written some comments in the config file to remind themselves why they set an option to that value. If the config is for example loaded through a GUI and modified or the config is loaded by the application and modified any way and then the config is saved again, the user's comments are lost.
Is there any way to preserve the comments when emitting the original parsed object?
The text was updated successfully, but these errors were encountered: