diff --git a/.clang-format b/.clang-format
index d6e1b22..d6d46fb 100644
--- a/.clang-format
+++ b/.clang-format
@@ -30,7 +30,7 @@ PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: true
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
-Standard: Auto
+Standard: Cpp11
IndentWidth: 2
TabWidth: 8
UseTab: Never
diff --git a/.codedocs b/.codedocs
new file mode 100644
index 0000000..e03a28c
--- /dev/null
+++ b/.codedocs
@@ -0,0 +1,50 @@
+# CodeDocs.xyz Configuration File
+
+# Optional project name, if left empty the GitHub repository name will be used.
+PROJECT_NAME =
+
+# One or more directories and files that contain example code to be included.
+EXAMPLE_PATH =
+
+# One or more directories and files to exclude from documentation generation.
+# Use relative paths with respect to the repository root directory.
+EXCLUDE = test/gmock-1.7.0/
+
+# One or more wildcard patterns to exclude files and directories from document
+# generation.
+EXCLUDE_PATTERNS =
+
+# One or more symbols to exclude from document generation. Symbols can be
+# namespaces, classes, or functions.
+EXCLUDE_SYMBOLS =
+
+# Override the default parser (language) used for each file extension.
+EXTENSION_MAPPING =
+
+# Set the wildcard patterns used to filter out the source-files.
+# If left blank the default is:
+# *.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl,
+# *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php,
+# *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox, *.py,
+# *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
+FILE_PATTERNS =
+
+# Hide undocumented class members.
+HIDE_UNDOC_MEMBERS =
+
+# Hide undocumented classes.
+HIDE_UNDOC_CLASSES =
+
+# Specify a markdown page whose contents should be used as the main page
+# (index.html). This will override a page marked as \mainpage. For example, a
+# README.md file usually serves as a useful main page.
+USE_MDFILE_AS_MAINPAGE = README.md
+
+# Specify external repository to link documentation with.
+# This is similar to Doxygen's TAGFILES option, but will automatically link to
+# tags of other repositories already using CodeDocs. List each repository to
+# link with by giving its location in the form of owner/repository.
+# For example:
+# TAGLINKS = doxygen/doxygen CodeDocs/osg
+# Note: these repositories must already be built on CodeDocs.
+TAGLINKS =
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..d464896
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,23 @@
+language: c++
+os:
+ - linux
+ - osx
+compiler:
+ - clang
+ - gcc
+before_install:
+ - |
+ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
+ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y \
+ && sudo apt-get update -qq \
+ && if [ "$CXX" == "g++" ]; then
+ sudo apt-get install -qq g++-4.7 && export CXX="g++-4.7" CC="gcc-4.7"
+ fi
+ fi
+before_script:
+ - mkdir build
+ - cd build
+ - cmake ..
+script:
+ - make
+ - test/run-tests
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00626c7..acef57a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,7 @@ project(YAML_CPP)
set(YAML_CPP_VERSION_MAJOR "0")
set(YAML_CPP_VERSION_MINOR "5")
-set(YAML_CPP_VERSION_PATCH "2")
+set(YAML_CPP_VERSION_PATCH "3")
set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
enable_testing()
@@ -114,8 +114,6 @@ endif()
include_directories(${YAML_CPP_SOURCE_DIR}/src)
include_directories(${YAML_CPP_SOURCE_DIR}/include)
-find_package(Boost REQUIRED)
-include_directories(${Boost_INCLUDE_DIRS})
@@ -152,8 +150,8 @@ if(WIN32)
endif()
# GCC or Clang specialities
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
- "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
+ CMAKE_CXX_COMPILER_ID MATCHES "Clang")
### General stuff
if(WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX "") # DLLs do not have a "lib" prefix
@@ -173,13 +171,17 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
#
set(GCC_EXTRA_OPTIONS "")
#
+ if(BUILD_SHARED_LIBS)
+ set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} -fPIC")
+ endif()
+ #
set(FLAG_TESTED "-Wextra")
check_cxx_compiler_flag(${FLAG_TESTED} FLAG_WEXTRA)
if(FLAG_WEXTRA)
set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}")
endif()
#
- set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long ${yaml_cxx_flags}")
+ set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long -std=c++11 ${yaml_cxx_flags}")
### Make specific
if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake)
@@ -258,16 +260,16 @@ else()
set(_share_dir share)
endif()
-set(INCLUDE_INSTALL_ROOT_DIR include)
+set(INCLUDE_INSTALL_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/include)
set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_ROOT_DIR}/yaml-cpp)
set(LIB_INSTALL_DIR "${_library_dir}${LIB_SUFFIX}")
set(SHARE_INSTALL_DIR "${_share_dir}${LIB_SUFFIX}")
set(_INSTALL_DESTINATIONS
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
- ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
)
@@ -303,7 +305,7 @@ if(MSVC)
endif()
endif()
-install(TARGETS yaml-cpp ${_INSTALL_DESTINATIONS})
+install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS})
install(
DIRECTORY ${header_directory}
DESTINATION ${INCLUDE_INSTALL_DIR}
@@ -319,9 +321,27 @@ set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets")
set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
"${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" @ONLY)
+
+if(WIN32 AND NOT CYGWIN)
+ set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/CMake)
+else()
+ set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/yaml-cpp)
+endif()
+
+file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INCLUDE_INSTALL_ROOT_DIR}")
+set(CONFIG_INCLUDE_DIRS "\${YAML_CPP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY)
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" @ONLY)
+install(FILES
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+ DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
+install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR})
+
if(UNIX)
set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 41f50dc..cd09a1a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,9 +2,18 @@
This project is formatted with [clang-format][fmt] using the style file at the root of the repository. Please run clang-format before sending a pull request.
-In general, try to follow the style of surrounding code.
+In general, try to follow the style of surrounding code. We mostly follow the [Google C++ style guide][cpp-style].
+
+Commit messages should be in the imperative mood, as described in the [Git contributing file][git-contrib]:
+
+> Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
+> instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
+> to do frotz", as if you are giving orders to the codebase to change
+> its behaviour.
[fmt]: http://clang.llvm.org/docs/ClangFormat.html
+[cpp-style]: https://google.github.io/styleguide/cppguide.html
+[git-contrib]: http://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches?id=HEAD
# Tests
diff --git a/README.md b/README.md
index 1c0399e..c597667 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,9 @@
-# yaml-cpp
+# yaml-cpp [](https://travis-ci.org/jbeder/yaml-cpp) [](https://codedocs.xyz/jbeder/yaml-cpp/)
yaml-cpp is a [YAML](http://www.yaml.org/) parser and emitter in C++ matching the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html).
To get a feel for how it can be used, see the [Tutorial](https://github.com/jbeder/yaml-cpp/wiki/Tutorial) or [How to Emit YAML](https://github.com/jbeder/yaml-cpp/wiki/How-To-Emit-YAML). For the old API (version < 0.5.0), see [How To Parse A Document](https://github.com/jbeder/yaml-cpp/wiki/How-To-Parse-A-Document-(Old-API)).
-
# Problems? #
If you find a bug, post an [issue](https://github.com/jbeder/yaml-cpp/issues)! If you have questions about how to use yaml-cpp, please post it on http://stackoverflow.com and tag it `yaml-cpp`.
@@ -50,7 +49,7 @@ yaml-cpp uses [CMake](http://www.cmake.org) to support cross-platform building.
# Recent Release #
-[yaml-cpp 0.5.2](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.5.2) has been released! This is a bug fix release.
+[yaml-cpp 0.5.3](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.5.3) has been released! This is a bug fix release. It also will be the last release that uses Boost; futures releases will require C++11 instead.
[yaml-cpp 0.3.0](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.3.0) is still available if you want the old API.
diff --git a/include/yaml-cpp/contrib/anchordict.h b/include/yaml-cpp/contrib/anchordict.h
index b4677e2..78db9ec 100644
--- a/include/yaml-cpp/contrib/anchordict.h
+++ b/include/yaml-cpp/contrib/anchordict.h
@@ -12,11 +12,13 @@
#include "../anchor.h"
namespace YAML {
-/// AnchorDict
-/// . An object that stores and retrieves values correlating to anchor_t
-/// values.
-/// . Efficient implementation that can make assumptions about how anchor_t
-/// values are assigned by the Parser class.
+/**
+ * An object that stores and retrieves values correlating to {@link anchor_t}
+ * values.
+ *
+ *
Efficient implementation that can make assumptions about how
+ * {@code anchor_t} values are assigned by the {@link Parser} class.
+ */
template
class AnchorDict {
public:
diff --git a/include/yaml-cpp/dll.h b/include/yaml-cpp/dll.h
index 827e0f1..a32c06b 100644
--- a/include/yaml-cpp/dll.h
+++ b/include/yaml-cpp/dll.h
@@ -8,16 +8,12 @@
#endif
// The following ifdef block is the standard way of creating macros which make
-// exporting
-// from a DLL simpler. All files within this DLL are compiled with the
-// yaml_cpp_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any
-// project
-// that uses this DLL. This way any other project whose source files include
-// this file see
-// YAML_CPP_API functions as being imported from a DLL, whereas this DLL sees
-// symbols
-// defined with this macro as being exported.
+// exporting from a DLL simpler. All files within this DLL are compiled with the
+// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
+// be defined on any project that uses this DLL. This way any other project
+// whose source files include this file see YAML_CPP_API functions as being
+// imported from a DLL, whereas this DLL sees symbols defined with this macro as
+// being exported.
#undef YAML_CPP_API
#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
diff --git a/include/yaml-cpp/emitter.h b/include/yaml-cpp/emitter.h
index cc49659..5bffc25 100644
--- a/include/yaml-cpp/emitter.h
+++ b/include/yaml-cpp/emitter.h
@@ -122,7 +122,7 @@ class YAML_CPP_API Emitter : private noncopyable {
bool CanEmitNewline() const;
private:
- std::auto_ptr m_pState;
+ std::unique_ptr m_pState;
ostream_wrapper m_stream;
};
diff --git a/include/yaml-cpp/node/detail/impl.h b/include/yaml-cpp/node/detail/impl.h
index f6d218c..69f4476 100644
--- a/include/yaml-cpp/node/detail/impl.h
+++ b/include/yaml-cpp/node/detail/impl.h
@@ -9,7 +9,7 @@
#include "yaml-cpp/node/detail/node.h"
#include "yaml-cpp/node/detail/node_data.h"
-#include
+#include
namespace YAML {
namespace detail {
@@ -22,9 +22,9 @@ struct get_idx {
};
template
-struct get_idx<
- Key, typename boost::enable_if_c::value &&
- !boost::is_same::value>::type> {
+struct get_idx::value &&
+ !std::is_same::value>::type> {
static node* get(const std::vector& sequence, const Key& key,
shared_memory_holder /* pMemory */) {
return key < sequence.size() ? sequence[key] : 0;
@@ -41,7 +41,7 @@ struct get_idx<
};
template
-struct get_idx >::type> {
+struct get_idx::value>::type> {
static node* get(const std::vector& sequence, const Key& key,
shared_memory_holder pMemory) {
return key >= 0 ? get_idx::get(
diff --git a/include/yaml-cpp/node/detail/iterator.h b/include/yaml-cpp/node/detail/iterator.h
index 2c701af..cc5f9d3 100644
--- a/include/yaml-cpp/node/detail/iterator.h
+++ b/include/yaml-cpp/node/detail/iterator.h
@@ -10,45 +10,68 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/detail/node_iterator.h"
-#include
-#include
+#include
+#include
namespace YAML {
namespace detail {
struct iterator_value;
template
-class iterator_base
- : public boost::iterator_adaptor, node_iterator, V,
- std::forward_iterator_tag, V> {
+class iterator_base : public std::iterator {
+
private:
template
friend class iterator_base;
struct enabler {};
- typedef typename iterator_base::base_type base_type;
+ typedef node_iterator base_type;
+
+ struct proxy {
+ explicit proxy(const V& x) : m_ref(x) {}
+ V* operator->() { return std::addressof(m_ref); }
+ operator V*() { return std::addressof(m_ref); }
+
+ V m_ref;
+ };
public:
typedef typename iterator_base::value_type value_type;
public:
- iterator_base() {}
+ iterator_base() : m_iterator(), m_pMemory() {}
explicit iterator_base(base_type rhs, shared_memory_holder pMemory)
- : iterator_base::iterator_adaptor_(rhs), m_pMemory(pMemory) {}
+ : m_iterator(rhs), m_pMemory(pMemory) {}
template
iterator_base(const iterator_base& rhs,
- typename boost::enable_if,
- enabler>::type = enabler())
- : iterator_base::iterator_adaptor_(rhs.base()),
- m_pMemory(rhs.m_pMemory) {}
+ typename std::enable_if::value,
+ enabler>::type = enabler())
+ : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
- private:
- friend class boost::iterator_core_access;
+ iterator_base& operator++() {
+ ++m_iterator;
+ return *this;
+ }
- void increment() { this->base_reference() = boost::next(this->base()); }
+ iterator_base operator++(int) {
+ iterator_base iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
- value_type dereference() const {
- const typename base_type::value_type& v = *this->base();
+ template
+ bool operator==(const iterator_base& rhs) {
+ return m_iterator == rhs.m_iterator;
+ }
+
+ template
+ bool operator!=(const iterator_base& rhs) {
+ return m_iterator != rhs.m_iterator;
+ }
+
+ value_type operator*() const {
+ const typename base_type::value_type& v = *m_iterator;
if (v.pNode)
return value_type(Node(*v, m_pMemory));
if (v.first && v.second)
@@ -56,7 +79,10 @@ class iterator_base
return value_type();
}
+ proxy operator->() const { return proxy(**this); }
+
private:
+ base_type m_iterator;
shared_memory_holder m_pMemory;
};
}
diff --git a/include/yaml-cpp/node/detail/iterator_fwd.h b/include/yaml-cpp/node/detail/iterator_fwd.h
index c54a258..5f1ffe7 100644
--- a/include/yaml-cpp/node/detail/iterator_fwd.h
+++ b/include/yaml-cpp/node/detail/iterator_fwd.h
@@ -13,7 +13,6 @@
#include
namespace YAML {
-class node;
namespace detail {
struct iterator_value;
diff --git a/include/yaml-cpp/node/detail/node.h b/include/yaml-cpp/node/detail/node.h
index bbb497d..3154a52 100644
--- a/include/yaml-cpp/node/detail/node.h
+++ b/include/yaml-cpp/node/detail/node.h
@@ -13,13 +13,14 @@
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/detail/node_ref.h"
#include
-#include
namespace YAML {
namespace detail {
-class node : private boost::noncopyable {
+class node {
public:
node() : m_pRef(new node_ref) {}
+ node(const node&) = delete;
+ node& operator=(const node&) = delete;
bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
const node_ref* ref() const { return m_pRef.get(); }
@@ -65,9 +66,7 @@ class node : private boost::noncopyable {
m_pRef->set_data(*rhs.m_pRef);
}
- void set_mark(const Mark& mark) {
- m_pRef->set_mark(mark);
- }
+ void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
void set_type(NodeType::value type) {
if (type != NodeType::Undefined)
diff --git a/include/yaml-cpp/node/detail/node_data.h b/include/yaml-cpp/node/detail/node_data.h
index 6030867..64bbc05 100644
--- a/include/yaml-cpp/node/detail/node_data.h
+++ b/include/yaml-cpp/node/detail/node_data.h
@@ -7,8 +7,6 @@
#pragma once
#endif
-#include
-#include
#include
#include