mirror of
https://github.com/marzer/tomlplusplus.git
synced 2024-09-04 14:09:11 +00:00
fixed incorrect clang+GCC flag in meson build script
also: - renamed `_impl.h` files to `*.inl` - simplified warning + namespace management boilerplate - applied clang-format to examples - bumped minimum required meson version to `0.54.0`
This commit is contained in:
parent
337aa82017
commit
7da912c45e
@ -8,7 +8,7 @@
|
||||
|
||||
#include "examples.h"
|
||||
|
||||
#define TOML_EXCEPTIONS 0
|
||||
#define TOML_EXCEPTIONS 0
|
||||
#define TOML_UNRELEASED_FEATURES 0
|
||||
#include <toml++/toml.h>
|
||||
|
||||
@ -16,8 +16,7 @@ using namespace std::string_view_literals;
|
||||
|
||||
namespace
|
||||
{
|
||||
inline constexpr auto invalid_parses = std::array
|
||||
{
|
||||
inline constexpr auto invalid_parses = std::array{
|
||||
"########## comments"sv,
|
||||
"# bar\rkek"sv,
|
||||
"# bar\bkek"sv,
|
||||
@ -25,10 +24,10 @@ namespace
|
||||
|
||||
"########## inline tables"sv,
|
||||
"val = {,}"sv,
|
||||
"val = {a='b',}"sv, // allowed when TOML_UNRELEASED_FEATURES == 1
|
||||
"val = {a='b',}"sv, // allowed when TOML_UNRELEASED_FEATURES == 1
|
||||
"val = {a='b',,}"sv,
|
||||
"val = {a='b',"sv,
|
||||
"val = {a='b',\n c='d'}"sv, // allowed when TOML_UNRELEASED_FEATURES == 1
|
||||
"val = {a='b',\n c='d'}"sv, // allowed when TOML_UNRELEASED_FEATURES == 1
|
||||
"val = {?='b'}"sv,
|
||||
|
||||
"########## tables"sv,
|
||||
@ -69,7 +68,7 @@ namespace
|
||||
"val = \" \r \""sv,
|
||||
R"(val = ")"sv,
|
||||
R"(val = "\g")"sv,
|
||||
R"(val = "\x20")"sv, // allowed when TOML_UNRELEASED_FEATURES == 1
|
||||
R"(val = "\x20")"sv, // allowed when TOML_UNRELEASED_FEATURES == 1
|
||||
R"(val = "\uFFF")"sv,
|
||||
R"(val = "\uFFFG")"sv,
|
||||
R"(val = "\UFFFFFFF")"sv,
|
||||
|
@ -6,14 +6,14 @@
|
||||
// this file is for boilerplate unrelated to the toml++ example learning outcomes.
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Weverything"
|
||||
#elif defined (__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Weverything"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(push, 0)
|
||||
#pragma warning(push, 0)
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
@ -25,24 +25,24 @@
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace examples
|
||||
{
|
||||
inline void init() noexcept
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SetConsoleOutputCP(65001); //CP_UTF8
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
SetConsoleOutputCP(65001); // CP_UTF8
|
||||
#endif
|
||||
|
||||
std::ios_base::sync_with_stdio(false);
|
||||
std::cout << std::boolalpha;
|
||||
|
@ -14,77 +14,68 @@ using namespace std::string_view_literals;
|
||||
|
||||
namespace
|
||||
{
|
||||
inline constexpr auto words = std::array
|
||||
{
|
||||
"acceptable"sv, "contain"sv, "ghost"sv, "mark"sv, "respect"sv, "taboo"sv,
|
||||
"actually"sv, "cream"sv, "gleaming"sv, "meaty"sv, "rest"sv, "tacky"sv,
|
||||
"addition"sv, "creature"sv, "glorious"sv, "memory"sv, "rice"sv, "tank"sv,
|
||||
"adhesive"sv, "crime"sv, "gold"sv, "messy"sv, "rich"sv, "tent"sv,
|
||||
"adorable"sv, "cross"sv, "grandfather"sv, "miss"sv, "righteous"sv, "terrible"sv,
|
||||
"advise"sv, "crowded"sv, "gusty"sv, "modern"sv, "room"sv, "threatening"sv,
|
||||
"afraid"sv, "crown"sv, "haircut"sv, "morning"sv, "rotten"sv, "three"sv,
|
||||
"ancient"sv, "cure"sv, "hard-to-find"sv, "naughty"sv, "royal"sv, "ticket"sv,
|
||||
"anxious"sv, "curious"sv, "harm"sv, "neck"sv, "run"sv, "title"sv,
|
||||
"aromatic"sv, "curtain"sv, "heavy"sv, "night"sv, "satisfy"sv, "torpid"sv,
|
||||
"attempt"sv, "cycle"sv, "helpless"sv, "nondescript"sv, "scary"sv, "train"sv,
|
||||
"babies"sv, "deadpan"sv, "high-pitched"sv, "overjoyed"sv, "scatter"sv, "umbrella"sv,
|
||||
"bake"sv, "decisive"sv, "hilarious"sv, "page"sv, "scene"sv, "unadvised"sv,
|
||||
"ball"sv, "deeply"sv, "history"sv, "partner"sv, "scintillating"sv, "unbecoming"sv,
|
||||
"bat"sv, "delightful"sv, "hook"sv, "party"sv, "self"sv, "unbiased"sv,
|
||||
"behave"sv, "deserted"sv, "ignore"sv, "pause"sv, "selfish"sv, "unite"sv,
|
||||
"best"sv, "draconian"sv, "imperfect"sv, "pear"sv, "silky"sv, "uptight"sv,
|
||||
"birds"sv, "dreary"sv, "impossible"sv, "picture"sv, "sisters"sv, "used"sv,
|
||||
"blind"sv, "dull"sv, "incandescent"sv, "place"sv, "ski"sv, "vengeful"sv,
|
||||
"blood"sv, "enthusiastic"sv, "influence"sv, "playground"sv, "skip"sv, "versed"sv,
|
||||
"blue-eyed"sv, "equable"sv, "innocent"sv, "popcorn"sv, "snow"sv, "vessel"sv,
|
||||
"boiling"sv, "excuse"sv, "insidious"sv, "prefer"sv, "soap"sv, "view"sv,
|
||||
"bore"sv, "experience"sv, "itch"sv, "productive"sv, "spare"sv, "voyage"sv,
|
||||
"borrow"sv, "fabulous"sv, "jail"sv, "profuse"sv, "spicy"sv, "wall"sv,
|
||||
"broken"sv, "familiar"sv, "kindhearted"sv, "protective"sv, "spiritual"sv, "want"sv,
|
||||
"capable"sv, "finger"sv, "lackadaisical"sv, "pumped"sv, "sprout"sv, "weary"sv,
|
||||
"charming"sv, "finicky"sv, "laughable"sv, "rabbit"sv, "squirrel"sv, "week"sv,
|
||||
"cheerful"sv, "fix"sv, "leather"sv, "rapid"sv, "stale"sv, "whip"sv,
|
||||
"chubby"sv, "flagrant"sv, "legal"sv, "regret"sv, "step"sv, "wilderness"sv,
|
||||
"clean"sv, "flat"sv, "lewd"sv, "reject"sv, "stingy"sv, "wistful"sv,
|
||||
"close"sv, "flimsy"sv, "license"sv, "rejoice"sv, "string"sv, "worried"sv,
|
||||
"cobweb"sv, "fuel"sv, "light"sv, "relation"sv, "sulky"sv, "wretched"sv,
|
||||
"complex"sv, "furtive"sv, "march"sv, "remarkable"sv, "surprise"sv, "zealous"sv,
|
||||
"consist"sv, "geese"sv
|
||||
inline constexpr auto words = std::array{
|
||||
"acceptable"sv, "contain"sv, "ghost"sv, "mark"sv, "respect"sv, "taboo"sv,
|
||||
"actually"sv, "cream"sv, "gleaming"sv, "meaty"sv, "rest"sv, "tacky"sv,
|
||||
"addition"sv, "creature"sv, "glorious"sv, "memory"sv, "rice"sv, "tank"sv,
|
||||
"adhesive"sv, "crime"sv, "gold"sv, "messy"sv, "rich"sv, "tent"sv,
|
||||
"adorable"sv, "cross"sv, "grandfather"sv, "miss"sv, "righteous"sv, "terrible"sv,
|
||||
"advise"sv, "crowded"sv, "gusty"sv, "modern"sv, "room"sv, "threatening"sv,
|
||||
"afraid"sv, "crown"sv, "haircut"sv, "morning"sv, "rotten"sv, "three"sv,
|
||||
"ancient"sv, "cure"sv, "hard-to-find"sv, "naughty"sv, "royal"sv, "ticket"sv,
|
||||
"anxious"sv, "curious"sv, "harm"sv, "neck"sv, "run"sv, "title"sv,
|
||||
"aromatic"sv, "curtain"sv, "heavy"sv, "night"sv, "satisfy"sv, "torpid"sv,
|
||||
"attempt"sv, "cycle"sv, "helpless"sv, "nondescript"sv, "scary"sv, "train"sv,
|
||||
"babies"sv, "deadpan"sv, "high-pitched"sv, "overjoyed"sv, "scatter"sv, "umbrella"sv,
|
||||
"bake"sv, "decisive"sv, "hilarious"sv, "page"sv, "scene"sv, "unadvised"sv,
|
||||
"ball"sv, "deeply"sv, "history"sv, "partner"sv, "scintillating"sv, "unbecoming"sv,
|
||||
"bat"sv, "delightful"sv, "hook"sv, "party"sv, "self"sv, "unbiased"sv,
|
||||
"behave"sv, "deserted"sv, "ignore"sv, "pause"sv, "selfish"sv, "unite"sv,
|
||||
"best"sv, "draconian"sv, "imperfect"sv, "pear"sv, "silky"sv, "uptight"sv,
|
||||
"birds"sv, "dreary"sv, "impossible"sv, "picture"sv, "sisters"sv, "used"sv,
|
||||
"blind"sv, "dull"sv, "incandescent"sv, "place"sv, "ski"sv, "vengeful"sv,
|
||||
"blood"sv, "enthusiastic"sv, "influence"sv, "playground"sv, "skip"sv, "versed"sv,
|
||||
"blue-eyed"sv, "equable"sv, "innocent"sv, "popcorn"sv, "snow"sv, "vessel"sv,
|
||||
"boiling"sv, "excuse"sv, "insidious"sv, "prefer"sv, "soap"sv, "view"sv,
|
||||
"bore"sv, "experience"sv, "itch"sv, "productive"sv, "spare"sv, "voyage"sv,
|
||||
"borrow"sv, "fabulous"sv, "jail"sv, "profuse"sv, "spicy"sv, "wall"sv,
|
||||
"broken"sv, "familiar"sv, "kindhearted"sv, "protective"sv, "spiritual"sv, "want"sv,
|
||||
"capable"sv, "finger"sv, "lackadaisical"sv, "pumped"sv, "sprout"sv, "weary"sv,
|
||||
"charming"sv, "finicky"sv, "laughable"sv, "rabbit"sv, "squirrel"sv, "week"sv,
|
||||
"cheerful"sv, "fix"sv, "leather"sv, "rapid"sv, "stale"sv, "whip"sv,
|
||||
"chubby"sv, "flagrant"sv, "legal"sv, "regret"sv, "step"sv, "wilderness"sv,
|
||||
"clean"sv, "flat"sv, "lewd"sv, "reject"sv, "stingy"sv, "wistful"sv,
|
||||
"close"sv, "flimsy"sv, "license"sv, "rejoice"sv, "string"sv, "worried"sv,
|
||||
"cobweb"sv, "fuel"sv, "light"sv, "relation"sv, "sulky"sv, "wretched"sv,
|
||||
"complex"sv, "furtive"sv, "march"sv, "remarkable"sv, "surprise"sv, "zealous"sv,
|
||||
"consist"sv, "geese"sv
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]]
|
||||
static T rand(T excl_max) noexcept
|
||||
[[nodiscard]] static T rand(T excl_max) noexcept
|
||||
{
|
||||
return static_cast<T>(static_cast<T>(std::rand()) % excl_max);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]]
|
||||
static T rand(T incl_min, T excl_max) noexcept
|
||||
[[nodiscard]] static T rand(T incl_min, T excl_max) noexcept
|
||||
{
|
||||
return static_cast<T>(incl_min + rand(excl_max - incl_min));
|
||||
}
|
||||
|
||||
static auto rand_date() noexcept
|
||||
{
|
||||
return toml::date
|
||||
{
|
||||
rand(uint16_t{ 1900 }, uint16_t{ 2021 }),
|
||||
rand(uint8_t{ 1 }, uint8_t{ 13 }),
|
||||
rand(uint8_t{ 1 }, uint8_t{ 29 })
|
||||
};
|
||||
return toml::date{ rand(uint16_t{ 1900 }, uint16_t{ 2021 }),
|
||||
rand(uint8_t{ 1 }, uint8_t{ 13 }),
|
||||
rand(uint8_t{ 1 }, uint8_t{ 29 }) };
|
||||
}
|
||||
|
||||
static auto rand_time() noexcept
|
||||
{
|
||||
return toml::time
|
||||
{
|
||||
rand(uint8_t{ 24 }),
|
||||
rand(uint8_t{ 60 }),
|
||||
rand(uint8_t{ 60 }),
|
||||
rand(100) > 80 ? rand(1000000000u) : 0u
|
||||
};
|
||||
return toml::time{ rand(uint8_t{ 24 }),
|
||||
rand(uint8_t{ 60 }),
|
||||
rand(uint8_t{ 60 }),
|
||||
rand(100) > 80 ? rand(1000000000u) : 0u };
|
||||
}
|
||||
|
||||
static auto rand_string(size_t word_count, char sep = ' ') noexcept
|
||||
@ -119,14 +110,14 @@ int main(int argc, char** argv)
|
||||
std::vector<toml::node*> tree;
|
||||
tree.push_back(&root);
|
||||
constexpr size_t max_depth = 10u;
|
||||
int container_min_values = 10;
|
||||
bool in_arr = false;
|
||||
int container_min_values = 10;
|
||||
bool in_arr = false;
|
||||
|
||||
const auto add = [&](auto&& val) noexcept -> auto&
|
||||
{
|
||||
using value_ref = decltype(val);
|
||||
using value_ref = decltype(val);
|
||||
using value_type = std::remove_reference_t<value_ref>;
|
||||
using node_type = toml::inserted_type_of<value_type>;
|
||||
using node_type = toml::inserted_type_of<value_type>;
|
||||
|
||||
toml::node* new_node{};
|
||||
|
||||
@ -142,10 +133,8 @@ int main(int argc, char** argv)
|
||||
{
|
||||
auto& table = tree.back()->ref<toml::table>();
|
||||
|
||||
const auto it = table.insert_or_assign(
|
||||
rand_string(rand<size_t>(1u, 4u), '-'),
|
||||
std::forward<value_ref>(val)
|
||||
);
|
||||
const auto it =
|
||||
table.insert_or_assign(rand_string(rand<size_t>(1u, 4u), '-'), std::forward<value_ref>(val));
|
||||
|
||||
new_node = &it.first->second;
|
||||
}
|
||||
@ -155,7 +144,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
tree.push_back(new_node);
|
||||
container_min_values = rand(1, 4);
|
||||
in_arr = toml::is_array<value_type>;
|
||||
in_arr = toml::is_array<value_type>;
|
||||
if constexpr (toml::is_array<value_type>)
|
||||
tree.back()->as_array()->reserve(static_cast<size_t>(container_min_values));
|
||||
}
|
||||
@ -183,41 +172,30 @@ int main(int argc, char** argv)
|
||||
|
||||
switch (new_node_type)
|
||||
{
|
||||
case toml::node_type::array:
|
||||
if (container_min_values <= 0 && tree.size() < max_depth)
|
||||
add(toml::array{});
|
||||
break;
|
||||
case toml::node_type::array:
|
||||
if (container_min_values <= 0 && tree.size() < max_depth)
|
||||
add(toml::array{});
|
||||
break;
|
||||
|
||||
case toml::node_type::string:
|
||||
add(rand_string(rand<size_t>(8u)));
|
||||
break;
|
||||
case toml::node_type::string: add(rand_string(rand<size_t>(8u))); break;
|
||||
|
||||
case toml::node_type::integer:
|
||||
add(rand());
|
||||
break;
|
||||
case toml::node_type::integer: add(rand()); break;
|
||||
|
||||
case toml::node_type::floating_point:
|
||||
add(rand(10001u) / 10000.0);
|
||||
break;
|
||||
case toml::node_type::floating_point: add(rand(10001u) / 10000.0); break;
|
||||
|
||||
case toml::node_type::boolean:
|
||||
add(!rand(2u));
|
||||
break;
|
||||
case toml::node_type::boolean: add(!rand(2u)); break;
|
||||
|
||||
case toml::node_type::date:
|
||||
add(rand_date());
|
||||
break;
|
||||
case toml::node_type::date: add(rand_date()); break;
|
||||
|
||||
case toml::node_type::time:
|
||||
add(rand_time());
|
||||
break;
|
||||
case toml::node_type::time: add(rand_time()); break;
|
||||
|
||||
case toml::node_type::date_time:
|
||||
add(rand(100) >= 75
|
||||
? toml::date_time{ rand_date(), rand_time() }
|
||||
: toml::date_time{ rand_date(), rand_time(), toml::time_offset{ rand<int8_t>(-11, 12), rand<int8_t>(-45, +46) } }
|
||||
);
|
||||
break;
|
||||
case toml::node_type::date_time:
|
||||
add(rand(100) >= 75
|
||||
? toml::date_time{ rand_date(), rand_time() }
|
||||
: toml::date_time{ rand_date(),
|
||||
rand_time(),
|
||||
toml::time_offset{ rand<int8_t>(-11, 12), rand<int8_t>(-45, +46) } });
|
||||
break;
|
||||
}
|
||||
if (container_min_values <= 0 && tree.size() >= 2u && rand(100) >= 85)
|
||||
{
|
||||
|
@ -19,7 +19,6 @@ int main(int argc, char** argv)
|
||||
toml::table table;
|
||||
try
|
||||
{
|
||||
|
||||
// read from a file if a path argument is given
|
||||
if (argc > 1)
|
||||
table = toml::parse_file(argv[1]);
|
||||
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -17,16 +16,10 @@
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T, typename U>
|
||||
TOML_INTERNAL_LINKAGE
|
||||
bool array_is_homogeneous(T & elements, node_type ntype, U & first_nonmatch) noexcept
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
if (elements.empty())
|
||||
{
|
||||
first_nonmatch = {};
|
||||
@ -246,4 +239,3 @@ TOML_NAMESPACE_START
|
||||
TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -19,6 +18,7 @@
|
||||
#include "table.h"
|
||||
#include "array.h"
|
||||
#include "header_start.h"
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS;
|
||||
|
||||
TOML_NAMESPACE_START
|
||||
{
|
||||
@ -451,4 +451,3 @@ TOML_NAMESPACE_START
|
||||
TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -230,4 +229,3 @@ TOML_IMPL_NAMESPACE_START
|
||||
TOML_IMPL_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -109,4 +108,3 @@ TOML_NAMESPACE_START
|
||||
TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -56,4 +55,3 @@ TOML_NAMESPACE_START
|
||||
TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -8,6 +8,7 @@
|
||||
#include "node.h"
|
||||
#include "std_vector.h"
|
||||
#include "header_start.h"
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS;
|
||||
|
||||
TOML_NAMESPACE_START
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -75,4 +74,3 @@ TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
#endif // TOML_EXTERN_TEMPLATES
|
||||
/// \endcond
|
@ -11,7 +11,6 @@
|
||||
#include "source_region.h"
|
||||
#include "print_to_stream.h"
|
||||
#include "header_start.h"
|
||||
TOML_DISABLE_INIT_WARNINGS;
|
||||
|
||||
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
|
||||
#define TOML_PARSE_ERROR_BASE
|
||||
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
#include "preprocessor.h"
|
||||
//# {{
|
||||
@ -43,10 +42,6 @@ TOML_ENABLE_WARNINGS;
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class utf8_byte_stream;
|
||||
|
||||
@ -186,13 +181,6 @@ TOML_ANON_NAMESPACE_START
|
||||
return bytes[3] ? std::string_view{ bytes, 4_sz } : std::string_view{ bytes };
|
||||
}
|
||||
|
||||
TOML_NODISCARD
|
||||
TOML_ATTR(pure)
|
||||
constexpr operator char32_t&() noexcept
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
TOML_NODISCARD
|
||||
TOML_ATTR(pure)
|
||||
constexpr operator const char32_t&() const noexcept
|
||||
@ -3665,4 +3653,3 @@ TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
#endif // TOML_PARSER
|
||||
/// \endcond
|
@ -66,25 +66,18 @@
|
||||
_Pragma("clang diagnostic ignored \"-Wswitch\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_INIT_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_ARITHMETIC_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wfloat-equal\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wdouble-promotion\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshift-sign-overflow\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SHADOW_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow-field\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SPAM_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wweak-vtables\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wweak-template-vtables\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wdouble-promotion\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wpadded\"") \
|
||||
static_assert(true)
|
||||
|
||||
@ -278,23 +271,12 @@
|
||||
#define TOML_DISABLE_SWITCH_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch-enum\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_INIT_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_ARITHMETIC_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SHADOW_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SPAM_WARNINGS \
|
||||
@ -303,8 +285,12 @@
|
||||
_Pragma("GCC diagnostic ignored \"-Wcomment\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=pure\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=pure\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_POP_WARNINGS \
|
||||
@ -317,9 +303,7 @@
|
||||
_Pragma("GCC diagnostic ignored \"-Wextra\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
|
||||
TOML_DISABLE_SWITCH_WARNINGS; \
|
||||
TOML_DISABLE_INIT_WARNINGS; \
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS; \
|
||||
TOML_DISABLE_SHADOW_WARNINGS; \
|
||||
TOML_DISABLE_SPAM_WARNINGS; \
|
||||
static_assert(true)
|
||||
|
||||
@ -504,18 +488,12 @@
|
||||
#ifndef TOML_DISABLE_SWITCH_WARNINGS
|
||||
#define TOML_DISABLE_SWITCH_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_INIT_WARNINGS
|
||||
#define TOML_DISABLE_INIT_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_SPAM_WARNINGS
|
||||
#define TOML_DISABLE_SPAM_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_ARITHMETIC_WARNINGS
|
||||
#define TOML_DISABLE_ARITHMETIC_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_SHADOW_WARNINGS
|
||||
#define TOML_DISABLE_SHADOW_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_POP_WARNINGS
|
||||
#define TOML_POP_WARNINGS static_assert(true)
|
||||
#endif
|
||||
@ -774,17 +752,15 @@
|
||||
#define TOML_IMPL_NAMESPACE_START TOML_NAMESPACE_START { namespace impl
|
||||
#define TOML_IMPL_NAMESPACE_END } TOML_NAMESPACE_END
|
||||
#if TOML_HEADER_ONLY
|
||||
#define TOML_ANON_NAMESPACE_START TOML_IMPL_NAMESPACE_START
|
||||
#define TOML_ANON_NAMESPACE_START static_assert(TOML_IMPLEMENTATION); TOML_IMPL_NAMESPACE_START
|
||||
#define TOML_ANON_NAMESPACE_END TOML_IMPL_NAMESPACE_END
|
||||
#define TOML_ANON_NAMESPACE TOML_NAMESPACE::impl
|
||||
#define TOML_USING_ANON_NAMESPACE using namespace TOML_ANON_NAMESPACE
|
||||
#define TOML_EXTERNAL_LINKAGE inline
|
||||
#define TOML_INTERNAL_LINKAGE inline
|
||||
#else
|
||||
#define TOML_ANON_NAMESPACE_START namespace
|
||||
#define TOML_ANON_NAMESPACE_START static_assert(TOML_IMPLEMENTATION); using namespace toml; namespace
|
||||
#define TOML_ANON_NAMESPACE_END static_assert(true)
|
||||
#define TOML_ANON_NAMESPACE
|
||||
#define TOML_USING_ANON_NAMESPACE static_cast<void>(0)
|
||||
#define TOML_EXTERNAL_LINKAGE
|
||||
#define TOML_INTERNAL_LINKAGE static
|
||||
#endif
|
||||
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -35,10 +34,6 @@ TOML_ENABLE_WARNINGS;
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
inline constexpr size_t charconv_buffer_length = 0;
|
||||
|
||||
@ -76,8 +71,6 @@ TOML_ANON_NAMESPACE_START
|
||||
TOML_INTERNAL_LINKAGE
|
||||
void print_integer_to_stream(std::ostream & stream, T val, value_flags format = {})
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
if (!val)
|
||||
{
|
||||
stream.put('0');
|
||||
@ -138,7 +131,7 @@ TOML_ANON_NAMESPACE_START
|
||||
ss << std::uppercase << std::setbase(base);
|
||||
ss << static_cast<cast_type>(val);
|
||||
const auto str = std::move(ss).str();
|
||||
impl::print_to_stream(str, stream);
|
||||
impl::print_to_stream(stream, str);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -148,8 +141,6 @@ TOML_ANON_NAMESPACE_START
|
||||
TOML_INTERNAL_LINKAGE
|
||||
void print_floating_point_to_stream(std::ostream & stream, T val, value_flags format = {})
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
switch (impl::fpclassify(val))
|
||||
{
|
||||
case impl::fp_class::neg_inf: impl::print_to_stream(stream, "-inf"sv); break;
|
||||
@ -204,8 +195,6 @@ TOML_ANON_NAMESPACE_START
|
||||
TOML_INTERNAL_LINKAGE
|
||||
void print_integer_leftpad_zeros(std::ostream & stream, T val, size_t min_digits)
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
#if TOML_INT_CHARCONV
|
||||
|
||||
char buf[charconv_buffer_length<T>];
|
||||
@ -471,4 +460,3 @@ TOML_IMPL_NAMESPACE_START
|
||||
TOML_IMPL_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -99,4 +98,3 @@ TOML_IMPL_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
#endif // TOML_WINDOWS_COMPAT
|
||||
/// \endcond
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -18,16 +17,10 @@
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T, typename U>
|
||||
TOML_INTERNAL_LINKAGE
|
||||
bool table_is_homogeneous(T & map, node_type ntype, U & first_nonmatch) noexcept
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
if (map.empty())
|
||||
{
|
||||
first_nonmatch = {};
|
||||
@ -174,4 +167,3 @@ TOML_NAMESPACE_START
|
||||
TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
/// \endcond
|
@ -7,6 +7,7 @@
|
||||
#include "node.h"
|
||||
#include "print_to_stream.h"
|
||||
#include "header_start.h"
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS;
|
||||
|
||||
/// \cond
|
||||
// clang-format off
|
||||
|
@ -3,7 +3,6 @@
|
||||
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
/// \cond
|
||||
|
||||
//# {{
|
||||
#include "preprocessor.h"
|
||||
@ -78,4 +77,3 @@ TOML_NAMESPACE_END;
|
||||
|
||||
#include "header_end.h"
|
||||
#endif // TOML_EXTERN_TEMPLATES
|
||||
/// \endcond
|
@ -12,12 +12,12 @@
|
||||
|
||||
#include "impl/preprocessor.h"
|
||||
|
||||
//# {{
|
||||
TOML_PUSH_WARNINGS;
|
||||
#if TOML_MSVC
|
||||
#pragma warning(disable : 5031) // #pragma warning(pop): likely mismatch
|
||||
#pragma warning(disable : 5031) // #pragma warning(pop): likely mismatch (false-positive)
|
||||
#elif TOML_CLANG && !TOML_HEADER_ONLY && TOML_IMPLEMENTATION
|
||||
#pragma clang diagnostic ignored "-Wheader-hygiene" // false-positive
|
||||
#endif
|
||||
//# }}
|
||||
|
||||
#include "impl/std_new.h"
|
||||
#include "impl/std_string.h"
|
||||
@ -41,22 +41,22 @@ TOML_PUSH_WARNINGS;
|
||||
#include "impl/json_formatter.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
#include "impl/std_string_impl.h"
|
||||
#include "impl/print_to_stream_impl.h"
|
||||
#include "impl/node_impl.h"
|
||||
#include "impl/node_view_impl.h"
|
||||
#include "impl/value_impl.h"
|
||||
#include "impl/array_impl.h"
|
||||
#include "impl/table_impl.h"
|
||||
#include "impl/parser_impl.h"
|
||||
#include "impl/formatter_impl.h"
|
||||
#include "impl/default_formatter_impl.h"
|
||||
#include "impl/json_formatter_impl.h"
|
||||
|
||||
#include "impl/std_string.inl"
|
||||
#include "impl/print_to_stream.inl"
|
||||
#include "impl/node.inl"
|
||||
#include "impl/node_view.inl"
|
||||
#include "impl/value.inl"
|
||||
#include "impl/array.inl"
|
||||
#include "impl/table.inl"
|
||||
#include "impl/parser.inl"
|
||||
#include "impl/formatter.inl"
|
||||
#include "impl/default_formatter.inl"
|
||||
#include "impl/json_formatter.inl"
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
//# {{
|
||||
TOML_POP_WARNINGS;
|
||||
//# }}
|
||||
|
||||
// macro hygiene
|
||||
#if TOML_UNDEF_MACROS
|
||||
@ -83,8 +83,6 @@ TOML_POP_WARNINGS;
|
||||
#undef TOML_CPP
|
||||
#undef TOML_DISABLE_ARITHMETIC_WARNINGS
|
||||
#undef TOML_DISABLE_CODE_ANALYSIS_WARNINGS
|
||||
#undef TOML_DISABLE_INIT_WARNINGS
|
||||
#undef TOML_DISABLE_SHADOW_WARNINGS
|
||||
#undef TOML_DISABLE_SPAM_WARNINGS
|
||||
#undef TOML_DISABLE_SUGGEST_WARNINGS
|
||||
#undef TOML_DISABLE_SWITCH_WARNINGS
|
||||
@ -156,7 +154,6 @@ TOML_POP_WARNINGS;
|
||||
#undef TOML_UINT128
|
||||
#undef TOML_UNLIKELY
|
||||
#undef TOML_UNREACHABLE
|
||||
#undef TOML_USING_ANON_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif // TOMLPLUSPLUS_H
|
||||
|
@ -2,7 +2,7 @@ project(
|
||||
'tomlplusplus',
|
||||
'cpp',
|
||||
version: '3.0.0',
|
||||
meson_version: '>=0.53.0',
|
||||
meson_version: '>=0.54.0',
|
||||
license: 'MIT',
|
||||
default_options: [ # https://mesonbuild.com/Builtin-options.html
|
||||
# core options
|
||||
@ -62,7 +62,7 @@ if is_gcc or is_clang
|
||||
add_project_arguments(
|
||||
'-march=native',
|
||||
'-fvisibility=hidden',
|
||||
'-fvisility-inlines-hidden',
|
||||
'-fvisibility-inlines-hidden',
|
||||
language: 'cpp'
|
||||
)
|
||||
if is_release
|
||||
@ -508,9 +508,7 @@ tomlplusplus_dep = declare_dependency(
|
||||
version: meson.project_version(),
|
||||
)
|
||||
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('tomlplusplus', tomlplusplus_dep)
|
||||
endif
|
||||
meson.override_dependency('tomlplusplus', tomlplusplus_dep)
|
||||
|
||||
if not is_subproject
|
||||
import('pkgconfig').generate(
|
||||
|
@ -4,7 +4,6 @@ test_sources = [
|
||||
'conformance_iarna_invalid.cpp',
|
||||
'conformance_iarna_valid.cpp',
|
||||
'impl_toml.cpp',
|
||||
'impl_catch2.cpp',
|
||||
'tests.cpp',
|
||||
'parsing_floats.cpp',
|
||||
'parsing_arrays.cpp',
|
||||
@ -16,6 +15,7 @@ test_sources = [
|
||||
'parsing_spec_example.cpp',
|
||||
'parsing_strings.cpp',
|
||||
'parsing_tables.cpp',
|
||||
'main.cpp',
|
||||
'manipulating_arrays.cpp',
|
||||
'manipulating_tables.cpp',
|
||||
'manipulating_values.cpp',
|
||||
|
@ -4,8 +4,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "tests.h"
|
||||
|
||||
TOML_DISABLE_INIT_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
|
||||
TEST_CASE("parsing - dates and times")
|
||||
{
|
||||
@ -42,13 +41,12 @@ TEST_CASE("parsing - dates and times")
|
||||
CHECK(tbl["lt1"] == lt1);
|
||||
static constexpr auto lt2 = toml::time{ 0, 32, 0, 999999000u };
|
||||
CHECK(tbl["lt2"] == lt2);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// value tests
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16"sv, date{ 1987, 3, 16 } );
|
||||
parse_expected_value(FILE_LINE_ARGS, "10:20:30"sv, toml::time{ 10, 20, 30 } );
|
||||
parse_expected_value(FILE_LINE_ARGS, "10:20:30.04"sv, toml::time{ 10, 20, 30, 40000000 } );
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16"sv, date{ 1987, 3, 16 });
|
||||
parse_expected_value(FILE_LINE_ARGS, "10:20:30"sv, toml::time{ 10, 20, 30 });
|
||||
parse_expected_value(FILE_LINE_ARGS, "10:20:30.04"sv, toml::time{ 10, 20, 30, 40000000 });
|
||||
{
|
||||
const auto val = date_time{ { 1987, 3, 16 }, { 10, 20, 30 } };
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16T10:20:30"sv, val);
|
||||
@ -104,14 +102,14 @@ TEST_CASE("parsing - dates and times")
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16 10:20:30.04z"sv, val);
|
||||
}
|
||||
|
||||
// toml/issues/671 (allow omission of seconds)
|
||||
#if TOML_LANG_UNRELEASED
|
||||
// toml/issues/671 (allow omission of seconds)
|
||||
#if TOML_LANG_UNRELEASED
|
||||
|
||||
parse_expected_value(FILE_LINE_ARGS, "10:20"sv, toml::time{ 10, 20 } );
|
||||
parse_expected_value(FILE_LINE_ARGS, "10:20"sv, toml::time{ 10, 20 });
|
||||
{
|
||||
const auto val = date_time{ { 1987, 3, 16 }, { 10, 20 } };
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16T10:20"sv, val );
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16 10:20"sv, val );
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16T10:20"sv, val);
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16 10:20"sv, val);
|
||||
}
|
||||
{
|
||||
const auto val = date_time{ { 1987, 3, 16 }, { 10, 20 }, { -9, -30 } };
|
||||
@ -129,7 +127,7 @@ TEST_CASE("parsing - dates and times")
|
||||
parse_expected_value(FILE_LINE_ARGS, "1987-03-16 10:20Z"sv, val);
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
|
||||
parsing_should_fail(FILE_LINE_ARGS, "10:20"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "1987-03-16T10:20"sv);
|
||||
@ -141,8 +139,7 @@ TEST_CASE("parsing - dates and times")
|
||||
parsing_should_fail(FILE_LINE_ARGS, "1987-03-16T10:20Z"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "1987-03-16 10:20Z"sv);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// eof tests
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-1"sv);
|
||||
@ -153,9 +150,9 @@ TEST_CASE("parsing - dates and times")
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:20:30."sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:20:3"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:20:"sv);
|
||||
#if !TOML_LANG_UNRELEASED // toml/issues/671 (allow omission of seconds)
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:20"sv);
|
||||
#endif
|
||||
#if !TOML_LANG_UNRELEASED // toml/issues/671 (allow omission of seconds)
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:20"sv);
|
||||
#endif
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:2"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 10:"sv);
|
||||
|
||||
@ -167,9 +164,9 @@ TEST_CASE("parsing - dates and times")
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:20:30."sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:20:3"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:20:"sv);
|
||||
#if !TOML_LANG_UNRELEASED // toml/issues/671 (allow omission of seconds)
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:20"sv);
|
||||
#endif
|
||||
#if !TOML_LANG_UNRELEASED // toml/issues/671 (allow omission of seconds)
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:20"sv);
|
||||
#endif
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:2"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10:"sv);
|
||||
parsing_should_fail(FILE_LINE_ARGS, "val = 1987-03-16 10"sv);
|
||||
|
@ -4,9 +4,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "tests.h"
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_INIT_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
|
||||
TEST_CASE("parsing - TOML spec example")
|
||||
{
|
||||
@ -46,53 +44,49 @@ TEST_CASE("parsing - TOML spec example")
|
||||
]
|
||||
)"sv;
|
||||
|
||||
parsing_should_succeed(
|
||||
FILE_LINE_ARGS,
|
||||
toml_text,
|
||||
[](table&& tbl)
|
||||
{
|
||||
CHECK(tbl.size() == 5);
|
||||
parsing_should_succeed(FILE_LINE_ARGS,
|
||||
toml_text,
|
||||
[](table&& tbl)
|
||||
{
|
||||
CHECK(tbl.size() == 5);
|
||||
|
||||
CHECK(tbl["title"] == "TOML Example"sv);
|
||||
CHECK(tbl["title"] == "TOML Example"sv);
|
||||
|
||||
CHECK(tbl["owner"]);
|
||||
CHECK(tbl["owner"].as<table>());
|
||||
CHECK(tbl["owner"]["name"] == "Tom Preston-Werner"sv);
|
||||
const auto dob = date_time{ { 1979, 5, 27 }, { 7, 32 }, { -8, 0 } };
|
||||
CHECK(tbl["owner"]["dob"] == dob);
|
||||
CHECK(tbl["owner"]);
|
||||
CHECK(tbl["owner"].as<table>());
|
||||
CHECK(tbl["owner"]["name"] == "Tom Preston-Werner"sv);
|
||||
const auto dob = date_time{ { 1979, 5, 27 }, { 7, 32 }, { -8, 0 } };
|
||||
CHECK(tbl["owner"]["dob"] == dob);
|
||||
|
||||
CHECK(tbl["database"].as<table>());
|
||||
CHECK(tbl["database"]["server"] == "192.168.1.1"sv);
|
||||
const auto ports = { 8001, 8001, 8002 };
|
||||
CHECK(tbl["database"]["ports"] == ports);
|
||||
CHECK(tbl["database"]["connection_max"] == 5000);
|
||||
CHECK(tbl["database"]["enabled"] == true);
|
||||
CHECK(tbl["database"].as<table>());
|
||||
CHECK(tbl["database"]["server"] == "192.168.1.1"sv);
|
||||
const auto ports = { 8001, 8001, 8002 };
|
||||
CHECK(tbl["database"]["ports"] == ports);
|
||||
CHECK(tbl["database"]["connection_max"] == 5000);
|
||||
CHECK(tbl["database"]["enabled"] == true);
|
||||
|
||||
CHECK(tbl["servers"].as<table>());
|
||||
CHECK(tbl["servers"]["alpha"].as<table>());
|
||||
CHECK(tbl["servers"]["alpha"]["ip"] == "10.0.0.1"sv);
|
||||
CHECK(tbl["servers"]["alpha"]["dc"] == "eqdc10"sv);
|
||||
CHECK(tbl["servers"]["beta"].as<table>());
|
||||
CHECK(tbl["servers"]["beta"]["ip"] == "10.0.0.2"sv);
|
||||
CHECK(tbl["servers"]["beta"]["dc"] == "eqdc10"sv);
|
||||
CHECK(tbl["servers"].as<table>());
|
||||
CHECK(tbl["servers"]["alpha"].as<table>());
|
||||
CHECK(tbl["servers"]["alpha"]["ip"] == "10.0.0.1"sv);
|
||||
CHECK(tbl["servers"]["alpha"]["dc"] == "eqdc10"sv);
|
||||
CHECK(tbl["servers"]["beta"].as<table>());
|
||||
CHECK(tbl["servers"]["beta"]["ip"] == "10.0.0.2"sv);
|
||||
CHECK(tbl["servers"]["beta"]["dc"] == "eqdc10"sv);
|
||||
|
||||
CHECK(tbl["clients"].as<table>());
|
||||
REQUIRE(tbl["clients"]["data"].as<array>());
|
||||
CHECK(tbl["clients"]["data"].as<array>()->size() == 2);
|
||||
REQUIRE(tbl["clients"]["data"][0].as<array>());
|
||||
CHECK(tbl["clients"]["data"][0].as<array>()->size() == 2);
|
||||
CHECK(tbl["clients"]["data"][0][0] == "gamma"sv);
|
||||
CHECK(tbl["clients"]["data"][0][1] == "delta"sv);
|
||||
REQUIRE(tbl["clients"]["data"][1].as<array>());
|
||||
CHECK(tbl["clients"]["data"][1].as<array>()->size() == 2);
|
||||
CHECK(tbl["clients"]["data"][1][0] == 1);
|
||||
CHECK(tbl["clients"]["data"][1][1] == 2);
|
||||
REQUIRE(tbl["clients"]["hosts"].as<array>());
|
||||
CHECK(tbl["clients"]["hosts"].as<array>()->size() == 2);
|
||||
CHECK(tbl["clients"]["hosts"][0] == "alpha"sv);
|
||||
CHECK(tbl["clients"]["hosts"][1] == "omega"sv);
|
||||
}
|
||||
);
|
||||
CHECK(tbl["clients"].as<table>());
|
||||
REQUIRE(tbl["clients"]["data"].as<array>());
|
||||
CHECK(tbl["clients"]["data"].as<array>()->size() == 2);
|
||||
REQUIRE(tbl["clients"]["data"][0].as<array>());
|
||||
CHECK(tbl["clients"]["data"][0].as<array>()->size() == 2);
|
||||
CHECK(tbl["clients"]["data"][0][0] == "gamma"sv);
|
||||
CHECK(tbl["clients"]["data"][0][1] == "delta"sv);
|
||||
REQUIRE(tbl["clients"]["data"][1].as<array>());
|
||||
CHECK(tbl["clients"]["data"][1].as<array>()->size() == 2);
|
||||
CHECK(tbl["clients"]["data"][1][0] == 1);
|
||||
CHECK(tbl["clients"]["data"][1][1] == 2);
|
||||
REQUIRE(tbl["clients"]["hosts"].as<array>());
|
||||
CHECK(tbl["clients"]["hosts"].as<array>()->size() == 2);
|
||||
CHECK(tbl["clients"]["hosts"][0] == "alpha"sv);
|
||||
CHECK(tbl["clients"]["hosts"][1] == "omega"sv);
|
||||
});
|
||||
}
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -76,10 +76,10 @@
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
@ -36,29 +36,29 @@
|
||||
<Import Project="$(ProjectDir)\toml++.props" />
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\toml++\impl\array.h" />
|
||||
<ClInclude Include="include\toml++\impl\array_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\array.inl" />
|
||||
<ClInclude Include="include\toml++\impl\date_time.h" />
|
||||
<ClInclude Include="include\toml++\impl\default_formatter.h" />
|
||||
<ClInclude Include="include\toml++\impl\default_formatter_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\default_formatter.inl" />
|
||||
<ClInclude Include="include\toml++\impl\formatter.h" />
|
||||
<ClInclude Include="include\toml++\impl\formatter_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\formatter.inl" />
|
||||
<ClInclude Include="include\toml++\impl\forward_declarations.h" />
|
||||
<ClInclude Include="include\toml++\impl\header_end.h" />
|
||||
<ClInclude Include="include\toml++\impl\header_start.h" />
|
||||
<ClInclude Include="include\toml++\impl\json_formatter.h" />
|
||||
<ClInclude Include="include\toml++\impl\json_formatter_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\json_formatter.inl" />
|
||||
<ClInclude Include="include\toml++\impl\make_node.h" />
|
||||
<ClInclude Include="include\toml++\impl\node.h" />
|
||||
<ClInclude Include="include\toml++\impl\node_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\node.inl" />
|
||||
<ClInclude Include="include\toml++\impl\node_view.h" />
|
||||
<ClInclude Include="include\toml++\impl\node_view_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\node_view.inl" />
|
||||
<ClInclude Include="include\toml++\impl\parse_error.h" />
|
||||
<ClInclude Include="include\toml++\impl\parse_result.h" />
|
||||
<ClInclude Include="include\toml++\impl\parser.h" />
|
||||
<ClInclude Include="include\toml++\impl\parser_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\parser.inl" />
|
||||
<ClInclude Include="include\toml++\impl\preprocessor.h" />
|
||||
<ClInclude Include="include\toml++\impl\print_to_stream.h" />
|
||||
<ClInclude Include="include\toml++\impl\print_to_stream_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\print_to_stream.inl" />
|
||||
<ClInclude Include="include\toml++\impl\source_region.h" />
|
||||
<ClInclude Include="include\toml++\impl\std_except.h" />
|
||||
<ClInclude Include="include\toml++\impl\std_map.h" />
|
||||
@ -67,12 +67,12 @@
|
||||
<ClInclude Include="include\toml++\impl\std_string.h" />
|
||||
<ClInclude Include="include\toml++\impl\std_vector.h" />
|
||||
<ClInclude Include="include\toml++\impl\table.h" />
|
||||
<ClInclude Include="include\toml++\impl\table_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\table.inl" />
|
||||
<ClInclude Include="include\toml++\impl\utf8.h" />
|
||||
<ClInclude Include="include\toml++\impl\value.h" />
|
||||
<ClInclude Include="include\toml++\impl\value_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\value.inl" />
|
||||
<ClInclude Include="include\toml++\impl\version.h" />
|
||||
<ClInclude Include="include\toml++\impl\std_string_impl.h" />
|
||||
<ClInclude Include="include\toml++\impl\std_string.inl" />
|
||||
<ClInclude Include="include\toml++\toml.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -97,6 +97,7 @@
|
||||
<None Include="meson.build" />
|
||||
<None Include="toml++.props" />
|
||||
<None Include="tools\ci_single_header_check.py" />
|
||||
<None Include="tools\clang_format.bat" />
|
||||
<None Include="tools\generate_conformance_tests.py" />
|
||||
<None Include="tools\generate_single_header.py" />
|
||||
<None Include="tools\generate_windows_test_targets.py" />
|
||||
|
@ -7,7 +7,7 @@
|
||||
<ClInclude Include="include\toml++\impl\array.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\array_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\array.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\date_time.h">
|
||||
@ -16,7 +16,7 @@
|
||||
<ClInclude Include="include\toml++\impl\default_formatter.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\default_formatter_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\default_formatter.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\formatter.h">
|
||||
@ -25,13 +25,13 @@
|
||||
<ClInclude Include="include\toml++\impl\json_formatter.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\json_formatter_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\json_formatter.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\node.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\node_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\node.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\node_view.h">
|
||||
@ -46,7 +46,7 @@
|
||||
<ClInclude Include="include\toml++\impl\parser.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\parser_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\parser.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\preprocessor.h">
|
||||
@ -58,7 +58,7 @@
|
||||
<ClInclude Include="include\toml++\impl\table.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\table_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\table.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\utf8.h">
|
||||
@ -103,19 +103,19 @@
|
||||
<ClInclude Include="include\toml++\impl\std_new.h">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\std_string_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\std_string.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\print_to_stream_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\print_to_stream.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\formatter_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\formatter.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\node_view_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\node_view.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\toml++\impl\value_impl.h">
|
||||
<ClInclude Include="include\toml++\impl\value.inl">
|
||||
<Filter>include\impl</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
@ -171,6 +171,9 @@
|
||||
</None>
|
||||
<None Include=".clang-format" />
|
||||
<None Include=".editorconfig" />
|
||||
<None Include="tools\clang_format.bat">
|
||||
<Filter>tools</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include=".circleci">
|
||||
|
120
toml.hpp
120
toml.hpp
@ -102,25 +102,18 @@
|
||||
_Pragma("clang diagnostic ignored \"-Wswitch\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_INIT_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_ARITHMETIC_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wfloat-equal\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wdouble-promotion\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshift-sign-overflow\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SHADOW_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow-field\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SPAM_WARNINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Wweak-vtables\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wweak-template-vtables\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wdouble-promotion\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wpadded\"") \
|
||||
static_assert(true)
|
||||
|
||||
@ -302,23 +295,12 @@
|
||||
#define TOML_DISABLE_SWITCH_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch-enum\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_INIT_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_ARITHMETIC_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SHADOW_WARNINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SPAM_WARNINGS \
|
||||
@ -327,8 +309,12 @@
|
||||
_Pragma("GCC diagnostic ignored \"-Wcomment\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wchar-subscripts\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=pure\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=pure\"") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_POP_WARNINGS \
|
||||
@ -341,9 +327,7 @@
|
||||
_Pragma("GCC diagnostic ignored \"-Wextra\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
|
||||
TOML_DISABLE_SWITCH_WARNINGS; \
|
||||
TOML_DISABLE_INIT_WARNINGS; \
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS; \
|
||||
TOML_DISABLE_SHADOW_WARNINGS; \
|
||||
TOML_DISABLE_SPAM_WARNINGS; \
|
||||
static_assert(true)
|
||||
|
||||
@ -519,18 +503,12 @@
|
||||
#ifndef TOML_DISABLE_SWITCH_WARNINGS
|
||||
#define TOML_DISABLE_SWITCH_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_INIT_WARNINGS
|
||||
#define TOML_DISABLE_INIT_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_SPAM_WARNINGS
|
||||
#define TOML_DISABLE_SPAM_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_ARITHMETIC_WARNINGS
|
||||
#define TOML_DISABLE_ARITHMETIC_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_DISABLE_SHADOW_WARNINGS
|
||||
#define TOML_DISABLE_SHADOW_WARNINGS static_assert(true)
|
||||
#endif
|
||||
#ifndef TOML_POP_WARNINGS
|
||||
#define TOML_POP_WARNINGS static_assert(true)
|
||||
#endif
|
||||
@ -782,17 +760,15 @@
|
||||
#define TOML_IMPL_NAMESPACE_START TOML_NAMESPACE_START { namespace impl
|
||||
#define TOML_IMPL_NAMESPACE_END } TOML_NAMESPACE_END
|
||||
#if TOML_HEADER_ONLY
|
||||
#define TOML_ANON_NAMESPACE_START TOML_IMPL_NAMESPACE_START
|
||||
#define TOML_ANON_NAMESPACE_START static_assert(TOML_IMPLEMENTATION); TOML_IMPL_NAMESPACE_START
|
||||
#define TOML_ANON_NAMESPACE_END TOML_IMPL_NAMESPACE_END
|
||||
#define TOML_ANON_NAMESPACE TOML_NAMESPACE::impl
|
||||
#define TOML_USING_ANON_NAMESPACE using namespace TOML_ANON_NAMESPACE
|
||||
#define TOML_EXTERNAL_LINKAGE inline
|
||||
#define TOML_INTERNAL_LINKAGE inline
|
||||
#else
|
||||
#define TOML_ANON_NAMESPACE_START namespace
|
||||
#define TOML_ANON_NAMESPACE_START static_assert(TOML_IMPLEMENTATION); using namespace toml; namespace
|
||||
#define TOML_ANON_NAMESPACE_END static_assert(true)
|
||||
#define TOML_ANON_NAMESPACE
|
||||
#define TOML_USING_ANON_NAMESPACE static_cast<void>(0)
|
||||
#define TOML_EXTERNAL_LINKAGE
|
||||
#define TOML_INTERNAL_LINKAGE static
|
||||
#endif
|
||||
@ -861,6 +837,13 @@ TOML_ENABLE_WARNINGS;
|
||||
|
||||
// clang-format on
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
#if TOML_MSVC
|
||||
#pragma warning(disable : 5031) // #pragma warning(pop): likely mismatch (false-positive)
|
||||
#elif TOML_CLANG && !TOML_HEADER_ONLY && TOML_IMPLEMENTATION
|
||||
#pragma clang diagnostic ignored "-Wheader-hygiene" // false-positive
|
||||
#endif
|
||||
|
||||
//******** impl/std_new.h ********************************************************************************************
|
||||
|
||||
TOML_DISABLE_WARNINGS;
|
||||
@ -2864,6 +2847,7 @@ TOML_ENABLE_WARNINGS;
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
TOML_DISABLE_SWITCH_WARNINGS;
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS;
|
||||
|
||||
TOML_NAMESPACE_START
|
||||
{
|
||||
@ -3371,6 +3355,7 @@ TOML_POP_WARNINGS;
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
TOML_DISABLE_SWITCH_WARNINGS;
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS;
|
||||
|
||||
// clang-format off
|
||||
|
||||
@ -6891,8 +6876,6 @@ TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
TOML_DISABLE_SWITCH_WARNINGS;
|
||||
|
||||
TOML_DISABLE_INIT_WARNINGS;
|
||||
|
||||
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
|
||||
#define TOML_PARSE_ERROR_BASE
|
||||
#else
|
||||
@ -7680,7 +7663,7 @@ TOML_POP_WARNINGS;
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
//******** impl/std_string_impl.h ************************************************************************************
|
||||
//******** impl/std_string.inl ***************************************************************************************
|
||||
|
||||
#if TOML_WINDOWS_COMPAT
|
||||
|
||||
@ -7773,7 +7756,7 @@ TOML_POP_WARNINGS;
|
||||
|
||||
#endif // TOML_WINDOWS_COMPAT
|
||||
|
||||
//******** impl/print_to_stream_impl.h *******************************************************************************
|
||||
//******** impl/print_to_stream.inl **********************************************************************************
|
||||
|
||||
TOML_DISABLE_WARNINGS;
|
||||
#include <ostream>
|
||||
@ -7794,10 +7777,6 @@ TOML_DISABLE_SWITCH_WARNINGS;
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
inline constexpr size_t charconv_buffer_length = 0;
|
||||
|
||||
@ -7835,8 +7814,6 @@ TOML_ANON_NAMESPACE_START
|
||||
TOML_INTERNAL_LINKAGE
|
||||
void print_integer_to_stream(std::ostream & stream, T val, value_flags format = {})
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
if (!val)
|
||||
{
|
||||
stream.put('0');
|
||||
@ -7897,7 +7874,7 @@ TOML_ANON_NAMESPACE_START
|
||||
ss << std::uppercase << std::setbase(base);
|
||||
ss << static_cast<cast_type>(val);
|
||||
const auto str = std::move(ss).str();
|
||||
impl::print_to_stream(str, stream);
|
||||
impl::print_to_stream(stream, str);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -7907,8 +7884,6 @@ TOML_ANON_NAMESPACE_START
|
||||
TOML_INTERNAL_LINKAGE
|
||||
void print_floating_point_to_stream(std::ostream & stream, T val, value_flags format = {})
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
switch (impl::fpclassify(val))
|
||||
{
|
||||
case impl::fp_class::neg_inf: impl::print_to_stream(stream, "-inf"sv); break;
|
||||
@ -7963,8 +7938,6 @@ TOML_ANON_NAMESPACE_START
|
||||
TOML_INTERNAL_LINKAGE
|
||||
void print_integer_leftpad_zeros(std::ostream & stream, T val, size_t min_digits)
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
#if TOML_INT_CHARCONV
|
||||
|
||||
char buf[charconv_buffer_length<T>];
|
||||
@ -8231,7 +8204,7 @@ TOML_IMPL_NAMESPACE_END;
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
//******** impl/node_impl.h ******************************************************************************************
|
||||
//******** impl/node.inl *********************************************************************************************
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
@ -8278,7 +8251,7 @@ TOML_NAMESPACE_END;
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
//******** impl/node_view_impl.h *************************************************************************************
|
||||
//******** impl/node_view.inl ****************************************************************************************
|
||||
|
||||
#if TOML_EXTERN_TEMPLATES
|
||||
|
||||
@ -8346,7 +8319,7 @@ TOML_POP_WARNINGS;
|
||||
|
||||
#endif // TOML_EXTERN_TEMPLATES
|
||||
|
||||
//******** impl/value_impl.h *****************************************************************************************
|
||||
//******** impl/value.inl ********************************************************************************************
|
||||
|
||||
#if TOML_EXTERN_TEMPLATES
|
||||
|
||||
@ -8417,7 +8390,7 @@ TOML_POP_WARNINGS;
|
||||
|
||||
#endif // TOML_EXTERN_TEMPLATES
|
||||
|
||||
//******** impl/array_impl.h *****************************************************************************************
|
||||
//******** impl/array.inl ********************************************************************************************
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
@ -8425,16 +8398,10 @@ TOML_DISABLE_SWITCH_WARNINGS;
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T, typename U>
|
||||
TOML_INTERNAL_LINKAGE
|
||||
bool array_is_homogeneous(T & elements, node_type ntype, U & first_nonmatch) noexcept
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
if (elements.empty())
|
||||
{
|
||||
first_nonmatch = {};
|
||||
@ -8655,7 +8622,7 @@ TOML_NAMESPACE_END;
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
//******** impl/table_impl.h *****************************************************************************************
|
||||
//******** impl/table.inl ********************************************************************************************
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
@ -8663,16 +8630,10 @@ TOML_DISABLE_SWITCH_WARNINGS;
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T, typename U>
|
||||
TOML_INTERNAL_LINKAGE
|
||||
bool table_is_homogeneous(T & map, node_type ntype, U & first_nonmatch) noexcept
|
||||
{
|
||||
using namespace toml;
|
||||
|
||||
if (map.empty())
|
||||
{
|
||||
first_nonmatch = {};
|
||||
@ -8820,7 +8781,7 @@ TOML_NAMESPACE_END;
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
//******** impl/parser_impl.h ****************************************************************************************
|
||||
//******** impl/parser.inl *******************************************************************************************
|
||||
|
||||
#if TOML_PARSER
|
||||
|
||||
@ -8844,10 +8805,6 @@ TOML_DISABLE_SWITCH_WARNINGS;
|
||||
|
||||
TOML_ANON_NAMESPACE_START
|
||||
{
|
||||
#if !TOML_HEADER_ONLY
|
||||
using namespace toml;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class utf8_byte_stream;
|
||||
|
||||
@ -8987,13 +8944,6 @@ TOML_ANON_NAMESPACE_START
|
||||
return bytes[3] ? std::string_view{ bytes, 4_sz } : std::string_view{ bytes };
|
||||
}
|
||||
|
||||
TOML_NODISCARD
|
||||
TOML_ATTR(pure)
|
||||
constexpr operator char32_t&() noexcept
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
TOML_NODISCARD
|
||||
TOML_ATTR(pure)
|
||||
constexpr operator const char32_t&() const noexcept
|
||||
@ -12459,7 +12409,7 @@ TOML_POP_WARNINGS;
|
||||
|
||||
#endif // TOML_PARSER
|
||||
|
||||
//******** impl/formatter_impl.h *************************************************************************************
|
||||
//******** impl/formatter.inl ****************************************************************************************
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
@ -12675,11 +12625,12 @@ TOML_IMPL_NAMESPACE_END;
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
//******** impl/default_formatter_impl.h *****************************************************************************
|
||||
//******** impl/default_formatter.inl ********************************************************************************
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
TOML_DISABLE_SWITCH_WARNINGS;
|
||||
TOML_DISABLE_ARITHMETIC_WARNINGS;
|
||||
|
||||
TOML_NAMESPACE_START
|
||||
{
|
||||
@ -13113,7 +13064,7 @@ TOML_NAMESPACE_END;
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
//******** impl/json_formatter_impl.h ********************************************************************************
|
||||
//******** impl/json_formatter.inl ***********************************************************************************
|
||||
|
||||
TOML_PUSH_WARNINGS;
|
||||
TOML_DISABLE_SPAM_WARNINGS;
|
||||
@ -13213,6 +13164,8 @@ TOML_POP_WARNINGS;
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
TOML_POP_WARNINGS;
|
||||
|
||||
// macro hygiene
|
||||
#if TOML_UNDEF_MACROS
|
||||
#undef TOML_ABI_NAMESPACE_BOOL
|
||||
@ -13238,8 +13191,6 @@ TOML_POP_WARNINGS;
|
||||
#undef TOML_CPP
|
||||
#undef TOML_DISABLE_ARITHMETIC_WARNINGS
|
||||
#undef TOML_DISABLE_CODE_ANALYSIS_WARNINGS
|
||||
#undef TOML_DISABLE_INIT_WARNINGS
|
||||
#undef TOML_DISABLE_SHADOW_WARNINGS
|
||||
#undef TOML_DISABLE_SPAM_WARNINGS
|
||||
#undef TOML_DISABLE_SUGGEST_WARNINGS
|
||||
#undef TOML_DISABLE_SWITCH_WARNINGS
|
||||
@ -13311,7 +13262,6 @@ TOML_POP_WARNINGS;
|
||||
#undef TOML_UINT128
|
||||
#undef TOML_UNLIKELY
|
||||
#undef TOML_UNREACHABLE
|
||||
#undef TOML_USING_ANON_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif // TOMLPLUSPLUS_H
|
||||
|
33
tools/clang_format.bat
Normal file
33
tools/clang_format.bat
Normal file
@ -0,0 +1,33 @@
|
||||
@ECHO off
|
||||
SETLOCAL enableextensions enabledelayedexpansion
|
||||
PUSHD .
|
||||
CD /d "%~dp0\.."
|
||||
|
||||
REM --------------------------------------------------------------------------------------
|
||||
REM Runs clang format on all the non-test C++ files in the project
|
||||
REM --------------------------------------------------------------------------------------
|
||||
|
||||
CALL :RunClangFormatOnDirectories ^
|
||||
include\toml++ ^
|
||||
include\toml++\impl ^
|
||||
examples
|
||||
|
||||
GOTO FINISH
|
||||
|
||||
:RunClangFormatOnDirectories
|
||||
(
|
||||
FOR %%i IN (%*) DO (
|
||||
IF EXIST "%%~i" (
|
||||
ECHO Formatting files in "%%~i"
|
||||
clang-format --style=file -i "%%~i\*.cpp" >nul 2>&1
|
||||
clang-format --style=file -i "%%~i\*.h" >nul 2>&1
|
||||
clang-format --style=file -i "%%~i\*.inl" >nul 2>&1
|
||||
)
|
||||
)
|
||||
EXIT /B
|
||||
)
|
||||
|
||||
:FINISH
|
||||
POPD
|
||||
@ENDLOCAL
|
||||
EXIT /B 0
|
@ -15,7 +15,7 @@ from io import StringIO
|
||||
|
||||
class Preprocessor:
|
||||
|
||||
__re_includes = re.compile(r'^\s*#\s*include\s+"(.+?)"', re.I | re.M)
|
||||
__re_includes = re.compile(r'^\s*#\s*include\s+"(.+?)".*?$', re.I | re.M)
|
||||
__multiples_allowed = [
|
||||
r'impl/header_start.h',
|
||||
r'impl/header_end.h'
|
||||
@ -57,7 +57,7 @@ class Preprocessor:
|
||||
|
||||
if self.__current_level == 1:
|
||||
header = utils.make_divider(relative_path, 10, pattern = r'*')
|
||||
text = f'{header}\n\n{text}'
|
||||
text = f'\n\n{header}\n\n{text}'
|
||||
|
||||
self.__directory_stack.pop()
|
||||
return '\n\n' + text + '\n\n'
|
||||
@ -102,6 +102,9 @@ def main():
|
||||
toml_h = re.sub(r'([^@][({,])\n\n', r'\1\n', toml_h)
|
||||
# blank lines preceeding closing brackets
|
||||
toml_h = re.sub(r'\n\n([ \t]*[})])', r'\n\1', toml_h)
|
||||
# blank lines between consecutive TOML_DISABLE_XXXXX_WARNINGS statements
|
||||
toml_h = re.sub('(TOML_(?:PUSH|DISABLE_[A-Z_]+?)WARNINGS;)\n[ \t\n]*\n(TOML_DISABLE_[A-Z_]+?WARNINGS;)', r'\1\n\2', toml_h)
|
||||
# ensure only one trailing newline
|
||||
toml_h = toml_h.strip() + '\n'
|
||||
|
||||
# change TOML_LIB_SINGLE_HEADER to 1
|
||||
|
@ -119,10 +119,10 @@ def main():
|
||||
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
|
||||
<ClCompile Include="..\conformance_iarna_valid.cpp" />
|
||||
<ClCompile Include="..\impl_catch2.cpp">
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\impl_toml.cpp">
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manipulating_arrays.cpp" />
|
||||
|
Loading…
Reference in New Issue
Block a user