From 3fa1ed052fb15998912a939785b2afe69861a69e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 18 Sep 2023 12:37:36 -0400 Subject: [PATCH] indentlog: refactor: function_name_impl<> rep uses color_spec --- include/indentlog/function.hpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/indentlog/function.hpp b/include/indentlog/function.hpp index 85727eb9..65ee5ae5 100644 --- a/include/indentlog/function.hpp +++ b/include/indentlog/function.hpp @@ -29,11 +29,11 @@ namespace xo { color_encoding encoding, std::uint32_t color, std::string_view pretty) - : style_{style}, encoding_{encoding}, color_{color}, pretty_{pretty} {} + : style_{style}, color_spec_(encoding, color), pretty_{pretty} {} function_style style() const { return style_; } - color_encoding encoding() const { return encoding_; } - std::uint32_t color() const { return color_; } + color_encoding encoding() const { return color_spec_.encoding(); } + std::uint32_t color() const { return color_spec_.code(); } std::string_view const & pretty() const { return pretty_; } /* e.g. @@ -232,10 +232,8 @@ namespace xo { private: /* FS_Simple | FS_Pretty (= FS_Literal) | FS_Streamlined */ function_style style_; - /* CE_Ansi | CE_Xterm */ - color_encoding encoding_; - /* color, if non-zero */ - std::uint32_t color_; + /* terminal color (controls vt100 escape) */ + color_spec color_spec_; /* e.g. __PRETTY_FUNCTION__ */ std::string_view pretty_; }; /*function_name_impl*/