fd/fmt: Don't depend on fmtlib
We still support fmtlib expressions but our code doesn't use fmtlib for
anything now.
Change-Id: I186d23deaba3bbc5450f69e3d94f1812e2dec708
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/include-fd/stdplus/fd/fmt.hpp b/include-fd/stdplus/fd/fmt.hpp
index faa8dfc..73402a7 100644
--- a/include-fd/stdplus/fd/fmt.hpp
+++ b/include-fd/stdplus/fd/fmt.hpp
@@ -1,20 +1,19 @@
#pragma once
-#include <fmt/format.h>
+#include <fmt/core.h>
#include <stdplus/fd/intf.hpp>
+#include <stdplus/str/buf.hpp>
+#include <format>
#include <functional>
#include <type_traits>
#include <utility>
-namespace fmt
-{
-namespace detail
+namespace fmt::detail
{
template <typename T>
struct is_compiled_string;
-}
-} // namespace fmt
+} // namespace fmt::detail
namespace stdplus
{
@@ -32,9 +31,9 @@
FormatBuffer& operator=(FormatBuffer&&) = default;
template <typename... Args>
- inline void append(fmt::format_string<Args...> fmt, Args&&... args)
+ inline void append(std::format_string<Args...> fmt, Args&&... args)
{
- fmt::format_to(std::back_inserter(buf), fmt,
+ std::format_to(std::back_inserter(buf), fmt,
std::forward<Args>(args)...);
writeIfNeeded();
}
@@ -52,7 +51,7 @@
private:
std::reference_wrapper<Fd> fd;
- fmt::memory_buffer buf;
+ stdplus::StrBuf buf;
size_t max;
void writeIfNeeded();
diff --git a/test/fd/fmt.cpp b/test/fd/fmt.cpp
index 9448fed..397fcae 100644
--- a/test/fd/fmt.cpp
+++ b/test/fd/fmt.cpp
@@ -33,7 +33,7 @@
buf.append(FMT_COMPILE("{}"), std::string(2050, 'a'));
EXPECT_EQ(4106, fd.lseek(0, Whence::Cur));
- buf.append(FMT_STRING("hi\n"));
+ buf.append("hi\n");
EXPECT_EQ(4106, fd.lseek(0, Whence::Cur));
}
EXPECT_EQ(4109, fd.lseek(0, Whence::Cur));