HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
text_decoration.hpp
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include <unordered_map>
8#include <string>
9#include <ostream>
10
11namespace tt {
12
19enum class text_decoration {
20 None,
21 Underline,
22 WavyUnderline,
23 StrikeThrough,
24
25 max = StrikeThrough
26};
27
28inline ttlet text_decoration_from_string_table = std::unordered_map<std::string,text_decoration>{
29 {"none", text_decoration::None},
30 {"underline", text_decoration::Underline},
31 {"wavy-underline", text_decoration::WavyUnderline},
32 {"strike-through", text_decoration::StrikeThrough},
33};
34
35[[nodiscard]] inline char const *to_const_string(text_decoration const &rhs) noexcept
36{
37 switch (rhs) {
38 case text_decoration::None: return "none";
39 case text_decoration::Underline: return "underline";
40 case text_decoration::WavyUnderline: return "wavy-underline";
41 case text_decoration::StrikeThrough: return "strike-through";
42 default: tt_no_default();
43 }
44}
45
46[[nodiscard]] inline std::string to_string(text_decoration const &rhs) noexcept
47{
48 return to_const_string(rhs);
49}
50
51inline std::ostream &operator<<(std::ostream &lhs, text_decoration const &rhs)
52{
53 return lhs << to_const_string(rhs);
54}
55
56}
T max(T... args)
T to_string(T... args)