mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-08 13:50:06 +00:00
feat: use comment macro everywhere
This commit is contained in:
parent
d90c26f9ac
commit
c40e0dbd37
@ -12,11 +12,11 @@ inline namespace toml_literals
|
||||
{
|
||||
|
||||
// implementation
|
||||
inline ::toml::basic_value<::toml::discard_comments, std::unordered_map, std::vector>
|
||||
inline ::toml::basic_value<TOML11_DEFAULT_COMMENT_STRATEGY, std::unordered_map, std::vector>
|
||||
literal_internal_impl(::toml::detail::location loc)
|
||||
{
|
||||
using value_type = ::toml::basic_value<
|
||||
::toml::discard_comments, std::unordered_map, std::vector>;
|
||||
TOML11_DEFAULT_COMMENT_STRATEGY, std::unordered_map, std::vector>;
|
||||
// if there are some comments or empty lines, skip them.
|
||||
using skip_line = ::toml::detail::repeat<toml::detail::sequence<
|
||||
::toml::detail::maybe<::toml::detail::lex_ws>,
|
||||
@ -81,7 +81,7 @@ literal_internal_impl(::toml::detail::location loc)
|
||||
|
||||
}
|
||||
|
||||
inline ::toml::basic_value<::toml::discard_comments, std::unordered_map, std::vector>
|
||||
inline ::toml::basic_value<TOML11_DEFAULT_COMMENT_STRATEGY, std::unordered_map, std::vector>
|
||||
operator"" _toml(const char* str, std::size_t len)
|
||||
{
|
||||
::toml::detail::location loc(
|
||||
@ -95,7 +95,7 @@ operator"" _toml(const char* str, std::size_t len)
|
||||
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
|
||||
// value of u8"" literal has been changed from char to char8_t and char8_t is
|
||||
// NOT compatible to char
|
||||
inline ::toml::basic_value<::toml::discard_comments, std::unordered_map, std::vector>
|
||||
inline ::toml::basic_value<TOML11_DEFAULT_COMMENT_STRATEGY, std::unordered_map, std::vector>
|
||||
operator"" _toml(const char8_t* str, std::size_t len)
|
||||
{
|
||||
::toml::detail::location loc(
|
||||
|
@ -2076,7 +2076,7 @@ result<Value, std::string> parse_toml_file(location& loc)
|
||||
|
||||
} // detail
|
||||
|
||||
template<typename Comment = ::toml::discard_comments,
|
||||
template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
||||
template<typename ...> class Table = std::unordered_map,
|
||||
template<typename ...> class Array = std::vector>
|
||||
basic_value<Comment, Table, Array>
|
||||
@ -2127,7 +2127,7 @@ parse(std::istream& is, const std::string& fname = "unknown file")
|
||||
return data.unwrap();
|
||||
}
|
||||
|
||||
template<typename Comment = ::toml::discard_comments,
|
||||
template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
||||
template<typename ...> class Table = std::unordered_map,
|
||||
template<typename ...> class Array = std::vector>
|
||||
basic_value<Comment, Table, Array> parse(const std::string& fname)
|
||||
@ -2150,7 +2150,7 @@ basic_value<Comment, Table, Array> parse(const std::string& fname)
|
||||
//
|
||||
// This function exactly matches to the invokation with c-string.
|
||||
// So this function is preferred than others and the ambiguity disappears.
|
||||
template<typename Comment = ::toml::discard_comments,
|
||||
template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
||||
template<typename ...> class Table = std::unordered_map,
|
||||
template<typename ...> class Array = std::vector>
|
||||
basic_value<Comment, Table, Array> parse(const char* fname)
|
||||
@ -2158,7 +2158,7 @@ basic_value<Comment, Table, Array> parse(const char* fname)
|
||||
return parse<Comment, Table, Array>(std::string(fname));
|
||||
}
|
||||
|
||||
template<typename Comment = ::toml::discard_comments,
|
||||
template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
||||
template<typename ...> class Table = std::unordered_map,
|
||||
template<typename ...> class Array = std::vector>
|
||||
basic_value<Comment, Table, Array> parse(const std::filesystem::path& fpath)
|
||||
|
@ -1739,7 +1739,8 @@ class basic_value
|
||||
};
|
||||
|
||||
// default toml::value and default array/table.
|
||||
using value = basic_value<discard_comments, std::unordered_map, std::vector>;
|
||||
// TOML11_DEFAULT_COMMENT_STRATEGY is defined in comments.hpp
|
||||
using value = basic_value<TOML11_DEFAULT_COMMENT_STRATEGY, std::unordered_map, std::vector>;
|
||||
using array = typename value::array_type;
|
||||
using table = typename value::table_type;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user