mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-10-27 14:31:20 +00:00
Compare commits
4 Commits
1599d55a3d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a83cd31548 | ||
|
|
65c1c270db | ||
|
|
4fe2fb83fe | ||
|
|
aa8d4e4750 |
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
|||||||
packages: googletest libgmock-dev libgtest-dev
|
packages: googletest libgmock-dev libgtest-dev
|
||||||
version: 1.0
|
version: 1.0
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
@@ -126,7 +126,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
2
.github/workflows/bzlmod-archive.yml
vendored
2
.github/workflows/bzlmod-archive.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.1.1
|
||||||
- run: git archive $GITHUB_REF -o "yaml-cpp-${GITHUB_REF:10}.tar.gz"
|
- run: git archive $GITHUB_REF -o "yaml-cpp-${GITHUB_REF:10}.tar.gz"
|
||||||
- run: gh release upload ${GITHUB_REF:10} "yaml-cpp-${GITHUB_REF:10}.tar.gz"
|
- run: gh release upload ${GITHUB_REF:10} "yaml-cpp-${GITHUB_REF:10}.tar.gz"
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ inline Emitter& Emitter::WriteIntegralType(T value) {
|
|||||||
PrepareNode(EmitterNodeType::Scalar);
|
PrepareNode(EmitterNodeType::Scalar);
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream.imbue(std::locale("C"));
|
stream.imbue(std::locale::classic());
|
||||||
PrepareIntegralStream(stream);
|
PrepareIntegralStream(stream);
|
||||||
stream << value;
|
stream << value;
|
||||||
m_stream << stream.str();
|
m_stream << stream.str();
|
||||||
@@ -166,7 +166,7 @@ inline Emitter& Emitter::WriteStreamable(T value) {
|
|||||||
PrepareNode(EmitterNodeType::Scalar);
|
PrepareNode(EmitterNodeType::Scalar);
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream.imbue(std::locale("C"));
|
stream.imbue(std::locale::classic());
|
||||||
SetStreamablePrecision<T>(stream);
|
SetStreamablePrecision<T>(stream);
|
||||||
|
|
||||||
bool special = false;
|
bool special = false;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) {
|
|||||||
\
|
\
|
||||||
static Node encode(const type& rhs) { \
|
static Node encode(const type& rhs) { \
|
||||||
std::stringstream stream; \
|
std::stringstream stream; \
|
||||||
stream.imbue(std::locale("C")); \
|
stream.imbue(std::locale::classic()); \
|
||||||
stream.precision(std::numeric_limits<type>::max_digits10); \
|
stream.precision(std::numeric_limits<type>::max_digits10); \
|
||||||
conversion::inner_encode(rhs, stream); \
|
conversion::inner_encode(rhs, stream); \
|
||||||
return Node(stream.str()); \
|
return Node(stream.str()); \
|
||||||
@@ -184,7 +184,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) {
|
|||||||
} \
|
} \
|
||||||
const std::string& input = node.Scalar(); \
|
const std::string& input = node.Scalar(); \
|
||||||
std::stringstream stream(input); \
|
std::stringstream stream(input); \
|
||||||
stream.imbue(std::locale("C")); \
|
stream.imbue(std::locale::classic()); \
|
||||||
stream.unsetf(std::ios::dec); \
|
stream.unsetf(std::ios::dec); \
|
||||||
if ((stream.peek() == '-') && std::is_unsigned<type>::value) { \
|
if ((stream.peek() == '-') && std::is_unsigned<type>::value) { \
|
||||||
return false; \
|
return false; \
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class YAML_CPP_API memory {
|
|||||||
memory() : m_nodes{} {}
|
memory() : m_nodes{} {}
|
||||||
node& create_node();
|
node& create_node();
|
||||||
void merge(const memory& rhs);
|
void merge(const memory& rhs);
|
||||||
|
size_t size() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Nodes = std::set<shared_node>;
|
using Nodes = std::set<shared_node>;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ template<typename Key, bool Streamable>
|
|||||||
struct streamable_to_string {
|
struct streamable_to_string {
|
||||||
static std::string impl(const Key& key) {
|
static std::string impl(const Key& key) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss.imbue(std::locale("C"));
|
ss.imbue(std::locale::classic());
|
||||||
ss << key;
|
ss << key;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4023,44 +4023,44 @@ namespace jkj {
|
|||||||
|
|
||||||
// Policy kind detectors.
|
// Policy kind detectors.
|
||||||
struct is_sign_policy {
|
struct is_sign_policy {
|
||||||
constexpr bool operator()(...) noexcept { return false; }
|
constexpr bool operator()(...) const noexcept { return false; }
|
||||||
template <class Policy, class = typename Policy::sign_policy>
|
template <class Policy, class = typename Policy::sign_policy>
|
||||||
constexpr bool operator()(dummy<Policy>) noexcept {
|
constexpr bool operator()(dummy<Policy>) const noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct is_trailing_zero_policy {
|
struct is_trailing_zero_policy {
|
||||||
constexpr bool operator()(...) noexcept { return false; }
|
constexpr bool operator()(...) const noexcept { return false; }
|
||||||
template <class Policy, class = typename Policy::trailing_zero_policy>
|
template <class Policy, class = typename Policy::trailing_zero_policy>
|
||||||
constexpr bool operator()(dummy<Policy>) noexcept {
|
constexpr bool operator()(dummy<Policy>) const noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct is_decimal_to_binary_rounding_policy {
|
struct is_decimal_to_binary_rounding_policy {
|
||||||
constexpr bool operator()(...) noexcept { return false; }
|
constexpr bool operator()(...) const noexcept { return false; }
|
||||||
template <class Policy, class = typename Policy::decimal_to_binary_rounding_policy>
|
template <class Policy, class = typename Policy::decimal_to_binary_rounding_policy>
|
||||||
constexpr bool operator()(dummy<Policy>) noexcept {
|
constexpr bool operator()(dummy<Policy>) const noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct is_binary_to_decimal_rounding_policy {
|
struct is_binary_to_decimal_rounding_policy {
|
||||||
constexpr bool operator()(...) noexcept { return false; }
|
constexpr bool operator()(...) const noexcept { return false; }
|
||||||
template <class Policy, class = typename Policy::binary_to_decimal_rounding_policy>
|
template <class Policy, class = typename Policy::binary_to_decimal_rounding_policy>
|
||||||
constexpr bool operator()(dummy<Policy>) noexcept {
|
constexpr bool operator()(dummy<Policy>) const noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct is_cache_policy {
|
struct is_cache_policy {
|
||||||
constexpr bool operator()(...) noexcept { return false; }
|
constexpr bool operator()(...) const noexcept { return false; }
|
||||||
template <class Policy, class = typename Policy::cache_policy>
|
template <class Policy, class = typename Policy::cache_policy>
|
||||||
constexpr bool operator()(dummy<Policy>) noexcept {
|
constexpr bool operator()(dummy<Policy>) const noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct is_preferred_integer_types_policy {
|
struct is_preferred_integer_types_policy {
|
||||||
constexpr bool operator()(...) noexcept { return false; }
|
constexpr bool operator()(...) const noexcept { return false; }
|
||||||
template <class Policy, class = typename Policy::preferred_integer_types_policy>
|
template <class Policy, class = typename Policy::preferred_integer_types_policy>
|
||||||
constexpr bool operator()(dummy<Policy>) noexcept {
|
constexpr bool operator()(dummy<Policy>) const noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ std::string FpToString(T v, int precision = 0) {
|
|||||||
// dragonbox/to_decimal does not handle value 0, inf, NaN
|
// dragonbox/to_decimal does not handle value 0, inf, NaN
|
||||||
if (v == 0 || std::isinf(v) || std::isnan(v)) {
|
if (v == 0 || std::isinf(v) || std::isnan(v)) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss.imbue(std::locale("C"));
|
ss.imbue(std::locale::classic());
|
||||||
ss << v;
|
ss << v;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ std::string FpToString(T v, int precision = 0) {
|
|||||||
// defensive programming, ConvertToChars arguments are invalid
|
// defensive programming, ConvertToChars arguments are invalid
|
||||||
if (digits_ct == -1) {
|
if (digits_ct == -1) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss.imbue(std::locale("C"));
|
ss.imbue(std::locale::classic());
|
||||||
ss << v;
|
ss << v;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ std::string FpToString(T v, int precision = 0) {
|
|||||||
// defensive programming, ConvertToChars arguments are invalid
|
// defensive programming, ConvertToChars arguments are invalid
|
||||||
if (exp_digits_ct == -1) {
|
if (exp_digits_ct == -1) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss.imbue(std::locale("C"));
|
ss.imbue(std::locale::classic());
|
||||||
ss << v;
|
ss << v;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ std::string FpToString(double v, size_t precision) {
|
|||||||
*/
|
*/
|
||||||
std::string FpToString(long double v, size_t precision) {
|
std::string FpToString(long double v, size_t precision) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss.imbue(std::locale("C"));
|
ss.imbue(std::locale::classic());
|
||||||
if (precision == 0) {
|
if (precision == 0) {
|
||||||
precision = std::numeric_limits<long double>::max_digits10;
|
precision = std::numeric_limits<long double>::max_digits10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ void memory_holder::merge(memory_holder& rhs) {
|
|||||||
if (m_pMemory == rhs.m_pMemory)
|
if (m_pMemory == rhs.m_pMemory)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_pMemory->size() < rhs.m_pMemory->size()) {
|
||||||
|
std::swap(m_pMemory, rhs.m_pMemory);
|
||||||
|
}
|
||||||
|
|
||||||
m_pMemory->merge(*rhs.m_pMemory);
|
m_pMemory->merge(*rhs.m_pMemory);
|
||||||
rhs.m_pMemory = m_pMemory;
|
rhs.m_pMemory = m_pMemory;
|
||||||
}
|
}
|
||||||
@@ -22,5 +26,9 @@ node& memory::create_node() {
|
|||||||
void memory::merge(const memory& rhs) {
|
void memory::merge(const memory& rhs) {
|
||||||
m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
|
m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t memory::size() const {
|
||||||
|
return m_nodes.size();
|
||||||
|
}
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace YAML
|
} // namespace YAML
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ void node_data::convert_sequence_to_map(const shared_memory_holder& pMemory) {
|
|||||||
reset_map();
|
reset_map();
|
||||||
for (std::size_t i = 0; i < m_sequence.size(); i++) {
|
for (std::size_t i = 0; i < m_sequence.size(); i++) {
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream.imbue(std::locale("C"));
|
stream.imbue(std::locale::classic());
|
||||||
stream << i;
|
stream << i;
|
||||||
|
|
||||||
node& key = pMemory->create_node();
|
node& key = pMemory->create_node();
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void Parser::HandleYamlDirective(const Token& token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream str(token.params[0]);
|
std::stringstream str(token.params[0]);
|
||||||
str.imbue(std::locale("C"));
|
str.imbue(std::locale::classic());
|
||||||
str >> m_pDirectives->version.major;
|
str >> m_pDirectives->version.major;
|
||||||
str.get();
|
str.get();
|
||||||
str >> m_pDirectives->version.minor;
|
str >> m_pDirectives->version.minor;
|
||||||
|
|||||||
Reference in New Issue
Block a user