Commit 90f48fd0 authored by beder's avatar beder
Browse files

Began new-api branch, and removed all traces of the old api from this branch

parent 9403ac04
#ifndef NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "yaml-cpp/noncopyable.h"
#include "ptr_vector.h"
#include <set>
namespace YAML
{
class Node;
class NodeOwnership: private noncopyable
{
public:
explicit NodeOwnership(NodeOwnership *pOwner = 0);
~NodeOwnership();
Node& Create() { return m_pOwner->_Create(); }
void MarkAsAliased(const Node& node) { m_pOwner->_MarkAsAliased(node); }
bool IsAliased(const Node& node) const { return m_pOwner->_IsAliased(node); }
private:
Node& _Create();
void _MarkAsAliased(const Node& node);
bool _IsAliased(const Node& node) const;
private:
ptr_vector<Node> m_nodes;
std::set<const Node *> m_aliasedNodes;
NodeOwnership *m_pOwner;
};
}
#endif // NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
......@@ -9,11 +9,6 @@
#include <sstream>
#include <cstdio>
#ifdef YAML_CPP_OLD_API
#include "yaml-cpp/old-api/node.h"
#include "old-api/nodebuilder.h"
#endif
namespace YAML
{
Parser::Parser()
......@@ -58,17 +53,6 @@ namespace YAML
return true;
}
#ifdef YAML_CPP_OLD_API
// GetNextDocument
// . Reads the next document in the queue (of tokens).
// . Throws a ParserException on error.
bool Parser::GetNextDocument(Node& document)
{
NodeBuilder builder(document);
return HandleNextDocument(builder);
}
#endif
// ParseDirectives
// . Reads any directives that are next in the queue.
void Parser::ParseDirectives()
......
file(GLOB test_headers [a-z]*.h)
file(GLOB test_sources [a-z]*.cpp)
file(GLOB test_old_api_sources old-api/[a-z]*.cpp)
file(GLOB test_new_api_sources new-api/[a-z]*.cpp)
if(YAML_CPP_BUILD_OLD_API)
list(APPEND test_sources ${test_old_api_sources})
else()
list(APPEND test_sources ${test_new_api_sources})
endif()
list(APPEND test_sources ${test_new_api_sources})
include_directories(${YAML_CPP_SOURCE_DIR}/test)
......
......@@ -1008,15 +1008,7 @@ namespace Test
if(output == desiredOutput) {
try {
#ifdef YAML_CPP_OLD_API
std::stringstream stream(output);
YAML::Parser parser;
YAML::Node node;
parser.GetNextDocument(node);
#else
YAML::Node node = YAML::Load(output);
#endif
passed++;
} catch(const YAML::Exception& e) {
std::cout << "Emitter test failed: " << name << "\n";
......
This diff is collapsed.
This diff is collapsed.
......@@ -23,10 +23,8 @@ namespace Test
if(!RunSpecTests())
passed = false;
#ifndef YAML_CPP_OLD_API
if(!RunNodeTests())
passed = false;
#endif
if(passed)
std::cout << "All tests passed!\n";
......
......@@ -37,18 +37,8 @@ public:
void parse(std::istream& input)
{
try {
#ifdef YAML_CPP_OLD_API
YAML::Parser parser(input);
YAML::Node doc;
while(parser.GetNextDocument(doc)) {
YAML::Emitter emitter;
emitter << doc;
std::cout << emitter.c_str() << "\n";
}
#else
YAML::Node doc = YAML::Load(input);
std::cout << doc << "\n";
#endif
} catch(const YAML::Exception& e) {
std::cerr << e.what() << "\n";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment