feat: use comment macro everywhere

This commit is contained in:
ToruNiina
2021-04-16 15:29:24 +09:00
parent d90c26f9ac
commit c40e0dbd37
3 changed files with 10 additions and 9 deletions

View File

@@ -12,11 +12,11 @@ inline namespace toml_literals
{ {
// implementation // 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) literal_internal_impl(::toml::detail::location loc)
{ {
using value_type = ::toml::basic_value< 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. // if there are some comments or empty lines, skip them.
using skip_line = ::toml::detail::repeat<toml::detail::sequence< using skip_line = ::toml::detail::repeat<toml::detail::sequence<
::toml::detail::maybe<::toml::detail::lex_ws>, ::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) operator"" _toml(const char* str, std::size_t len)
{ {
::toml::detail::location loc( ::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 #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 // value of u8"" literal has been changed from char to char8_t and char8_t is
// NOT compatible to char // 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) operator"" _toml(const char8_t* str, std::size_t len)
{ {
::toml::detail::location loc( ::toml::detail::location loc(

View File

@@ -2076,7 +2076,7 @@ result<Value, std::string> parse_toml_file(location& loc)
} // detail } // detail
template<typename Comment = ::toml::discard_comments, template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
template<typename ...> class Table = std::unordered_map, template<typename ...> class Table = std::unordered_map,
template<typename ...> class Array = std::vector> template<typename ...> class Array = std::vector>
basic_value<Comment, Table, Array> basic_value<Comment, Table, Array>
@@ -2127,7 +2127,7 @@ parse(std::istream& is, const std::string& fname = "unknown file")
return data.unwrap(); 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 Table = std::unordered_map,
template<typename ...> class Array = std::vector> template<typename ...> class Array = std::vector>
basic_value<Comment, Table, Array> parse(const std::string& fname) 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. // This function exactly matches to the invokation with c-string.
// So this function is preferred than others and the ambiguity disappears. // 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 Table = std::unordered_map,
template<typename ...> class Array = std::vector> template<typename ...> class Array = std::vector>
basic_value<Comment, Table, Array> parse(const char* fname) 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)); 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 Table = std::unordered_map,
template<typename ...> class Array = std::vector> template<typename ...> class Array = std::vector>
basic_value<Comment, Table, Array> parse(const std::filesystem::path& fpath) basic_value<Comment, Table, Array> parse(const std::filesystem::path& fpath)

View File

@@ -1739,7 +1739,8 @@ class basic_value
}; };
// default toml::value and default array/table. // 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 array = typename value::array_type;
using table = typename value::table_type; using table = typename value::table_type;