4

I could not find equivalent code for new YAMLcpp version p->GetNextDocument( n ).

perror
  • 7,071
  • 16
  • 58
  • 85
abcd7
  • 61
  • 2

2 Answers2

4

old API:

std::ifstream fin(config_file);
YAML::Parser parser(fin);
YAML::Node doc;
parser.GetNextDocument(doc);      

new API:

  std::ifstream fin(config_file);
  YAML::Node doc = YAML::Load(fin);
Vince
  • 3,979
  • 10
  • 41
  • 69
0

YAML::LoadAll or YAML::LoadAllFromFile

Jesse Beder
  • 33,081
  • 21
  • 109
  • 146
  • i would like to convert `YAML::Node doc;` `parser.GetNextDocument(doc);` into new API, error: no matching function for call to ` 'Load(const YAML::Node&)'` `const YAML::Node doc = YAML::Load(doc);` – abcd7 Aug 14 '15 at 09:09
  • @abcd7, you pass your input data (or a file stream) to `YAML::Load`, or a filename to `YAML::LoadFile`. – Jesse Beder Aug 14 '15 at 13:23