fixed source of UB when using char8 strings

also:
- documentation improvements
- minor test restructuring
This commit is contained in:
Mark Gillard 2020-02-27 01:28:20 +02:00
parent 65c276f3c8
commit 9ed295f21c
21 changed files with 200 additions and 159 deletions

View File

@ -6,8 +6,8 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = toml++
PROJECT_NUMBER =
PROJECT_BRIEF = TOML Parser for C++17
PROJECT_LOGO =
PROJECT_BRIEF = TOML for modern C++
PROJECT_LOGO = tomlplusplus-logo.png
OUTPUT_DIRECTORY = ./
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
@ -39,11 +39,22 @@ MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES = "cpp=@code{.cpp}" \
"ecpp=@endcode" \
"out=@code{.unparsed}" \
"eout=@endcode" \
"detail=@details"
ALIASES = \
"cpp=@code{.cpp}" \
"ecpp=@endcode" \
"out=@code{.shell-session}" \
"eout=@endcode" \
"detail=@details" \
"m_div{1}=@xmlonly<mcss:div xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:class=\"\1\">@endxmlonly" \
"m_enddiv=@xmlonly</mcss:div>@endxmlonly" \
"m_span{1}=@xmlonly<mcss:span xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:class=\"\1\">@endxmlonly" \
"m_endspan=@xmlonly</mcss:span>@endxmlonly" \
"m_class{1}=@xmlonly<mcss:class xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:class=\"\1\" />@endxmlonly" \
"m_footernavigation=@xmlonly<mcss:footernavigation xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" />@endxmlonly" \
"m_examplenavigation{2}=@xmlonly<mcss:examplenavigation xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:page=\"\1\" mcss:prefix=\"\2\" />@endxmlonly" \
"m_keywords{1}=@xmlonly<mcss:search xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:keywords=\"\1\" />@endxmlonly" \
"m_keyword{3}=@xmlonly<mcss:search xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:keyword=\"\1\" mcss:title=\"\2\" mcss:suffix-length=\"\3\" />@endxmlonly" \
"m_enum_values_as_keywords=@xmlonly<mcss:search xmlns:mcss=\"http://mcss.mosra.cz/doxygen/\" mcss:enum-values-as-keywords=\"true\" />@endxmlonly"
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO

View File

@ -1,9 +1,17 @@
@INCLUDE = ./Doxyfile
HTML_EXTRA_STYLESHEET = https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600 \
../css/m-dark+documentation.compiled.css \
tomlplusplus.css
HTML_EXTRA_FILES = tomlplusplus.js \
github-icon.png
@INCLUDE = ./Doxyfile
HTML_EXTRA_STYLESHEET = \
https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600 \
../css/m-dark+documentation.compiled.css \
tomlplusplus.css
HTML_EXTRA_FILES = \
tomlplusplus.js \
tomlplusplus-logo.png \
tomlplusplus-banner.png \
tomlplusplus-banner-small.png \
github-icon.png
##! M_THEME_COLOR = #22272e
##! M_LINKS_NAVBAR1 = \
##! namespaces

BIN
docs/tomlplusplus-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -85,14 +85,17 @@ nav .github
background-origin: content-box;
}
pre.m-code + pre
/* code blocks w/ output examples */
pre.m-code + pre.m-console
{
margin-top: -1.0rem;
color: #bababa; /* is yououou */
background-color: #383e46;
border-top: 2px solid #181e26;
border-top: 1px solid #444444;
font-size: 0.8rem;
}
pre.m-code + pre.m-console span
{
color: #bababa; /* is yououou */
}
/* "Parameters", "Returns" etc */
.m-doc-details div table.m-table.m-fullwidth.m-flat thead tr th,

View File

