test.cc
Go to the documentation of this file.00001 #include <fstream>
00002 #include <string>
00003 #include <iostream>
00004 #include "yaml.h"
00005
00006 using namespace std;
00007
00008 int main()
00009 {
00010 ifstream io("test.yaml");
00011 YAML::Parser parser(io);
00012
00013 YAML::Node doc;
00014 parser.GetNextDocument(doc);
00015
00016 const YAML::Node& things = doc["things"];
00017 string s;
00018 for (YAML::Iterator it = things.begin(); it != things.end(); ++it) {
00019 *it >> s;
00020 cout << "&&& " << s << " &&&" << endl;
00021 }
00022
00023 const YAML::Node& stuff = doc["stuff"];
00024 int a;
00025 for (YAML::Iterator it = stuff.begin(); it != stuff.end(); ++it) {
00026 *it >> a;
00027 cout << "%%% " << a << " %%%" << endl;
00028 }
00029
00030 const YAML::Node& desc = doc["desc"];
00031 string d;
00032 desc >> d;
00033 cout << "*** " << d << " ***" << endl;
00034
00035 parser.GetNextDocument(doc);
00036
00037 return 0;
00038 }