yaml-cpp/yaml-reader/main.cpp

42 lines
728 B
C++
Raw Normal View History

#include "yaml.h"
#include "tests.h"
2008-06-30 10:51:22 +04:00
#include <fstream>
#include <iostream>
2008-06-26 02:45:08 +04:00
#ifdef _DEBUG
#pragma comment(lib, "yamlcppd.lib")
#else
#pragma comment(lib, "yamlcpp.lib")
#endif
void run()
2008-07-02 09:00:32 +04:00
{
std::ifstream fin("yaml-reader/tests/test.yaml");
try {
YAML::Parser parser(fin);
if(!parser)
return;
YAML::Node doc;
parser.GetNextDocument(doc);
for(YAML::Iterator it=doc.begin();it!=doc.end();++it) {
std::string item;
*it >> item;
std::cout << item << "\n";
}
} catch(YAML::Exception&) {
std::cout << "Error parsing the yaml!\n";
2008-07-02 09:00:32 +04:00
}
}
2008-06-26 02:45:08 +04:00
int main()
{
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
Test::RunAll();
run();
getchar();
2008-06-26 02:45:08 +04:00
return 0;
}