@ -54,6 +54,7 @@
#undef TOML_RELOPS_REORDERING
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
#undef TOML_INLINE_NS_EX
#undef TOML_INLINE_NS_CHAR_8
#undef TOML_START
#undef TOML_START_2
#undef TOML_START_1
@ -64,9 +65,8 @@
/// \mainpage toml++
///
/// This is the home of toml++, a header-only [TOML](https://github.com/toml-lang/toml) parser and serializer for C++17
/// and later.
///
/// \image html tomlplusplus-banner-small.png width=1280px
///
/// \tableofcontents
///
///////////////////////////////////////////////////////////////////////
@ -89,14 +89,16 @@
/// There's some minor configuration you can do to customize some basic library functionality, but that's totally
/// optional. See the [README](https://github.com/marzer/tomlplusplus/blob/master/README.md) for more info.
///
/// \remark
/// \parblock
/// Header-only libraries are great for minimal setup, but can cause ODR violations and complex linker errors
/// in situations where multiple modules include them separately, each with different versions, configuration options,
/// exception handling modes, et cetera.
/// \m_class{m-note m-default}
///
/// `toml++` attempts to combat this problem by nesting everything inside an additional inline namespace that
/// changes according to the library's major version and the compiler's exception-handling mode.
/// \parblock
/// <h3>A word on Linkers and the One Definition Rule</h3>
/// Header-only libraries are great for minimal setup but can cause ODR violations and complex linker errors
/// in situations where multiple modules include them separately, each with different versions, configuration options,
/// exception handling modes...
///
/// This library attempts to combat this problem by nesting everything inside an additional inline namespace
/// that changes according to the library's major version, the compiler's exception-handling mode, et cetera.
/// \endparblock
///
///////////////////////////////////////////////////////////////////////
@ -105,9 +107,11 @@
/// You're looking at it! Browse the docs using the links at the top of the page.
/// You can search from anywhere by pressing the TAB key.
///
/// <em>toml++ is still pretty hot off the presses so there's going to be some omissions,
/// \m_class{m-note m-default}
///
/// This library is still pretty hot off the presses so there's going to be some omissions,
/// typos and general sparseness throughout the docs.
/// If you spot something or have a suggestion, please [let me know](https://github.com/marzer/tomlplusplus/issues)!</em>
/// If you spot something or have a suggestion, please [let me know](https://github.com/marzer/tomlplusplus/issues)!
///
///////////////////////////////////////////////////////////////////////
///
@ -260,7 +264,9 @@
///////////////////////////////////
///
/// \subsection mainpage-example-manipulations Traversing and manipulating data
///
/// A TOML document is a tree of values, arrays and tables, represented as the toml::value, toml::array
/// and toml::table, respectively. All three inherit from toml::node, and can be easily accessed via
/// the toml::node_view:
/// \cpp
/// #include <iostream>
/// #include <toml++/toml.h>
@ -281,29 +287,39 @@
/// )"sv;
/// auto tbl = toml::parse(source);
///
/// // get a view of the element 'numbers'
/// auto numbers = tbl["numbers"];
/// std::cout << "table has 'numbers': "sv << !!numbers << std::endl;
/// if (numbers)
/// std::cout << "numbers is a: "sv << numbers.type() << std::endl;
/// std::cout << "numbers: "sv << numbers << std::endl;
///
/// // get the underlying array object to do some more advanced stuff
/// if (auto arr = numbers.as_array())
/// {
/// std::cout << "'numbers' is a: "sv << numbers.type() << std::endl;
/// std::cout << "'numbers': "sv << numbers << std::endl;
/// for (auto& node : *numbers.as_array())
/// for (auto& elem : *arr)
/// {
/// node.visit([=](auto&& n) noexcept
/// // visitation helps deal with the polymorphic nature of TOML data
/// elem.visit([=](auto&& el) noexcept
/// {
/// if constexpr (toml::is_number<decltype(n)>)
/// (*n)++;
/// else if constexpr (toml::is_string<decltype(n)>)
/// n = "five"sv;
/// if constexpr (toml::is_number<decltype(el)>)
/// (*el)++;
/// else if constexpr (toml::is_string<decltype(el)>)
/// el = "five"sv;
/// });
/// }
/// numbers.as_array()->push_back(7);
/// numbers.as_array()->emplace_back<toml::array>(8, 9);
/// std::cout << "'numbers': "sv << numbers << std::endl;
///
/// // arrays are very similar to std::vector
/// arr->push_back(7);
/// arr->emplace_back<toml::array>(8, 9);
/// std::cout << "numbers: "sv << numbers << std::endl;
/// }
///
/// std::cout << "'cats': "sv << tbl["animals"]["cats"] << std::endl;
/// std::cout << "'dinosaurs': "sv << tbl["animals"]["dinosaurs"] << std::endl; //no dinosaurs :(
/// // node-views can be chained to quickly query deeper
/// std::cout << "cats: "sv << tbl["animals"]["cats"] << std::endl;
/// std::cout << "fish[1]: "sv << tbl["animals"]["fish"][1] << std::endl;
///
/// // ...even if the element doesn't exist
/// std::cout << "dinosaurs: "sv << tbl["animals"]["dinosaurs"] << std::endl; //no dinosaurs :(
///
/// return 0;
/// }
@ -311,16 +327,18 @@
///
/// \out
/// table has 'numbers': true
/// 'numbers' is an: array
/// 'numbers': [1, 2, 3, "four", 5.0]
/// 'numbers': [2, 3, 4, "five", 6.0, 7, [8, 9]]
/// 'cats': ["tiger", "lion", "puma"]
/// 'dinosaurs':
/// numbers is an: array
/// numbers: [1, 2, 3, "four", 5.0]
/// numbers: [2, 3, 4, "five", 6.0, 7, [8, 9]]
/// cats: ["tiger", "lion", "puma"]
/// fish[1]: "trout"
/// dinosaurs:
/// \eout
///
/// \see
/// - toml::node
/// - toml::node_view
/// - toml::node_view
/// - toml::value
/// - toml::array
/// - toml::table
///
@ -408,7 +426,9 @@
/// UTF-8 decoding is performed using a state machine based on Bjoern Hoehrmann's
/// 'Flexible and Economical UTF - 8 Decoder', which is also subject to the terms of the MIT license - see
/// [LICENSE-utf8-decoder](https://github.com/marzer/tomlplusplus/blob/master/LICENSE-utf8-decoder).
///
/// \remark If you're using the single-header version of the library you don't need to distribute these files;
/// their contents is included in the preamble at the top of the file.
///
/// \m_class{m-note m-default}
///
/// If you're using the single-header version of the library you don't need to distribute these files;
/// their contents is included in the preamble at the top of the file.
///

