summaryrefslogtreecommitdiff
path: root/include/fud_format.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-29 23:16:46 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-29 23:16:46 -0500
commit8dcb1de91e15ff7fc66279cd9cd9ad8a70f624e0 (patch)
treec73840b15a074cf37f59bc3b2eff56cde982d74f /include/fud_format.hpp
parent8ce397e8c0a83e49e390de9deb73d588e4931ecf (diff)
u8 string literals
Diffstat (limited to 'include/fud_format.hpp')
-rw-r--r--include/fud_format.hpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/include/fud_format.hpp b/include/fud_format.hpp
index c06643d..4d38c26 100644
--- a/include/fud_format.hpp
+++ b/include/fud_format.hpp
@@ -24,7 +24,7 @@
#include "fud_option.hpp"
#include "fud_result.hpp"
#include "fud_status.hpp"
-#include "fud_string.hpp"
+#include "fud_string.hpp" // IWYU pragma: keep
#include "fud_string_convert.hpp"
#include "fud_string_view.hpp"
#include "fud_utf8.hpp"
@@ -42,18 +42,18 @@ constexpr size_t maxIntCharCount = bitsPerOctal * sizeof(uint64_t) + 4;
struct FormatString {
template <size_t N>
- consteval FormatString(const char (&input)[N]) : m_size{N - 1}, m_data{input}
+ consteval FormatString(const utf8 (&input)[N]) : m_size{N - 1}, m_data{input}
{
static_assert(N > 0);
}
StringView view()
{
- return StringView{m_size, reinterpret_cast<const utf8*>(m_data)};
+ return StringView{m_size, m_data};
}
size_t m_size;
- const char* m_data;
+ const utf8* m_data;
};
struct FormatAlign {
@@ -1127,7 +1127,7 @@ void fillScientificBuffer(IntCharArray& buffer, Significand significand, uint8_t
}
}
- forEach(Span<uint8_t>{buffer.data(), bufferLength}, [&](uint8_t digit) {
+ forEach(Span<utf8>{buffer.data(), bufferLength}, [&](uint8_t digit) {
return static_cast<uint8_t>(digit + '0');
});
@@ -1485,17 +1485,6 @@ FormatResult format(Sink& sink, FormatCharMode formatMode, const FormatSpec& for
return result;
}
-namespace fudTest {
-inline void test()
-{
- StringView prefix{0, ""};
- String sink{};
-
- static_cast<void>(format(sink, FormatCharMode::Unchecked, "HELL YEAH"));
- static_cast<void>(format(sink, FormatCharMode::Unchecked, "HELL YEAH", 1, true, "ye"));
-}
-} // namespace fudTest
-
} // namespace fud
#endif