mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Compare commits
18 Commits
release-0.
...
release-0.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
976e8b184c | ||
![]() |
c1d75dd4f7 | ||
![]() |
dd1eb715c4 | ||
![]() |
fadca5a89d | ||
![]() |
7e129c9b64 | ||
![]() |
3e94c0a037 | ||
![]() |
8ba5e3fbf6 | ||
![]() |
857c7d93a0 | ||
![]() |
b690648308 | ||
![]() |
d904b600a9 | ||
![]() |
bacb74e8ec | ||
![]() |
b1ac3289b8 | ||
![]() |
835b86d9f7 | ||
![]() |
94dc63af04 | ||
![]() |
50474b6b9f | ||
![]() |
4c3926a5c7 | ||
![]() |
9fbcfe9ec5 | ||
![]() |
d98687afc3 |
4
.hgeol
Normal file
4
.hgeol
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
**.h = native
|
||||||
|
**.c = native
|
||||||
|
**.cpp = native
|
||||||
|
**.txt = native
|
@@ -23,7 +23,7 @@ project(YAML_CPP)
|
|||||||
|
|
||||||
set(YAML_CPP_VERSION_MAJOR "0")
|
set(YAML_CPP_VERSION_MAJOR "0")
|
||||||
set(YAML_CPP_VERSION_MINOR "2")
|
set(YAML_CPP_VERSION_MINOR "2")
|
||||||
set(YAML_CPP_VERSION_PATCH "5")
|
set(YAML_CPP_VERSION_PATCH "7")
|
||||||
set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
|
set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
@@ -209,7 +209,9 @@ else()
|
|||||||
set(_library_dir lib)
|
set(_library_dir lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(INCLUDE_INSTALL_DIR include/yaml-cpp)
|
set(INCLUDE_INSTALL_ROOT_DIR include)
|
||||||
|
|
||||||
|
set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_ROOT_DIR}/yaml-cpp)
|
||||||
set(LIB_INSTALL_DIR "${_library_dir}${LIB_SUFFIX}")
|
set(LIB_INSTALL_DIR "${_library_dir}${LIB_SUFFIX}")
|
||||||
|
|
||||||
set(_INSTALL_DESTINATIONS
|
set(_INSTALL_DESTINATIONS
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "yaml-cpp/null.h"
|
#include "yaml-cpp/null.h"
|
||||||
#include "yaml-cpp/traits.h"
|
#include "yaml-cpp/traits.h"
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@@ -21,12 +22,43 @@ namespace YAML
|
|||||||
YAML_CPP_API bool Convert(const std::string& input, bool& output);
|
YAML_CPP_API bool Convert(const std::string& input, bool& output);
|
||||||
YAML_CPP_API bool Convert(const std::string& input, _Null& output);
|
YAML_CPP_API bool Convert(const std::string& input, _Null& output);
|
||||||
|
|
||||||
|
inline bool IsInfinity(const std::string& input) {
|
||||||
|
return input == ".inf" || input == ".Inf" || input == ".INF" || input == "+.inf" || input == "+.Inf" || input == "+.INF";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsNegativeInfinity(const std::string& input) {
|
||||||
|
return input == "-.inf" || input == "-.Inf" || input == "-.INF";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsNaN(const std::string& input) {
|
||||||
|
return input == ".nan" || input == ".NaN" || input == ".NAN";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
|
inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
|
||||||
std::stringstream stream(input);
|
std::stringstream stream(input);
|
||||||
stream.unsetf(std::ios::dec);
|
stream.unsetf(std::ios::dec);
|
||||||
stream >> output;
|
stream >> output;
|
||||||
return !!stream;
|
if(!!stream)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(std::numeric_limits<T>::has_infinity) {
|
||||||
|
if(IsInfinity(input)) {
|
||||||
|
output = std::numeric_limits<T>::infinity();
|
||||||
|
return true;
|
||||||
|
} else if(IsNegativeInfinity(input)) {
|
||||||
|
output = -std::numeric_limits<T>::infinity();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(std::numeric_limits<T>::has_quiet_NaN && IsNaN(input)) {
|
||||||
|
output = std::numeric_limits<T>::quiet_NaN();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -71,8 +71,6 @@ namespace YAML
|
|||||||
void PostWriteStreamable(const std::stringstream& str);
|
void PostWriteStreamable(const std::stringstream& str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum ATOMIC_TYPE { AT_SCALAR, AT_SEQ, AT_BLOCK_SEQ, AT_FLOW_SEQ, AT_MAP, AT_BLOCK_MAP, AT_FLOW_MAP };
|
|
||||||
|
|
||||||
void PreAtomicWrite();
|
void PreAtomicWrite();
|
||||||
bool GotoNextPreAtomicState();
|
bool GotoNextPreAtomicState();
|
||||||
void PostAtomicWrite();
|
void PostAtomicWrite();
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -127,12 +127,12 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct _Binary {
|
struct _Binary {
|
||||||
_Binary(const char *data_, std::size_t size_): data(data_), size(size_) {}
|
_Binary(const unsigned char *data_, std::size_t size_): data(data_), size(size_) {}
|
||||||
const char *data;
|
const unsigned char *data;
|
||||||
std::size_t size;
|
std::size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline _Binary Binary(const char *data, std::size_t size) {
|
inline _Binary Binary(const unsigned char *data, std::size_t size) {
|
||||||
return _Binary(data, size);
|
return _Binary(data, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -77,7 +77,9 @@ namespace YAML
|
|||||||
|
|
||||||
// specific to maps
|
// specific to maps
|
||||||
const Node *FindValue(const char *key) const;
|
const Node *FindValue(const char *key) const;
|
||||||
|
const Node *FindValue(char *key) const;
|
||||||
const Node& operator [] (const char *key) const;
|
const Node& operator [] (const char *key) const;
|
||||||
|
const Node& operator [] (char *key) const;
|
||||||
|
|
||||||
// for tags
|
// for tags
|
||||||
const std::string& Tag() const { return m_tag; }
|
const std::string& Tag() const { return m_tag; }
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -68,10 +68,18 @@ namespace YAML
|
|||||||
inline const Node *Node::FindValue(const char *key) const {
|
inline const Node *Node::FindValue(const char *key) const {
|
||||||
return FindValue(std::string(key));
|
return FindValue(std::string(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const Node *Node::FindValue(char *key) const {
|
||||||
|
return FindValue(std::string(key));
|
||||||
|
}
|
||||||
|
|
||||||
inline const Node& Node::operator [] (const char *key) const {
|
inline const Node& Node::operator [] (const char *key) const {
|
||||||
return GetValue(std::string(key));
|
return GetValue(std::string(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const Node& Node::operator [] (char *key) const {
|
||||||
|
return GetValue(std::string(key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#endif // NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,39 +1,44 @@
|
|||||||
#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace YAML
|
namespace YAML
|
||||||
{
|
{
|
||||||
template <typename T>
|
template<typename Seq>
|
||||||
inline Emitter& operator << (Emitter& emitter, const std::vector <T>& v) {
|
inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
|
||||||
typedef typename std::vector <T> vec;
|
|
||||||
emitter << BeginSeq;
|
emitter << BeginSeq;
|
||||||
for(typename vec::const_iterator it=v.begin();it!=v.end();++it)
|
for(typename Seq::const_iterator it=seq.begin();it!=seq.end();++it)
|
||||||
emitter << *it;
|
|
||||||
emitter << EndSeq;
|
|
||||||
return emitter;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline Emitter& operator << (Emitter& emitter, const std::list <T>& v) {
|
|
||||||
typedef typename std::list <T> list;
|
|
||||||
emitter << BeginSeq;
|
|
||||||
for(typename list::const_iterator it=v.begin();it!=v.end();++it)
|
|
||||||
emitter << *it;
|
emitter << *it;
|
||||||
emitter << EndSeq;
|
emitter << EndSeq;
|
||||||
return emitter;
|
return emitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline Emitter& operator << (Emitter& emitter, const std::vector<T>& v) {
|
||||||
|
return EmitSeq(emitter, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline Emitter& operator << (Emitter& emitter, const std::list<T>& v) {
|
||||||
|
return EmitSeq(emitter, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline Emitter& operator << (Emitter& emitter, const std::set<T>& v) {
|
||||||
|
return EmitSeq(emitter, v);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
inline Emitter& operator << (Emitter& emitter, const std::map <K, V>& m) {
|
inline Emitter& operator << (Emitter& emitter, const std::map<K, V>& m) {
|
||||||
typedef typename std::map <K, V> map;
|
typedef typename std::map <K, V> map;
|
||||||
emitter << BeginMap;
|
emitter << BeginMap;
|
||||||
for(typename map::const_iterator it=m.begin();it!=m.end();++it)
|
for(typename map::const_iterator it=m.begin();it!=m.end();++it)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
#ifndef GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include "yaml-cpp/eventhandler.h"
|
#include "yaml-cpp/eventhandler.h"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -186,6 +186,7 @@ namespace YAML
|
|||||||
case ES_WRITING_FLOW_SEQ_ENTRY:
|
case ES_WRITING_FLOW_SEQ_ENTRY:
|
||||||
return true;
|
return true;
|
||||||
case ES_DONE_WITH_FLOW_SEQ_ENTRY:
|
case ES_DONE_WITH_FLOW_SEQ_ENTRY:
|
||||||
|
EmitSeparationIfNecessary();
|
||||||
m_stream << ',';
|
m_stream << ',';
|
||||||
m_pState->RequireSoftSeparation();
|
m_pState->RequireSoftSeparation();
|
||||||
m_pState->SwitchState(ES_WAITING_FOR_FLOW_SEQ_ENTRY);
|
m_pState->SwitchState(ES_WAITING_FOR_FLOW_SEQ_ENTRY);
|
||||||
@@ -221,9 +222,9 @@ namespace YAML
|
|||||||
m_pState->SetError(ErrorMsg::EXPECTED_KEY_TOKEN);
|
m_pState->SetError(ErrorMsg::EXPECTED_KEY_TOKEN);
|
||||||
return true;
|
return true;
|
||||||
case ES_WAITING_FOR_FLOW_MAP_KEY:
|
case ES_WAITING_FOR_FLOW_MAP_KEY:
|
||||||
|
EmitSeparationIfNecessary();
|
||||||
m_pState->SwitchState(ES_WRITING_FLOW_MAP_KEY);
|
m_pState->SwitchState(ES_WRITING_FLOW_MAP_KEY);
|
||||||
if(m_pState->CurrentlyInLongKey()) {
|
if(m_pState->CurrentlyInLongKey()) {
|
||||||
EmitSeparationIfNecessary();
|
|
||||||
m_stream << '?';
|
m_stream << '?';
|
||||||
m_pState->RequireSoftSeparation();
|
m_pState->RequireSoftSeparation();
|
||||||
}
|
}
|
||||||
@@ -234,6 +235,7 @@ namespace YAML
|
|||||||
m_pState->SetError(ErrorMsg::EXPECTED_VALUE_TOKEN);
|
m_pState->SetError(ErrorMsg::EXPECTED_VALUE_TOKEN);
|
||||||
return true;
|
return true;
|
||||||
case ES_WAITING_FOR_FLOW_MAP_VALUE:
|
case ES_WAITING_FOR_FLOW_MAP_VALUE:
|
||||||
|
EmitSeparationIfNecessary();
|
||||||
m_stream << ':';
|
m_stream << ':';
|
||||||
m_pState->RequireSoftSeparation();
|
m_pState->RequireSoftSeparation();
|
||||||
m_pState->SwitchState(ES_WRITING_FLOW_MAP_VALUE);
|
m_pState->SwitchState(ES_WRITING_FLOW_MAP_VALUE);
|
||||||
@@ -496,6 +498,7 @@ namespace YAML
|
|||||||
} else if(flowType == FT_FLOW) {
|
} else if(flowType == FT_FLOW) {
|
||||||
// Note: flow maps are allowed to be empty
|
// Note: flow maps are allowed to be empty
|
||||||
assert(curState == ES_DONE_WITH_FLOW_MAP_VALUE || curState == ES_WAITING_FOR_FLOW_MAP_ENTRY);
|
assert(curState == ES_DONE_WITH_FLOW_MAP_VALUE || curState == ES_WAITING_FOR_FLOW_MAP_ENTRY);
|
||||||
|
EmitSeparationIfNecessary();
|
||||||
m_stream << "}";
|
m_stream << "}";
|
||||||
} else
|
} else
|
||||||
assert(false);
|
assert(false);
|
||||||
@@ -526,6 +529,7 @@ namespace YAML
|
|||||||
m_pState->UnsetSeparation();
|
m_pState->UnsetSeparation();
|
||||||
m_pState->SwitchState(ES_WAITING_FOR_BLOCK_MAP_KEY);
|
m_pState->SwitchState(ES_WAITING_FOR_BLOCK_MAP_KEY);
|
||||||
} else if(flowType == FT_FLOW) {
|
} else if(flowType == FT_FLOW) {
|
||||||
|
EmitSeparationIfNecessary();
|
||||||
if(curState == ES_DONE_WITH_FLOW_MAP_VALUE) {
|
if(curState == ES_DONE_WITH_FLOW_MAP_VALUE) {
|
||||||
m_stream << ',';
|
m_stream << ',';
|
||||||
m_pState->RequireSoftSeparation();
|
m_pState->RequireSoftSeparation();
|
||||||
@@ -796,8 +800,12 @@ namespace YAML
|
|||||||
if(!good())
|
if(!good())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
m_stream << Indentation(m_pState->GetPreCommentIndent());
|
if(m_stream.col() > 0)
|
||||||
|
m_stream << Indentation(m_pState->GetPreCommentIndent());
|
||||||
Utils::WriteComment(m_stream, comment.content, m_pState->GetPostCommentIndent());
|
Utils::WriteComment(m_stream, comment.content, m_pState->GetPostCommentIndent());
|
||||||
|
m_pState->RequireHardSeparation();
|
||||||
|
m_pState->ForceHardSeparation();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -128,6 +128,9 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsValidPlainScalar(const std::string& str, bool inFlow, bool allowOnlyAscii) {
|
bool IsValidPlainScalar(const std::string& str, bool inFlow, bool allowOnlyAscii) {
|
||||||
|
if(str.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
// first check the start
|
// first check the start
|
||||||
const RegEx& start = (inFlow ? Exp::PlainScalarInFlow() : Exp::PlainScalar());
|
const RegEx& start = (inFlow ? Exp::PlainScalarInFlow() : Exp::PlainScalar());
|
||||||
if(!start.Matches(str))
|
if(!start.Matches(str))
|
||||||
@@ -267,7 +270,7 @@ namespace YAML
|
|||||||
|
|
||||||
bool WriteComment(ostream& out, const std::string& str, int postCommentIndent)
|
bool WriteComment(ostream& out, const std::string& str, int postCommentIndent)
|
||||||
{
|
{
|
||||||
unsigned curIndent = out.col();
|
const unsigned curIndent = out.col();
|
||||||
out << "#" << Indentation(postCommentIndent);
|
out << "#" << Indentation(postCommentIndent);
|
||||||
int codePoint;
|
int codePoint;
|
||||||
for(std::string::const_iterator i = str.begin();
|
for(std::string::const_iterator i = str.begin();
|
||||||
@@ -344,7 +347,7 @@ namespace YAML
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WriteBinary(ostream& out, const char *data, std::size_t size)
|
bool WriteBinary(ostream& out, const unsigned char *data, std::size_t size)
|
||||||
{
|
{
|
||||||
static const char encoding[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
static const char encoding[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
const char PAD = '=';
|
const char PAD = '=';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ namespace YAML
|
|||||||
bool WriteAnchor(ostream& out, const std::string& str);
|
bool WriteAnchor(ostream& out, const std::string& str);
|
||||||
bool WriteTag(ostream& out, const std::string& str, bool verbatim);
|
bool WriteTag(ostream& out, const std::string& str, bool verbatim);
|
||||||
bool WriteTagWithPrefix(ostream& out, const std::string& prefix, const std::string& tag);
|
bool WriteTagWithPrefix(ostream& out, const std::string& prefix, const std::string& tag);
|
||||||
bool WriteBinary(ostream& out, const char *data, std::size_t size);
|
bool WriteBinary(ostream& out, const unsigned char *data, std::size_t size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef ITERPRIV_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef ITERPRIV_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define ITERPRIV_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define ITERPRIV_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
#ifndef PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "yaml-cpp/noncopyable.h"
|
#include "yaml-cpp/noncopyable.h"
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
#ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "yaml-cpp/noncopyable.h"
|
#include "yaml-cpp/noncopyable.h"
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -282,6 +282,20 @@ namespace Test
|
|||||||
desiredOutput = "- &fred ~\n- *fred";
|
desiredOutput = "- &fred ~\n- *fred";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AliasAndAnchorInFlow(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::Flow << YAML::BeginSeq;
|
||||||
|
out << YAML::Anchor("fred");
|
||||||
|
out << YAML::BeginMap;
|
||||||
|
out << YAML::Key << "name" << YAML::Value << "Fred";
|
||||||
|
out << YAML::Key << "age" << YAML::Value << 42;
|
||||||
|
out << YAML::EndMap;
|
||||||
|
out << YAML::Alias("fred");
|
||||||
|
out << YAML::EndSeq;
|
||||||
|
|
||||||
|
desiredOutput = "[&fred {name: Fred, age: 42}, *fred]";
|
||||||
|
}
|
||||||
|
|
||||||
void SimpleVerbatimTag(YAML::Emitter& out, std::string& desiredOutput)
|
void SimpleVerbatimTag(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
{
|
{
|
||||||
out << YAML::VerbatimTag("!foo") << "bar";
|
out << YAML::VerbatimTag("!foo") << "bar";
|
||||||
@@ -503,6 +517,40 @@ namespace Test
|
|||||||
|
|
||||||
desiredOutput = "? long key # long key\n: value";
|
desiredOutput = "? long key # long key\n: value";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitialComment(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::Comment("A comment describing the purpose of the file.");
|
||||||
|
out << YAML::BeginMap << YAML::Key << "key" << YAML::Value << "value" << YAML::EndMap;
|
||||||
|
|
||||||
|
desiredOutput = "# A comment describing the purpose of the file.\nkey: value";
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitialCommentWithDocIndicator(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::BeginDoc << YAML::Comment("A comment describing the purpose of the file.");
|
||||||
|
out << YAML::BeginMap << YAML::Key << "key" << YAML::Value << "value" << YAML::EndMap;
|
||||||
|
|
||||||
|
desiredOutput = "---\n# A comment describing the purpose of the file.\nkey: value";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommentInFlowSeq(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::Flow << YAML::BeginSeq << "foo" << YAML::Comment("foo!") << "bar" << YAML::EndSeq;
|
||||||
|
|
||||||
|
desiredOutput = "[foo # foo!\n, bar]";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommentInFlowMap(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::Flow << YAML::BeginMap;
|
||||||
|
out << YAML::Key << "foo" << YAML::Comment("foo!") << YAML::Value << "foo value";
|
||||||
|
out << YAML::Key << "bar" << YAML::Value << "bar value" << YAML::Comment("bar!");
|
||||||
|
out << YAML::Key << "baz" << YAML::Comment("baz!") << YAML::Value << "baz value" << YAML::Comment("baz!");
|
||||||
|
out << YAML::EndMap;
|
||||||
|
|
||||||
|
desiredOutput = "{foo # foo!\n: foo value, bar: bar value # bar!\n, baz # baz!\n: baz value # baz!\n}";
|
||||||
|
}
|
||||||
|
|
||||||
void Indentation(YAML::Emitter& out, std::string& desiredOutput)
|
void Indentation(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
{
|
{
|
||||||
@@ -711,19 +759,19 @@ namespace Test
|
|||||||
|
|
||||||
void Binary(YAML::Emitter& out, std::string& desiredOutput)
|
void Binary(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
{
|
{
|
||||||
out << YAML::Binary("Hello, World!", 13);
|
out << YAML::Binary(reinterpret_cast<const unsigned char*>("Hello, World!"), 13);
|
||||||
desiredOutput = "!!binary \"SGVsbG8sIFdvcmxkIQ==\"";
|
desiredOutput = "!!binary \"SGVsbG8sIFdvcmxkIQ==\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
void LongBinary(YAML::Emitter& out, std::string& desiredOutput)
|
void LongBinary(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
{
|
{
|
||||||
out << YAML::Binary("Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.\n", 270);
|
out << YAML::Binary(reinterpret_cast<const unsigned char*>("Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.\n"), 270);
|
||||||
desiredOutput = "!!binary \"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4K\"";
|
desiredOutput = "!!binary \"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4K\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyBinary(YAML::Emitter& out, std::string& desiredOutput)
|
void EmptyBinary(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
{
|
{
|
||||||
out << YAML::Binary("", 0);
|
out << YAML::Binary(reinterpret_cast<const unsigned char *>(""), 0);
|
||||||
desiredOutput = "!!binary \"\"";
|
desiredOutput = "!!binary \"\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -798,6 +846,14 @@ namespace Test
|
|||||||
out << "Oops";
|
out << "Oops";
|
||||||
desiredOutput = "Hi\n---\nBye\n---\nOops";
|
desiredOutput = "Hi\n---\nBye\n---\nOops";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmptyString(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::BeginMap;
|
||||||
|
out << YAML::Key << "key" << YAML::Value << "";
|
||||||
|
out << YAML::EndMap;
|
||||||
|
desiredOutput = "key: \"\"";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// incorrect emitting
|
// incorrect emitting
|
||||||
@@ -963,6 +1019,7 @@ namespace Test
|
|||||||
RunEmitterTest(&Emitter::BlockMapAsKey, "block map as key", passed, total);
|
RunEmitterTest(&Emitter::BlockMapAsKey, "block map as key", passed, total);
|
||||||
RunEmitterTest(&Emitter::AliasAndAnchor, "alias and anchor", passed, total);
|
RunEmitterTest(&Emitter::AliasAndAnchor, "alias and anchor", passed, total);
|
||||||
RunEmitterTest(&Emitter::AliasAndAnchorWithNull, "alias and anchor with null", passed, total);
|
RunEmitterTest(&Emitter::AliasAndAnchorWithNull, "alias and anchor with null", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::AliasAndAnchorInFlow, "alias and anchor in flow", passed, total);
|
||||||
RunEmitterTest(&Emitter::SimpleVerbatimTag, "simple verbatim tag", passed, total);
|
RunEmitterTest(&Emitter::SimpleVerbatimTag, "simple verbatim tag", passed, total);
|
||||||
RunEmitterTest(&Emitter::VerbatimTagInBlockSeq, "verbatim tag in block seq", passed, total);
|
RunEmitterTest(&Emitter::VerbatimTagInBlockSeq, "verbatim tag in block seq", passed, total);
|
||||||
RunEmitterTest(&Emitter::VerbatimTagInFlowSeq, "verbatim tag in flow seq", passed, total);
|
RunEmitterTest(&Emitter::VerbatimTagInFlowSeq, "verbatim tag in flow seq", passed, total);
|
||||||
@@ -980,6 +1037,10 @@ namespace Test
|
|||||||
RunEmitterTest(&Emitter::SimpleComment, "simple comment", passed, total);
|
RunEmitterTest(&Emitter::SimpleComment, "simple comment", passed, total);
|
||||||
RunEmitterTest(&Emitter::MultiLineComment, "multi-line comment", passed, total);
|
RunEmitterTest(&Emitter::MultiLineComment, "multi-line comment", passed, total);
|
||||||
RunEmitterTest(&Emitter::ComplexComments, "complex comments", passed, total);
|
RunEmitterTest(&Emitter::ComplexComments, "complex comments", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::InitialComment, "initial comment", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::InitialCommentWithDocIndicator, "initial comment with doc indicator", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::CommentInFlowSeq, "comment in flow seq", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::CommentInFlowMap, "comment in flow map", passed, total);
|
||||||
RunEmitterTest(&Emitter::Indentation, "indentation", passed, total);
|
RunEmitterTest(&Emitter::Indentation, "indentation", passed, total);
|
||||||
RunEmitterTest(&Emitter::SimpleGlobalSettings, "simple global settings", passed, total);
|
RunEmitterTest(&Emitter::SimpleGlobalSettings, "simple global settings", passed, total);
|
||||||
RunEmitterTest(&Emitter::ComplexGlobalSettings, "complex global settings", passed, total);
|
RunEmitterTest(&Emitter::ComplexGlobalSettings, "complex global settings", passed, total);
|
||||||
@@ -1005,6 +1066,7 @@ namespace Test
|
|||||||
RunEmitterTest(&Emitter::BoolFormatting, "bool formatting", passed, total);
|
RunEmitterTest(&Emitter::BoolFormatting, "bool formatting", passed, total);
|
||||||
RunEmitterTest(&Emitter::DocStartAndEnd, "doc start and end", passed, total);
|
RunEmitterTest(&Emitter::DocStartAndEnd, "doc start and end", passed, total);
|
||||||
RunEmitterTest(&Emitter::ImplicitDocStart, "implicit doc start", passed, total);
|
RunEmitterTest(&Emitter::ImplicitDocStart, "implicit doc start", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::EmptyString, "empty string", passed, total);
|
||||||
|
|
||||||
RunEmitterErrorTest(&Emitter::ExtraEndSeq, "extra EndSeq", passed, total);
|
RunEmitterErrorTest(&Emitter::ExtraEndSeq, "extra EndSeq", passed, total);
|
||||||
RunEmitterErrorTest(&Emitter::ExtraEndMap, "extra EndMap", passed, total);
|
RunEmitterErrorTest(&Emitter::ExtraEndMap, "extra EndMap", passed, total);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EMITTERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef EMITTERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define EMITTERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define EMITTERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -803,6 +803,83 @@ namespace Test
|
|||||||
|
|
||||||
return ExpectedTagValue(node, "!");
|
return ExpectedTagValue(node, "!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Infinity()
|
||||||
|
{
|
||||||
|
std::string input =
|
||||||
|
"- .inf\n"
|
||||||
|
"- .Inf\n"
|
||||||
|
"- .INF\n"
|
||||||
|
"- +.inf\n"
|
||||||
|
"- +.Inf\n"
|
||||||
|
"- +.INF\n"
|
||||||
|
"- -.inf\n"
|
||||||
|
"- -.Inf\n"
|
||||||
|
"- -.INF\n";
|
||||||
|
std::stringstream stream(input);
|
||||||
|
YAML::Parser parser(stream);
|
||||||
|
YAML::Node doc;
|
||||||
|
parser.GetNextDocument(doc);
|
||||||
|
|
||||||
|
for(unsigned i=0;i<doc.size();i++)
|
||||||
|
if(doc[i].to<double>() != (i < 6 ? +1 : -1) * std::numeric_limits<double>::infinity())
|
||||||
|
return false;
|
||||||
|
for(unsigned i=0;i<doc.size();i++)
|
||||||
|
if(doc[i].to<long double>() != (i < 6 ? +1 : -1) * std::numeric_limits<long double>::infinity())
|
||||||
|
return false;
|
||||||
|
for(unsigned i=0;i<doc.size();i++)
|
||||||
|
if(doc[i].to<float>() != (i < 6 ? +1 : -1) * std::numeric_limits<float>::infinity())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NaN()
|
||||||
|
{
|
||||||
|
std::string input =
|
||||||
|
"- .nan\n"
|
||||||
|
"- .NaN\n"
|
||||||
|
"- .NAN\n";
|
||||||
|
std::stringstream stream(input);
|
||||||
|
YAML::Parser parser(stream);
|
||||||
|
YAML::Node doc;
|
||||||
|
parser.GetNextDocument(doc);
|
||||||
|
|
||||||
|
for(unsigned i=0;i<doc.size();i++) {
|
||||||
|
double d;
|
||||||
|
doc[i] >> d;
|
||||||
|
if(d == d)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for(unsigned i=0;i<doc.size();i++) {
|
||||||
|
long double d;
|
||||||
|
doc[i] >> d;
|
||||||
|
if(d == d)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for(unsigned i=0;i<doc.size();i++) {
|
||||||
|
float d;
|
||||||
|
doc[i] >> d;
|
||||||
|
if(d == d)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NonConstKey()
|
||||||
|
{
|
||||||
|
std::string input = "{a: 1}";
|
||||||
|
std::stringstream stream(input);
|
||||||
|
YAML::Parser parser(stream);
|
||||||
|
YAML::Node doc;
|
||||||
|
parser.GetNextDocument(doc);
|
||||||
|
|
||||||
|
std::vector<char> key(2);
|
||||||
|
key[0] = 'a';
|
||||||
|
key[1] = '\0';
|
||||||
|
if(doc[&key[0]].to<int>() != 1)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -1079,6 +1156,9 @@ namespace Test
|
|||||||
RunParserTest(&Parser::DefaultPlainScalarTag, "default plain scalar tag", passed, total);
|
RunParserTest(&Parser::DefaultPlainScalarTag, "default plain scalar tag", passed, total);
|
||||||
RunParserTest(&Parser::DefaultSequenceTag, "default sequence tag", passed, total);
|
RunParserTest(&Parser::DefaultSequenceTag, "default sequence tag", passed, total);
|
||||||
RunParserTest(&Parser::ExplicitNonSpecificSequenceTag, "explicit, non-specific sequence tag", passed, total);
|
RunParserTest(&Parser::ExplicitNonSpecificSequenceTag, "explicit, non-specific sequence tag", passed, total);
|
||||||
|
RunParserTest(&Parser::Infinity, "infinity", passed, total);
|
||||||
|
RunParserTest(&Parser::NaN, "NaN", passed, total);
|
||||||
|
RunParserTest(&Parser::NonConstKey, "non const key", passed, total);
|
||||||
|
|
||||||
RunEncodingTest(&EncodeToUtf8, false, "UTF-8, no BOM", passed, total);
|
RunEncodingTest(&EncodeToUtf8, false, "UTF-8, no BOM", passed, total);
|
||||||
RunEncodingTest(&EncodeToUtf8, true, "UTF-8 with BOM", passed, total);
|
RunEncodingTest(&EncodeToUtf8, true, "UTF-8 with BOM", passed, total);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2032,7 +2032,7 @@ namespace Test {
|
|||||||
YAML_ASSERT(doc.size() == 3);
|
YAML_ASSERT(doc.size() == 3);
|
||||||
YAML_ASSERT(doc["strip"].to<std::string>() == "# text");
|
YAML_ASSERT(doc["strip"].to<std::string>() == "# text");
|
||||||
YAML_ASSERT(doc["clip"].to<std::string>() == "# text\n");
|
YAML_ASSERT(doc["clip"].to<std::string>() == "# text\n");
|
||||||
YAML_ASSERT(doc["keep"].to<std::string>() == "# text\n");
|
YAML_ASSERT(doc["keep"].to<std::string>() == "# text\n"); // Note: I believe this is a bug in the YAML spec - it should be "# text\n\n"
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2290,7 +2290,7 @@ namespace Test {
|
|||||||
|
|
||||||
PARSE(doc, input);
|
PARSE(doc, input);
|
||||||
YAML_ASSERT(doc.size() == 2);
|
YAML_ASSERT(doc.size() == 2);
|
||||||
YAML_ASSERT(doc["literal"].to<std::string>() == "value");
|
YAML_ASSERT(doc["literal"].to<std::string>() == "value"); // Note: I believe this is a bug in the YAML spec - it should be "value\n"
|
||||||
YAML_ASSERT(doc["folded"].to<std::string>() == "value");
|
YAML_ASSERT(doc["folded"].to<std::string>() == "value");
|
||||||
YAML_ASSERT(doc["folded"].Tag() == "!foo");
|
YAML_ASSERT(doc["folded"].Tag() == "!foo");
|
||||||
return true;
|
return true;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SPECTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef SPECTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define SPECTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define SPECTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef TESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#ifndef TESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
#define TESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#define TESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
|
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
libdir=${prefix}/@LIB_INSTALL_DIR@
|
libdir=${prefix}/@LIB_INSTALL_DIR@
|
||||||
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
|
includedir=${prefix}/@INCLUDE_INSTALL_ROOT_DIR@
|
||||||
|
|
||||||
Name: Yaml-cpp
|
Name: Yaml-cpp
|
||||||
Description: A YAML parser and emitter for C++
|
Description: A YAML parser and emitter for C++
|
||||||
|
Reference in New Issue
Block a user