mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Split the yaml.h file into new/old API, which we'll then copy to yaml.h at build time (so the right one gets installed)
This commit is contained in:
@@ -79,10 +79,22 @@ if(YAML_CPP_BUILD_OLD_API)
|
||||
list(APPEND public_headers ${common_public_headers} ${old_api_public_headers})
|
||||
list(APPEND private_headers ${common_private_headers} ${old_api_private_headers})
|
||||
add_definitions(-DYAML_CPP_OLD_API)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml.h
|
||||
COMMAND ${CMAKE_COMMAND} copy ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml-old-api.h ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml.h
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml-old-api.h
|
||||
)
|
||||
else()
|
||||
list(APPEND sources ${common_sources} ${new_api_sources})
|
||||
list(APPEND public_headers ${common_public_headers} ${new_api_public_headers})
|
||||
list(APPEND private_headers ${common_private_headers} ${new_api_private_headers})
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml.h
|
||||
COMMAND ${CMAKE_COMMAND} copy ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml-new-api.h ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml.h
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/yaml-cpp/yaml-new-api.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(YAML_CPP_BUILD_CONTRIB)
|
||||
|
@@ -16,9 +16,7 @@ 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
|
||||
YAML_CPP_API bool IsNull(const Node& node); // old API only
|
||||
|
||||
extern YAML_CPP_API _Null Null;
|
||||
}
|
||||
|
@@ -32,9 +32,7 @@ namespace YAML
|
||||
void Load(std::istream& in);
|
||||
bool HandleNextDocument(EventHandler& eventHandler);
|
||||
|
||||
#if YAML_CPP_OLD_API
|
||||
bool GetNextDocument(Node& document);
|
||||
#endif
|
||||
bool GetNextDocument(Node& document); // old API only
|
||||
|
||||
void PrintTokens(std::ostream& out);
|
||||
|
||||
|
@@ -11,14 +11,6 @@
|
||||
#include "yaml-cpp/stlemitter.h"
|
||||
#include "yaml-cpp/exceptions.h"
|
||||
|
||||
#ifdef YAML_CPP_OLD_API
|
||||
|
||||
#include "yaml-cpp/old-api/node.h"
|
||||
#include "yaml-cpp/old-api/stlnode.h"
|
||||
#include "yaml-cpp/old-api/iterator.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "yaml-cpp/node/node.h"
|
||||
#include "yaml-cpp/node/impl.h"
|
||||
#include "yaml-cpp/node/convert.h"
|
||||
@@ -27,6 +19,4 @@
|
||||
#include "yaml-cpp/node/parse.h"
|
||||
#include "yaml-cpp/node/emit.h"
|
||||
|
||||
#endif // YAML_CPP_OLD_API
|
||||
|
||||
#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
18
include/yaml-cpp/yaml-old-api.h
Normal file
18
include/yaml-cpp/yaml-old-api.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define YAML_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/parser.h"
|
||||
#include "yaml-cpp/emitter.h"
|
||||
#include "yaml-cpp/stlemitter.h"
|
||||
#include "yaml-cpp/exceptions.h"
|
||||
|
||||
#include "yaml-cpp/old-api/node.h"
|
||||
#include "yaml-cpp/old-api/stlnode.h"
|
||||
#include "yaml-cpp/old-api/iterator.h"
|
||||
|
||||
#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
Reference in New Issue
Block a user