From d47174954fb5c42900dd5e1102e637303f097823 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 13 Nov 2019 18:00:28 +0900 Subject: [PATCH] feat: colorize user-defined msg by format_error --- toml/value.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/toml/value.hpp b/toml/value.hpp index 64f8b5c..f0fc5ca 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -1843,25 +1843,27 @@ operator>=(const basic_value& lhs, const basic_value& rhs) template class T, template class A> inline std::string format_error(const std::string& err_msg, const basic_value& v, const std::string& comment, - std::vector hints = {}) + std::vector hints = {}, + const bool colorize = TOML11_COLORED_MESSAGE_ACTIVATED) { return detail::format_underline(err_msg, std::vector>{ {std::addressof(detail::get_region(v)), comment} - }, std::move(hints)); + }, std::move(hints), colorize); } template class T, template class A> inline std::string format_error(const std::string& err_msg, const toml::basic_value& v1, const std::string& comment1, const toml::basic_value& v2, const std::string& comment2, - std::vector hints = {}) + std::vector hints = {}, + const bool colorize = TOML11_COLORED_MESSAGE_ACTIVATED) { return detail::format_underline(err_msg, std::vector>{ {std::addressof(detail::get_region(v1)), comment1}, {std::addressof(detail::get_region(v2)), comment2} - }, std::move(hints)); + }, std::move(hints), colorize); } template class T, template class A> @@ -1869,14 +1871,15 @@ inline std::string format_error(const std::string& err_msg, const toml::basic_value& v1, const std::string& comment1, const toml::basic_value& v2, const std::string& comment2, const toml::basic_value& v3, const std::string& comment3, - std::vector hints = {}) + std::vector hints = {}, + const bool colorize = TOML11_COLORED_MESSAGE_ACTIVATED) { return detail::format_underline(err_msg, std::vector>{ {std::addressof(detail::get_region(v1)), comment1}, {std::addressof(detail::get_region(v2)), comment2}, {std::addressof(detail::get_region(v3)), comment3} - }, std::move(hints)); + }, std::move(hints), colorize); } template