View File

@ -140,21 +140,21 @@
#elif TOML_CPP_VERSION >= 201703L
#define TOML_CPP 17
#endif
#ifndef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 1
#endif
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#if TOML_EXCEPTIONS
#define TOML_MAY_THROW
#define TOML_MAY_THROW_UNLESS(...) noexcept(__VA_ARGS__)
#define TOML_INLINE_NS_EX
#else
#define TOML_MAY_THROW noexcept
#define TOML_MAY_THROW_UNLESS(...) noexcept
#define TOML_INLINE_NS_EX _noex
#endif
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
@ -251,17 +251,17 @@
#define TOML_LANG_EXACTLY(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION == TOML_MAKE_VERSION(maj, min, rev))
#if !TOML_DOXYGEN
#if TOML_CHAR_8_STRINGS
#define TOML_INLINE_NS_CHAR_8 _char8
#else
#define TOML_INLINE_NS_CHAR_8
#endif
#if TOML_EXCEPTIONS
#define TOML_INLINE_NS_EX
#else
#define TOML_INLINE_NS_EX _noex
#endif
#if !TOML_DOXYGEN
#define TOML_START_2(VER, ARG1, ARG2) namespace toml { inline namespace v##VER##ARG1##ARG2
#define TOML_START_1(VER, ARG1, ARG2) TOML_START_2(VER, ARG1, ARG2)
#define TOML_START TOML_START_1(TOML_LIB_MAJOR,TOML_INLINE_NS_EX,)
#define TOML_START TOML_START_1(TOML_LIB_MAJOR,TOML_INLINE_NS_EX,TOML_INLINE_NS_CHAR_8)
#define TOML_END }
#endif

View File

@ -30,20 +30,12 @@ TOML_START
/// (error occurred at line 1, column 13 of 'config.toml')
/// \eout
///
/// \warning <strong>This type only exists when exceptions are disabled.</strong>
/// \attention <strong>This type only exists when exceptions are disabled.</strong>
/// Otherwise parse_result is just an alias for toml::table: \cpp
/// #if ARE_EXCEPTIONS_ENABLED // some compiler-specific test
///
/// using parse_result = table;
/// // parsing failures are indicated by throwing a toml::parse_error as an exception
///
/// #else
///
/// class parse_result final
/// {
/// // ...
/// };
///
/// class parse_result final { // ...
/// #endif
/// \ecpp
class parse_result final

