| 1 | #cxx . . $ `<file>/conversion/stringbuilder.h`/ifndef CONVERSION_UTILITIES_STRINGBUILDER_H |
| 2 | #define CONVERSION_UTILITIES_STRINGBUILDER_Hcxx . . $ `conversion/stringbuilder.h:2:9`! |
| 3 | |
| 4 | #include "../misc/traits.h"cxx . . $ `<file>/misc/traits.h`/ |
| 5 | #include "./stringconversion.h"cxx . . $ `<file>/conversion/stringconversion.h`/ |
| 6 | |
| 7 | #include <string> |
| 8 | #include <tuple> |
| 9 | |
| 10 | namespace CppUtilitiescxx . . $ CppUtilities/ { |
| 11 | |
| 12 | /// \cond |
| 13 | namespace Helpercxx . . $ CppUtilities/Helper/ { |
| 14 | |
| 15 | template <class StringType, class ViewType> using IsStringViewTypecxx . . $ CppUtilities/Helper/IsStringViewType# = stdcxx . . $ std/::is_same<ViewType, stdcxx . . $ std/::basic_string_viewcxx . . $ std/basic_string_view#<typename StringType::value_type>>; |
| 16 | template <class StringType, class CharType> using IsCharTypecxx . . $ CppUtilities/Helper/IsCharType# = stdcxx . . $ std/::is_same<typename StringType::value_type, CharType>; |
| 17 | namespace Detailcxx . . $ CppUtilities/Helper/Detail/ { |
| 18 | template <typename StringType, typename T> |
| 19 | auto IsStringTypecxx . . $ CppUtilities/Helper/Detail/IsStringType(f7ddac69bf865aea).(int) |
| 20 | -> decltype(stdcxx . . $ std/::declval<StringType &>().append(stdcxx . . $ std/::declval<const T &>()), stdcxx . . $ std/::declval<const T &>().size(), Traitscxx . . $ CppUtilities/Traits/::Boolcxx . . $ CppUtilities/Traits/Bool#<true>{}); |
| 21 | template <typename StringType, typename T> Traitscxx . . $ CppUtilities/Traits/::Boolcxx . . $ CppUtilities/Traits/Bool#<false> IsStringTypecxx . . $ CppUtilities/Helper/Detail/IsStringType(981a2665d23c1a52).(...); |
| 22 | template <typename StringType> void functionTakingConstStringRefcxx . . $ CppUtilities/Helper/Detail/functionTakingConstStringRef(77d9f17553126ecb).(const StringType &str); |
| 23 | template <typename StringType, typename T> |
| 24 | auto IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/Detail/IsConvertibleToConstStringRef(6a3c64a79f7a7ed7).(int) -> decltype(functionTakingConstStringRefcxx . . $ CppUtilities/Helper/Detail/functionTakingConstStringRef(77d9f17553126ecb).<StringType>(stdcxx . . $ std/::declval<const T &>()), Traitscxx . . $ CppUtilities/Traits/::Boolcxx . . $ CppUtilities/Traits/Bool#<true>{}); |
| 25 | template <typename StringType, typename T> Traitscxx . . $ CppUtilities/Traits/::Boolcxx . . $ CppUtilities/Traits/Bool#<false> IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/Detail/IsConvertibleToConstStringRef(981a2665d23c1a52).(...); |
| 26 | template <typename StringType, typename T> |
| 27 | auto IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/Detail/IsConvertibleToConstStringRefViaNative(56342212662e5d9c).(int) |
| 28 | -> decltype(functionTakingConstStringRefcxx . . $ CppUtilities/Helper/Detail/functionTakingConstStringRef(77d9f17553126ecb).<StringType>(stdcxx . . $ std/::declval<const T &>().native()), Traitscxx . . $ CppUtilities/Traits/::Boolcxx . . $ CppUtilities/Traits/Bool#<true>{}); |
| 29 | template <typename StringType, typename T> Traitscxx . . $ CppUtilities/Traits/::Boolcxx . . $ CppUtilities/Traits/Bool#<false> IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/Detail/IsConvertibleToConstStringRefViaNative(981a2665d23c1a52).(...); |
| 30 | } // namespace Detail |
| 31 | template <typename StringType, typename StringType2> |
| 32 | using IsStringTypecxx . . $ CppUtilities/Helper/IsStringType# = Traitscxx . . $ CppUtilities/Traits/::Allcxx . . $ CppUtilities/Traits/All#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<IsStringViewTypecxx . . $ CppUtilities/Helper/IsStringViewType#<StringType, StringType2>>, decltype(Detailcxx . . $ CppUtilities/Helper/Detail/::IsStringTypecxx . . $ CppUtilities/Helper/Detail/IsStringType(f7ddac69bf865aea).<StringType, StringType2>(0))>; |
| 33 | template <typename StringType, typename StringType2> |
| 34 | using IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRefViaNative# = Traitscxx . . $ CppUtilities/Traits/::Allcxx . . $ CppUtilities/Traits/All#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<IsStringTypecxx . . $ CppUtilities/Helper/IsStringType#<StringType, StringType2>>, |
| 35 | decltype(Detailcxx . . $ CppUtilities/Helper/Detail/::IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/Detail/IsConvertibleToConstStringRefViaNative(56342212662e5d9c).<StringType, StringType2>(0))>; |
| 36 | template <typename StringType, typename StringType2> |
| 37 | using IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRef# = Traitscxx . . $ CppUtilities/Traits/::Allcxx . . $ CppUtilities/Traits/All#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<Traitscxx . . $ CppUtilities/Traits/::Anycxx . . $ CppUtilities/Traits/Any#<IsStringTypecxx . . $ CppUtilities/Helper/IsStringType#<StringType, StringType2>, IsCharTypecxx . . $ CppUtilities/Helper/IsCharType#<StringType, StringType2>, |
| 38 | IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRefViaNative#<StringType, StringType2>>>, |
| 39 | decltype(Detailcxx . . $ CppUtilities/Helper/Detail/::IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/Detail/IsConvertibleToConstStringRef(981a2665d23c1a52).<StringType, StringType2>(0))>; |
| 40 | |
| 41 | template <class StringType, class StringType2, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsStringTypecxx . . $ CppUtilities/Helper/IsStringType#<StringType, StringType2>> * = nullptr> |
| 42 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).(const StringType2 *str) |
| 43 | { |
| 44 | return str->size(); |
| 45 | } |
| 46 | |
| 47 | template <class StringType, class StringType2, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsStringTypecxx . . $ CppUtilities/Helper/IsStringType#<StringType, StringType2>> * = nullptr> |
| 48 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(52af283b3bb326b).(const StringType2 &str) |
| 49 | { |
| 50 | return str.size(); |
| 51 | } |
| 52 | |
| 53 | template <class StringType, class ConvertibleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRef#<StringType, ConvertibleType>> * = nullptr> |
| 54 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).(const ConvertibleType *str) |
| 55 | { |
| 56 | return computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).<StringType, StringType>(*str); |
| 57 | } |
| 58 | |
| 59 | template <class StringType, class ConvertibleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRef#<StringType, ConvertibleType>> * = nullptr> |
| 60 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(52af283b3bb326b).(const ConvertibleType &str) |
| 61 | { |
| 62 | return computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).<StringType, StringType>(str); |
| 63 | } |
| 64 | |
| 65 | template <class StringType, class ConvertibleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRefViaNative#<StringType, ConvertibleType>> * = nullptr> |
| 66 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).(const ConvertibleType *str) |
| 67 | { |
| 68 | return computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).<StringType, StringType>(str->native()); |
| 69 | } |
| 70 | |
| 71 | template <class StringType, class ConvertibleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRefViaNative#<StringType, ConvertibleType>> * = nullptr> |
| 72 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(52af283b3bb326b).(const ConvertibleType &str) |
| 73 | { |
| 74 | return computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).<StringType, StringType>(str.native()); |
| 75 | } |
| 76 | |
| 77 | template <class StringType, class ViewType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsStringViewTypecxx . . $ CppUtilities/Helper/IsStringViewType#<StringType, ViewType>> * = nullptr> |
| 78 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).(const ViewType *str) |
| 79 | { |
| 80 | return str->size(); |
| 81 | } |
| 82 | |
| 83 | template <class StringType, class ViewType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsStringViewTypecxx . . $ CppUtilities/Helper/IsStringViewType#<StringType, ViewType>> * = nullptr> |
| 84 | inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(ff5c75a3021acb1).(ViewType str) |
| 85 | { |
| 86 | return str.size(); |
| 87 | } |
| 88 | |
| 89 | template <class StringType, class CharType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsCharTypecxx . . $ CppUtilities/Helper/IsCharType#<StringType, CharType>> * = nullptr> |
| 90 | constexpr stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).(const CharType *str) |
| 91 | { |
| 92 | return stdcxx . . $ std/::char_traitscxx . . $ std/char_traits#<CharType>::length(str); |
| 93 | } |
| 94 | |
| 95 | template <class StringType, class CharType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsCharTypecxx . . $ CppUtilities/Helper/IsCharType#<StringType, CharType>> * = nullptr> |
| 96 | constexpr stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(ff5c75a3021acb1).(CharType) |
| 97 | { |
| 98 | return 1; |
| 99 | } |
| 100 | |
| 101 | template <class StringType, typename IntegralType, |
| 102 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<stdcxx . . $ std/::is_same<typename StringType::value_type, IntegralType>>, stdcxx . . $ std/::is_integral<IntegralType>, |
| 103 | stdcxx . . $ std/::is_unsigned<IntegralType>> * = nullptr> |
| 104 | constexpr stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(326ce2b13b27697a).(IntegralType number, IntegralType base = 10) |
| 105 | { |
| 106 | auto size = stdcxx . . $ std/::size_tcxx . . $ std/size_t#(0u); |
| 107 | for (auto n = number; n; n /= base, ++size) |
| 108 | ; |
| 109 | return size; |
| 110 | } |
| 111 | |
| 112 | template <class StringType, typename IntegralType, |
| 113 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<stdcxx . . $ std/::is_same<typename StringType::value_type, IntegralType>>, stdcxx . . $ std/::is_integral<IntegralType>, |
| 114 | stdcxx . . $ std/::is_signed<IntegralType>> * = nullptr> |
| 115 | constexpr stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(326ce2b13b27697a).(IntegralType number, IntegralType base = 10) |
| 116 | { |
| 117 | auto size = stdcxx . . $ std/::size_tcxx . . $ std/size_t#(number < 0 ? 1u : 0u); |
| 118 | for (auto n = number; n; n /= base, ++size) |
| 119 | ; |
| 120 | return size; |
| 121 | } |
| 122 | |
| 123 | template <class StringType, typename TupleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<stdcxx . . $ std/::decay_t<TupleType>, stdcxx . . $ std/::tuple>> * = nullptr> |
| 124 | constexpr stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a89405809a50d124).(TupleType &&tuple, typename StringType::value_type base = 10); |
| 125 | |
| 126 | template <class StringType, class StringType2, |
| 127 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<IsStringTypecxx . . $ CppUtilities/Helper/IsStringType#<StringType, StringType2>, IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRef#<StringType, StringType2>> * = nullptr> |
| 128 | inline void appendcxx . . $ CppUtilities/Helper/append(efa234105fcf1bd).(StringType &target, const StringType2 *str) |
| 129 | { |
| 130 | target.append(*str); |
| 131 | } |
| 132 | |
| 133 | template <class StringType, class StringType2, |
| 134 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<IsStringTypecxx . . $ CppUtilities/Helper/IsStringType#<StringType, StringType2>, IsConvertibleToConstStringRefcxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRef#<StringType, StringType2>> * = nullptr> |
| 135 | inline void appendcxx . . $ CppUtilities/Helper/append(36a71afa913f8f0f).(StringType &target, const StringType2 &str) |
| 136 | { |
| 137 | target.append(str); |
| 138 | } |
| 139 | |
| 140 | template <class StringType, class StringType2, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRefViaNative#<StringType, StringType2>> * = nullptr> |
| 141 | inline void appendcxx . . $ CppUtilities/Helper/append(efa234105fcf1bd).(StringType &target, const StringType2 *str) |
| 142 | { |
| 143 | target.append(str->native()); |
| 144 | } |
| 145 | |
| 146 | template <class StringType, class StringType2, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsConvertibleToConstStringRefViaNativecxx . . $ CppUtilities/Helper/IsConvertibleToConstStringRefViaNative#<StringType, StringType2>> * = nullptr> |
| 147 | inline void appendcxx . . $ CppUtilities/Helper/append(36a71afa913f8f0f).(StringType &target, const StringType2 &str) |
| 148 | { |
| 149 | target.append(str.native()); |
| 150 | } |
| 151 | |
| 152 | template <class StringType, class ViewType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsStringViewTypecxx . . $ CppUtilities/Helper/IsStringViewType#<StringType, ViewType>> * = nullptr> |
| 153 | inline void appendcxx . . $ CppUtilities/Helper/append(efa234105fcf1bd).(StringType &target, const ViewType *str) |
| 154 | { |
| 155 | target.append(*str); |
| 156 | } |
| 157 | |
| 158 | template <class StringType, class ViewType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsStringViewTypecxx . . $ CppUtilities/Helper/IsStringViewType#<StringType, ViewType>> * = nullptr> |
| 159 | inline void appendcxx . . $ CppUtilities/Helper/append(33274b2173bbdc28).(StringType &target, ViewType str) |
| 160 | { |
| 161 | target.append(str); |
| 162 | } |
| 163 | |
| 164 | template <class StringType, class CharType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsCharTypecxx . . $ CppUtilities/Helper/IsCharType#<StringType, CharType>> * = nullptr> |
| 165 | inline void appendcxx . . $ CppUtilities/Helper/append(efa234105fcf1bd).(StringType &target, const CharType *str) |
| 166 | { |
| 167 | target.append(str); |
| 168 | } |
| 169 | |
| 170 | template <class StringType, class CharType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<IsCharTypecxx . . $ CppUtilities/Helper/IsCharType#<StringType, CharType>> * = nullptr> |
| 171 | inline void appendcxx . . $ CppUtilities/Helper/append(33274b2173bbdc28).(StringType &target, CharType c) |
| 172 | { |
| 173 | target +=cxx . . $ CppUtilities/`operator+=`(5671dc112b6671d4). c; |
| 174 | } |
| 175 | |
| 176 | template <class StringType, typename IntegralType, |
| 177 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<stdcxx . . $ std/::is_same<typename StringType::value_type, IntegralType>>, stdcxx . . $ std/::is_integral<IntegralType>, |
| 178 | stdcxx . . $ std/::is_unsigned<IntegralType>> * = nullptr> |
| 179 | inline void appendcxx . . $ CppUtilities/Helper/append(b3fe0328b6ef2113).(StringType &target, IntegralType number, IntegralType base = 10) |
| 180 | { |
| 181 | const auto start = target.begin() +cxx . . $ CppUtilities/operator+(aea77c219e118c30). static_cast<typename StringType::difference_type>(target.size()); |
| 182 | do { |
| 183 | target.insert(start, static_cast<typename StringType::value_type>(digitToCharcxx . . $ CppUtilities/digitToChar(ada6a8422704cf8a).<IntegralType>(number % base))); |
| 184 | number /= base; |
| 185 | } while (number); |
| 186 | } |
| 187 | |
| 188 | template <class StringType, typename IntegralType, |
| 189 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::Notcxx . . $ CppUtilities/Traits/Not#<stdcxx . . $ std/::is_same<typename StringType::value_type, IntegralType>>, stdcxx . . $ std/::is_integral<IntegralType>, |
| 190 | stdcxx . . $ std/::is_signed<IntegralType>> * = nullptr> |
| 191 | inline void appendcxx . . $ CppUtilities/Helper/append(b3fe0328b6ef2113).(StringType &target, IntegralType number, IntegralType base = 10) |
| 192 | { |
| 193 | if (number < 0) { |
| 194 | target +=cxx . . $ CppUtilities/`operator+=`(5671dc112b6671d4). '-'; |
| 195 | number = -number; |
| 196 | } |
| 197 | const auto start = target.begin() +cxx . . $ CppUtilities/operator+(aea77c219e118c30). static_cast<typename StringType::difference_type>(target.size()); |
| 198 | do { |
| 199 | target.insert(start, static_cast<typename StringType::value_type>(digitToCharcxx . . $ CppUtilities/digitToChar(ada6a8422704cf8a).<IntegralType>(number % base))); |
| 200 | number /= base; |
| 201 | } while (number); |
| 202 | } |
| 203 | |
| 204 | template <class StringType, typename TupleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<stdcxx . . $ std/::decay_t<TupleType>, stdcxx . . $ std/::tuple>> * = nullptr> |
| 205 | constexpr void appendcxx . . $ CppUtilities/Helper/append(255a3a2b6271df8d).(StringType &target, TupleType &&tuple, typename StringType::value_type base = 10); |
| 206 | |
| 207 | template <class StringType, class Tuple, stdcxx . . $ std/::size_tcxx . . $ std/size_t# N> struct TupleToStringcxx . . $ CppUtilities/Helper/TupleToString# { |
| 208 | static inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# precomputeSizecxx . . $ CppUtilities/Helper/TupleToString#precomputeSize(52af283b3bb326b).(const Tuple &tuple) |
| 209 | { |
| 210 | return TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, Tuple, N - 1>::precomputeSize(tuple) +cxx . . $ CppUtilities/operator+(aea77c219e118c30). computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(ff5c75a3021acb1).<StringType>(stdcxx . . $ std/::getcxx . . $ std/get(2b8af70fa318720a).<N - 1>(tuple)); |
| 211 | } |
| 212 | |
| 213 | static inline void appendcxx . . $ CppUtilities/Helper/TupleToString#append(79c520cfa88fa673).(const Tuple &tuple, StringType &str) |
| 214 | { |
| 215 | TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, Tuple, N - 1>::append(tuple, str); |
| 216 | Helpercxx . . $ CppUtilities/Helper/::appendcxx . . $ CppUtilities/Helper/append(255a3a2b6271df8d).(str, stdcxx . . $ std/::getcxx . . $ std/get(9a1b01079da03411).<N - 1>(tuple)); |
| 217 | } |
| 218 | }; |
| 219 | |
| 220 | template <class StringType, class Tuple> struct TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, Tuple, 1> { |
| 221 | static inline stdcxx . . $ std/::size_tcxx . . $ std/size_t# precomputeSizecxx . . $ CppUtilities/Helper/TupleToString#precomputeSize(52af283b3bb326b).(const Tuple &tuple) |
| 222 | { |
| 223 | return computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a99cc4ca594389e).<StringType>(stdcxx . . $ std/::getcxx . . $ std/get(85b7410325da9aa2).<0>(tuple)); |
| 224 | } |
| 225 | |
| 226 | static inline void appendcxx . . $ CppUtilities/Helper/TupleToString#append(79c520cfa88fa673).(const Tuple &tuple, StringType &str) |
| 227 | { |
| 228 | Helpercxx . . $ CppUtilities/Helper/::appendcxx . . $ CppUtilities/Helper/append(efa234105fcf1bd).(str, stdcxx . . $ std/::getcxx . . $ std/get(70afc5746c4001b1).<0>(tuple)); |
| 229 | } |
| 230 | }; |
| 231 | |
| 232 | template <class StringType, typename TupleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<stdcxx . . $ std/::decay_t<TupleType>, stdcxx . . $ std/::tuple>> *> |
| 233 | constexpr stdcxx . . $ std/::size_tcxx . . $ std/size_t# computeTupleElementSizecxx . . $ CppUtilities/Helper/computeTupleElementSize(a89405809a50d124).(TupleType &&tuple, typename StringType::value_type base) |
| 234 | { |
| 235 | CPP_UTILITIES_UNUSEDcxx . . $ `application/global.h:108:9`!(base) |
| 236 | return TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, TupleType, std::tuple_size_v<std::decay_t<TupleType>>>::precomputeSize(stdcxx . . $ std/::forwardcxx . . $ std/forward(f56228ea88711827).<TupleType>(tuple)); |
| 237 | } |
| 238 | |
| 239 | template <class StringType, typename TupleType, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<stdcxx . . $ std/::decay_t<TupleType>, stdcxx . . $ std/::tuple>> *> |
| 240 | constexpr void appendcxx . . $ CppUtilities/Helper/append(255a3a2b6271df8d).(StringType &target, TupleType &&tuple, typename StringType::value_type base) |
| 241 | { |
| 242 | CPP_UTILITIES_UNUSEDcxx . . $ `application/global.h:108:9`!(base) |
| 243 | return TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, TupleType, std::tuple_size_v<std::decay_t<TupleType>>>::append(stdcxx . . $ std/::forwardcxx . . $ std/forward(2d11db7e2d3d358e).<TupleType>(tuple), target); |
| 244 | } |
| 245 | |
| 246 | } // namespace Helper |
| 247 | /// \endcond |
| 248 | |
| 249 | /*! |
| 250 | * \brief Concatenates all strings hold by the specified \a tuple. |
| 251 | */ |
| 252 | template <class StringType = stdcxx . . $ std/::stringcxx . . $ std/string#, class... Args> inline StringType tupleToStringcxx . . $ CppUtilities/tupleToString(cb4de3d3085d9c2e).(const stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Args...> &tuple) |
| 253 | { |
| 254 | StringType res; |
| 255 | res.reserve(Helpercxx . . $ CppUtilities/Helper/::TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, decltype(tuple), sizeof...(Args)>::precomputeSize(tuple)); |
| 256 | Helpercxx . . $ CppUtilities/Helper/::TupleToStringcxx . . $ CppUtilities/Helper/TupleToString#<StringType, decltype(tuple), sizeof...(Args)>::append(tuple, res); |
| 257 | return res; |
| 258 | } |
| 259 | |
| 260 | template <class StringType = stdcxx . . $ std/::stringcxx . . $ std/string#, class... Args> inline StringType argsToStringcxx . . $ CppUtilities/argsToString(2bd17df601864384).(Args &&...args) |
| 261 | { |
| 262 | return tupleToStringcxx . . $ CppUtilities/tupleToString(cb4de3d3085d9c2e).(stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Args &&...>(stdcxx . . $ std/::forwardcxx . . $ std/forward(2d11db7e2d3d358e).<Args>(args)...)); |
| 263 | } |
| 264 | |
| 265 | /*! |
| 266 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 267 | */ |
| 268 | template <class Tuple, class StringType, |
| 269 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<Tuple, stdcxx . . $ std/::tuple>, |
| 270 | Traitscxx . . $ CppUtilities/Traits/::IsSpecializingAnyOfcxx . . $ CppUtilities/Traits/IsSpecializingAnyOf#<StringType, stdcxx . . $ std/::basic_string, stdcxx . . $ std/::basic_string_view>> * = nullptr> |
| 271 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(9d516d6923395f9b).%(const Tuple &lhs, const StringType &rhs) -> decltype(stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &>(rhs))) |
| 272 | { |
| 273 | return stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &>(rhs)); |
| 274 | } |
| 275 | |
| 276 | /*! |
| 277 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 278 | */ |
| 279 | template <class Tuple, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<Tuple, stdcxx . . $ std/::tuple>> * = nullptr> |
| 280 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(a1b9ce40112533e5).%(const Tuple &lhs, const char *rhs) -> decltype(stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/tuple#tuple(302f34f1d6e23d4f).::tuplecxx . . $ std/tuple#<const char *>(rhs))) |
| 281 | { |
| 282 | return stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const char *>(rhs)); |
| 283 | } |
| 284 | |
| 285 | /*! |
| 286 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 287 | */ |
| 288 | template <class Tuple, typename IntegralType, |
| 289 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<Tuple, stdcxx . . $ std/::tuple>, stdcxx . . $ std/::is_integral<IntegralType>> * = nullptr> |
| 290 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(17a32024dba86fb7).%(const Tuple &lhs, IntegralType rhs) -> decltype(stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<IntegralType>(rhs))) |
| 291 | { |
| 292 | return stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<IntegralType>(rhs)); |
| 293 | } |
| 294 | |
| 295 | /*! |
| 296 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 297 | */ |
| 298 | template <class StringType, |
| 299 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string>, Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string_view>> |
| 300 | * = nullptr> |
| 301 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(5dfbebc7623c5d0d).%(const StringType &lhs, const StringType &rhs) -> decltype(stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &, const StringType &>(lhs, rhs)) |
| 302 | { |
| 303 | return stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &, const StringType &>(lhs, rhs); |
| 304 | } |
| 305 | |
| 306 | /*! |
| 307 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 308 | */ |
| 309 | template <class StringType, |
| 310 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string>, Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string_view>> |
| 311 | * = nullptr> |
| 312 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(26aef0acf8463766).%(const char *lhs, const StringType &rhs) -> decltype(stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const char *, const StringType &>(lhs, rhs)) |
| 313 | { |
| 314 | return stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const char *, const StringType &>(lhs, rhs); |
| 315 | } |
| 316 | |
| 317 | /*! |
| 318 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 319 | */ |
| 320 | template <class StringType, |
| 321 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string>, Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string_view>> |
| 322 | * = nullptr> |
| 323 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(4c86e98e38592020).%(const StringType &lhs, const char *rhs) -> decltype(stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &, const char *>(lhs, rhs)) |
| 324 | { |
| 325 | return stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &, const char *>(lhs, rhs); |
| 326 | } |
| 327 | |
| 328 | /*! |
| 329 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 330 | */ |
| 331 | template <class StringType, |
| 332 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string>, Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string_view>> |
| 333 | * = nullptr> |
| 334 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(b410e2bb23e596e1).%(const StringType &lhs, char rhs) -> decltype(stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &, char>(lhs, rhs)) |
| 335 | { |
| 336 | return stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &, char>(lhs, rhs); |
| 337 | } |
| 338 | |
| 339 | /*! |
| 340 | * \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3. |
| 341 | */ |
| 342 | template <class StringType, |
| 343 | Traitscxx . . $ CppUtilities/Traits/::EnableIfAnycxx . . $ CppUtilities/Traits/EnableIfAny#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string>, Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string_view>> |
| 344 | * = nullptr> |
| 345 | constexpr auto operatorcxx . . $ CppUtilities/`operator%`(46ef0135dafc7330).%(char lhs, const StringType &rhs) -> decltype(stdcxx . . $ std/::tuplecxx . . $ std/tuple#<char, const StringType &>(lhs, rhs)) |
| 346 | { |
| 347 | return stdcxx . . $ std/::tuplecxx . . $ std/tuple#<char, const StringType &>(lhs, rhs); |
| 348 | } |
| 349 | |
| 350 | /*! |
| 351 | * \brief Allows construction of final string from previously constructed string-tuple and trailing string via +-operator. |
| 352 | * |
| 353 | * This is meant to be used for fast string building without multiple heap allocation, eg. |
| 354 | * |
| 355 | * ``` |
| 356 | * printVelocity("velocity: " % numberToString(velocityExample) % " km/h (" % numberToString(velocityExample / 3.6) + " m/s)")); |
| 357 | * ``` |
| 358 | */ |
| 359 | template <class Tuple, class StringType, |
| 360 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<Tuple, stdcxx . . $ std/::tuple>, |
| 361 | Traitscxx . . $ CppUtilities/Traits/::Anycxx . . $ CppUtilities/Traits/Any#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string>, Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<StringType, stdcxx . . $ std/::basic_string_view>>> |
| 362 | * = nullptr> |
| 363 | inline stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ CppUtilities/operator+(1e9fe778ba38e471).+(const Tuple &lhs, const StringType &rhs) |
| 364 | { |
| 365 | return tupleToStringcxx . . $ CppUtilities/tupleToString(cb4de3d3085d9c2e).(stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<const StringType &>(rhs))); |
| 366 | } |
| 367 | |
| 368 | /*! |
| 369 | * \brief Allows construction of final string from previously constructed string-tuple and trailing string via +-operator. |
| 370 | * |
| 371 | * This is meant to be used for fast string building without multiple heap allocation, eg. |
| 372 | * |
| 373 | * ``` |
| 374 | * printVelocity("velocity: " % numberToString(velocityExample) % " km/h (" % numberToString(velocityExample / 3.6) + " m/s)")); |
| 375 | * ``` |
| 376 | */ |
| 377 | template <class Tuple, Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<Tuple, stdcxx . . $ std/::tuple>> * = nullptr> |
| 378 | inline stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ CppUtilities/operator+(a043da18349c3b49).+(const Tuple &lhs, const char *rhs) |
| 379 | { |
| 380 | return tupleToStringcxx . . $ CppUtilities/tupleToString(cb4de3d3085d9c2e).(stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/tuple#tuple(302f34f1d6e23d4f).::tuplecxx . . $ std/tuple#<const char *>(rhs))); |
| 381 | } |
| 382 | |
| 383 | /*! |
| 384 | * \brief Allows construction of final string from previously constructed string-tuple and trailing char via +-operator. |
| 385 | * |
| 386 | * This is meant to be used for fast string building without multiple heap allocation, eg. |
| 387 | * |
| 388 | * ``` |
| 389 | * printVelocity("velocity: " % numberToString(velocityExample) % " km/h (" % numberToString(velocityExample / 3.6) + " m/s)")); |
| 390 | * ``` |
| 391 | */ |
| 392 | template <class Tuple, typename IntegralType, |
| 393 | Traitscxx . . $ CppUtilities/Traits/::EnableIfcxx . . $ CppUtilities/Traits/EnableIf#<Traitscxx . . $ CppUtilities/Traits/::IsSpecializationOfcxx . . $ CppUtilities/Traits/IsSpecializationOf#<Tuple, stdcxx . . $ std/::tuple>, stdcxx . . $ std/::is_integral<IntegralType>> * = nullptr> |
| 394 | inline stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ CppUtilities/operator+(1319022e2b30624d).+(const Tuple &lhs, IntegralType rhs) |
| 395 | { |
| 396 | return tupleToStringcxx . . $ CppUtilities/tupleToString(cb4de3d3085d9c2e).(stdcxx . . $ std/::tuple_catcxx . . $ std/tuple_cat(e4b7fdbc2fd7b4b4).(lhs, stdcxx . . $ std/::tuplecxx . . $ std/tuple#<IntegralType>(rhs))); |
| 397 | } |
| 398 | } // namespace CppUtilities |
| 399 | |
| 400 | #endif // CONVERSION_UTILITIES_STRINGBUILDER_H |