From 80cf3c98db37754f5ac2c0bf9fe94288eb02b573 Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Sat, 10 Sep 2011 22:59:27 -0500 Subject: [PATCH] Fixed minor things that used the old API, compiles/links/runs\! --- include/yaml-cpp/null.h | 2 ++ src/null.cpp | 5 +++++ test/new-api/parsertests.cpp | 1 + util/parse.cpp | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/yaml-cpp/null.h b/include/yaml-cpp/null.h index c3450ee..63b897b 100644 --- a/include/yaml-cpp/null.h +++ b/include/yaml-cpp/null.h @@ -16,7 +16,9 @@ namespace YAML inline bool operator == (const _Null&, const _Null&) { return true; } inline bool operator != (const _Null&, const _Null&) { return false; } +#if YAML_CPP_OLD_API YAML_CPP_API bool IsNull(const Node& node); +#endif extern YAML_CPP_API _Null Null; } diff --git a/src/null.cpp b/src/null.cpp index 08fa9aa..9e03af0 100644 --- a/src/null.cpp +++ b/src/null.cpp @@ -1,12 +1,17 @@ #include "yaml-cpp/null.h" + +#if YAML_CPP_OLD_API #include "yaml-cpp/node.h" +#endif namespace YAML { _Null Null; +#if YAML_CPP_OLD_API bool IsNull(const Node& node) { return node.Read(Null); } +#endif } diff --git a/test/new-api/parsertests.cpp b/test/new-api/parsertests.cpp index c21207e..1d50ca6 100644 --- a/test/new-api/parsertests.cpp +++ b/test/new-api/parsertests.cpp @@ -3,5 +3,6 @@ namespace Test { bool RunParserTests() { + return true; } } diff --git a/util/parse.cpp b/util/parse.cpp index 499dab9..c4e82e8 100644 --- a/util/parse.cpp +++ b/util/parse.cpp @@ -37,14 +37,17 @@ public: void parse(std::istream& input) { try { +#if YAML_CPP_OLD_API YAML::Parser parser(input); YAML::Node doc; - NullEventHandler handler; while(parser.GetNextDocument(doc)) { YAML::Emitter emitter; emitter << doc; std::cout << emitter.c_str() << "\n"; } +#else + // TODO: Parse with new API +#endif } catch(const YAML::Exception& e) { std::cerr << e.what() << "\n"; }