View File

@ -305,10 +305,10 @@ TOML_IMPL_START
struct utf8_codepoint final
{
char32_t value;
uint8_t bytes[4];
toml::source_position position;
string_char bytes[4];
source_position position;
template <typename CHAR = toml::string_char>
template <typename CHAR = string_char>
[[nodiscard]] TOML_ALWAYS_INLINE
std::basic_string_view<CHAR> as_view() const noexcept
{
@ -318,8 +318,8 @@ TOML_IMPL_START
);
return bytes[3]
? std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR* const>(bytes), 4_sz }
: std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR* const>(bytes) };
? std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR*>(bytes), 4_sz }
: std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR*>(bytes) };
}
[[nodiscard]]
@ -339,7 +339,7 @@ TOML_IMPL_START
#if TOML_EXCEPTIONS
#define TOML_ERROR_CHECK (void)0
#define TOML_ERROR throw toml::parse_error
#define TOML_ERROR throw parse_error
#else
#define TOML_ERROR_CHECK if (err) return nullptr
#define TOML_ERROR err.emplace
@ -348,7 +348,7 @@ TOML_IMPL_START
struct TOML_INTERFACE utf8_reader_interface
{
[[nodiscard]]
virtual const toml::source_path_ptr& source_path() const noexcept = 0;
virtual const source_path_ptr& source_path() const noexcept = 0;
[[nodiscard]]
virtual const utf8_codepoint* read_next() TOML_MAY_THROW = 0;
@ -356,7 +356,7 @@ TOML_IMPL_START
#if !TOML_EXCEPTIONS
[[nodiscard]]
virtual std::optional<toml::parse_error>&& error() noexcept = 0;
virtual std::optional<parse_error>&& error() noexcept = 0;
#endif
@ -374,7 +374,7 @@ TOML_IMPL_START
uint8_t current_byte_count{};
source_path_ptr source_path_;
#if !TOML_EXCEPTIONS
std::optional<toml::parse_error> err;
std::optional<parse_error> err;
#endif
public:
@ -426,11 +426,11 @@ TOML_IMPL_START
}
catch (const std::exception& exc)
{
throw toml::parse_error{ exc.what(), prev.position, source_path_ };
throw parse_error{ exc.what(), prev.position, source_path_ };
}
catch (...)
{
throw toml::parse_error{ "An unspecified error occurred", prev.position, source_path_ };
throw parse_error{ "An unspecified error occurred", prev.position, source_path_ };
}
}
#endif
@ -457,7 +457,7 @@ TOML_IMPL_START
TOML_ERROR_CHECK;
current.bytes[current_byte_count++] = *nextByte;
current.bytes[current_byte_count++] = static_cast<string_char>(*nextByte);
if (decoder.has_code_point())
{
current.value = decoder.codepoint;
@ -481,7 +481,7 @@ TOML_IMPL_START
#if !TOML_EXCEPTIONS
[[nodiscard]]
std::optional<toml::parse_error>&& error() noexcept override
std::optional<parse_error>&& error() noexcept override
{
return std::move(err);
}
@ -532,7 +532,7 @@ TOML_IMPL_START
{}
[[nodiscard]]
const toml::source_path_ptr& source_path() const noexcept override
const source_path_ptr& source_path() const noexcept override
{
return reader.source_path();
}
@ -592,7 +592,7 @@ TOML_IMPL_START
#if !TOML_EXCEPTIONS
[[nodiscard]]
std::optional<toml::parse_error>&& error() noexcept override
std::optional<parse_error>&& error() noexcept override
{
return reader.error();
}

View File

@ -2,7 +2,7 @@
#define TOML_LIB_MAJOR 0
#define TOML_LIB_MINOR 2
#define TOML_LIB_PATCH 1
#define TOML_LIB_PATCH 2
#define TOML_LANG_MAJOR 0
#define TOML_LANG_MINOR 5

View File

@ -62,6 +62,13 @@ type_names = [
'bool',
'pair',
'tuple',
'istream',
'ostream',
'ifstream',
'ofstream',
'stringstream',
'istringstream',
'ostringstream'
]
all_namespaces = [
'std',
@ -296,23 +303,6 @@ class NavBarFix(object):
# changes any links to index.html to link to namespacetoml.html instead (index.html is blank/unused)
class IndexHrefFix(object):
def __call__(self, file, doc):
links = doc.body('a', href='index.html')
if (len(links) > 0):
for link in links:
link['href'] = 'namespacetoml.html'
return True
return False
#=======================================================================================================================
# base type for modifier parsing fixers.
class ModifiersFixBase(object):
_modifierRegex = "defaulted|noexcept|constexpr|(?:pure )?virtual|protected|__(?:(?:vector|std|fast)call|cdecl)"
@ -414,6 +404,22 @@ class ModifiersFix2(ModifiersFixBase):
# applies some basic fixes to index.html
class IndexPageFix(object):
def __call__(self, file, doc):
if file != 'index.html':
return False
parent = doc.body.main.article.div.div.div
parent('h1')[0].replace_with(parent('img')[0].extract())
return True
#=======================================================================================================================
# base type for applying inline namespace annotations.
class InlineNamespaceFixBase(object):
_namespaceFiles = ['namespace{}.html'.format(ns.lower().replace('::','_1_1')) for ns in inline_namespaces]
@ -569,7 +575,7 @@ class SyntaxHighlightingFix(object):
name['class'] = 'sa'
changed = True
# user types and typedefs
# types and typedefs
names = names_ + code_block('span', class_='kt')
for name in names:
if (name.string is not None and name.string in type_names):
@ -910,7 +916,7 @@ def main():
CustomTagsFix()
, SyntaxHighlightingFix()
#, NavBarFix()
#, IndexHrefFix()
, IndexPageFix()
, ModifiersFix1()
, ModifiersFix2()
, InlineNamespaceFix1()

View File

@ -37,23 +37,23 @@ char_noexcept = executable(
test('char_noexcept', char_noexcept)
strict_char = executable(
'strict_char',
char_strict = executable(
'char_strict',
test_sources,
include_directories : inc,
cpp_args : [ no_unreleased_features ]
)
test('strict_char', strict_char)
test('char_strict', char_strict)
strict_char_noexcept = executable(
'strict_char_noexcept',
char_strict_noexcept = executable(
'char_strict_noexcept',
test_sources,
include_directories : inc,
override_options : [ disable_exceptions ],
cpp_args : [ no_unreleased_features ]
)
test('strict_char_noexcept', strict_char_noexcept)
test('char_strict_noexcept', char_strict_noexcept)
if compiler_supports_char8_strings
@ -76,22 +76,22 @@ if compiler_supports_char8_strings
)
test('char8_noexcept', char8_noexcept)
strict_char8 = executable(
'strict_char8',
char8_strict = executable(
'char8_strict',
test_sources,
include_directories : inc,
override_options : [ manually_set_cpp_std ],
cpp_args : [ cpp20, define_toml_use_char8_strings, no_unreleased_features ]
)
test('strict_char8', strict_char8)
test('char8_strict', char8_strict)
strict_char8_noexcept = executable(
'strict_char8_noexcept',
char8_strict_noexcept = executable(
'char8_strict_noexcept',
test_sources,
include_directories : inc,
override_options : [ manually_set_cpp_std, disable_exceptions ],
cpp_args : [ cpp20, define_toml_use_char8_strings, no_unreleased_features ]
)
test('strict_char8_noexcept', strict_char8_noexcept)
test('char8_strict_noexcept', char8_strict_noexcept)
endif

View File

@ -1,6 +1,6 @@
//----------------------------------------------------------------------------------------------------------------------
//
// toml++ v0.2.1
// toml++ v0.2.2
// https://github.com/marzer/tomlplusplus
// SPDX-License-Identifier: MIT
//
@ -204,21 +204,21 @@
#elif TOML_CPP_VERSION >= 201703L
#define TOML_CPP 17
#endif
#ifndef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 1
#endif
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#if TOML_EXCEPTIONS
#define TOML_MAY_THROW
#define TOML_MAY_THROW_UNLESS(...) noexcept(__VA_ARGS__)
#define TOML_INLINE_NS_EX
#else
#define TOML_MAY_THROW noexcept
#define TOML_MAY_THROW_UNLESS(...) noexcept
#define TOML_INLINE_NS_EX _noex
#endif
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
@ -295,7 +295,7 @@
#define TOML_LIB_MAJOR 0
#define TOML_LIB_MINOR 2
#define TOML_LIB_PATCH 1
#define TOML_LIB_PATCH 2
#define TOML_LANG_MAJOR 0
#define TOML_LANG_MINOR 5
@ -321,17 +321,17 @@
#define TOML_LANG_EXACTLY(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION == TOML_MAKE_VERSION(maj, min, rev))
#if !TOML_DOXYGEN
#if TOML_CHAR_8_STRINGS
#define TOML_INLINE_NS_CHAR_8 _char8
#else
#define TOML_INLINE_NS_CHAR_8
#endif
#if TOML_EXCEPTIONS
#define TOML_INLINE_NS_EX
#else
#define TOML_INLINE_NS_EX _noex
#endif
#if !TOML_DOXYGEN
#define TOML_START_2(VER, ARG1, ARG2) namespace toml { inline namespace v##VER##ARG1##ARG2
#define TOML_START_1(VER, ARG1, ARG2) TOML_START_2(VER, ARG1, ARG2)
#define TOML_START TOML_START_1(TOML_LIB_MAJOR,TOML_INLINE_NS_EX,)
#define TOML_START TOML_START_1(TOML_LIB_MAJOR,TOML_INLINE_NS_EX,TOML_INLINE_NS_CHAR_8)
#define TOML_END }
#endif
@ -4391,10 +4391,10 @@ TOML_IMPL_START
struct utf8_codepoint final
{
char32_t value;
uint8_t bytes[4];
toml::source_position position;
string_char bytes[4];
source_position position;
template <typename CHAR = toml::string_char>
template <typename CHAR = string_char>
[[nodiscard]] TOML_ALWAYS_INLINE
std::basic_string_view<CHAR> as_view() const noexcept
{
@ -4404,8 +4404,8 @@ TOML_IMPL_START
);
return bytes[3]
? std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR* const>(bytes), 4_sz }
: std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR* const>(bytes) };
? std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR*>(bytes), 4_sz }
: std::basic_string_view<CHAR>{ reinterpret_cast<const CHAR*>(bytes) };
}
[[nodiscard]]
@ -4425,7 +4425,7 @@ TOML_IMPL_START
#if TOML_EXCEPTIONS
#define TOML_ERROR_CHECK (void)0
#define TOML_ERROR throw toml::parse_error
#define TOML_ERROR throw parse_error
#else
#define TOML_ERROR_CHECK if (err) return nullptr
#define TOML_ERROR err.emplace
@ -4434,7 +4434,7 @@ TOML_IMPL_START
struct TOML_INTERFACE utf8_reader_interface
{
[[nodiscard]]
virtual const toml::source_path_ptr& source_path() const noexcept = 0;
virtual const source_path_ptr& source_path() const noexcept = 0;
[[nodiscard]]
virtual const utf8_codepoint* read_next() TOML_MAY_THROW = 0;
@ -4442,7 +4442,7 @@ TOML_IMPL_START
#if !TOML_EXCEPTIONS
[[nodiscard]]
virtual std::optional<toml::parse_error>&& error() noexcept = 0;
virtual std::optional<parse_error>&& error() noexcept = 0;
#endif
@ -4460,7 +4460,7 @@ TOML_IMPL_START
uint8_t current_byte_count{};
source_path_ptr source_path_;
#if !TOML_EXCEPTIONS
std::optional<toml::parse_error> err;
std::optional<parse_error> err;
#endif
public:
@ -4512,11 +4512,11 @@ TOML_IMPL_START
}
catch (const std::exception& exc)
{
throw toml::parse_error{ exc.what(), prev.position, source_path_ };
throw parse_error{ exc.what(), prev.position, source_path_ };
}
catch (...)
{
throw toml::parse_error{ "An unspecified error occurred", prev.position, source_path_ };
throw parse_error{ "An unspecified error occurred", prev.position, source_path_ };
}
}
#endif
@ -4543,7 +4543,7 @@ TOML_IMPL_START
TOML_ERROR_CHECK;
current.bytes[current_byte_count++] = *nextByte;
current.bytes[current_byte_count++] = static_cast<string_char>(*nextByte);
if (decoder.has_code_point())
{
current.value = decoder.codepoint;
@ -4567,7 +4567,7 @@ TOML_IMPL_START
#if !TOML_EXCEPTIONS
[[nodiscard]]
std::optional<toml::parse_error>&& error() noexcept override
std::optional<parse_error>&& error() noexcept override
{
return std::move(err);
}
@ -4618,7 +4618,7 @@ TOML_IMPL_START
{}
[[nodiscard]]
const toml::source_path_ptr& source_path() const noexcept override
const source_path_ptr& source_path() const noexcept override
{
return reader.source_path();
}
@ -4678,7 +4678,7 @@ TOML_IMPL_START
#if !TOML_EXCEPTIONS
[[nodiscard]]
std::optional<toml::parse_error>&& error() noexcept override
std::optional<parse_error>&& error() noexcept override
{
return reader.error();
}
@ -8591,6 +8591,7 @@ TOML_END
#undef TOML_RELOPS_REORDERING
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
#undef TOML_INLINE_NS_EX
#undef TOML_INLINE_NS_CHAR_8
#undef TOML_START
#undef TOML_START_2
#undef TOML_START_1

View File

@ -15,13 +15,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_char8", "test_char8.vc
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_char8_noexcept", "test_char8_noexcept.vcxproj", "{F094F967-42B5-4AD7-AB44-EA044CD9837E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_strict_char", "test_strict_char.vcxproj", "{89FF67C6-94C0-4C46-8411-7549A36584FB}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_char_strict", "test_char_strict.vcxproj", "{89FF67C6-94C0-4C46-8411-7549A36584FB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_strict_char_noexcept", "test_strict_char_noexcept.vcxproj", "{F05F8C1B-7E23-4147-901E-AD91092E5752}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_char_strict_noexcept", "test_char_strict_noexcept.vcxproj", "{F05F8C1B-7E23-4147-901E-AD91092E5752}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_strict_char8", "test_strict_char8.vcxproj", "{EAC419E9-0C72-4625-B2B9-E879F697021A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_char8_strict", "test_char8_strict.vcxproj", "{EAC419E9-0C72-4625-B2B9-E879F697021A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_strict_char8_noexcept", "test_strict_char8_noexcept.vcxproj", "{9ADB61D3-FDFA-4A9C-A34F-663007BB70F6}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_char8_strict_noexcept", "test_char8_strict_noexcept.vcxproj", "{9ADB61D3-FDFA-4A9C-A34F-663007BB70F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{412816A5-9D22-4A30-BCDF-ABFB54BB3735}"
EndProject
@ -37,13 +37,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_char8", "test_x86_
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_char8_noexcept", "test_x86_char8_noexcept.vcxproj", "{BE980D05-770C-4420-B59B-EAD7A63468D2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_strict_char", "test_x86_strict_char.vcxproj", "{3B05742A-6512-4B11-8842-A1B9D1465B1F}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_char_strict", "test_x86_char_strict.vcxproj", "{3B05742A-6512-4B11-8842-A1B9D1465B1F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_strict_char_noexcept", "test_x86_strict_char_noexcept.vcxproj", "{0BBEE569-536D-452C-808C-61843FECCC7E}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_char_strict_noexcept", "test_x86_char_strict_noexcept.vcxproj", "{0BBEE569-536D-452C-808C-61843FECCC7E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_strict_char8", "test_x86_strict_char8.vcxproj", "{A4F27C6F-601D-45C0-9F81-7C100BD93B9A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_char8_strict", "test_x86_char8_strict.vcxproj", "{A4F27C6F-601D-45C0-9F81-7C100BD93B9A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_strict_char8_noexcept", "test_x86_strict_char8_noexcept.vcxproj", "{0CAD095A-C9F2-49FC-9C9F-4508498BE488}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_x86_char8_strict_noexcept", "test_x86_char8_strict_noexcept.vcxproj", "{0CAD095A-C9F2-49FC-9C9F-4508498BE488}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution