mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
Remove fmt/folly.h and clean up core API
This commit is contained in:
parent
35538ca66c
commit
5befe6584d
@ -154,8 +154,8 @@ function(add_headers VAR)
|
||||
endfunction()
|
||||
|
||||
# Define the fmt library, its includes and the needed defines.
|
||||
add_headers(FMT_HEADERS core.h folly.h format.h format-inl.h ostream.h printf.h
|
||||
time.h ranges.h)
|
||||
add_headers(FMT_HEADERS core.h format.h format-inl.h ostream.h printf.h time.h
|
||||
ranges.h)
|
||||
set(FMT_SOURCES src/format.cc)
|
||||
if (HAVE_OPEN)
|
||||
add_headers(FMT_HEADERS posix.h)
|
||||
|
@ -385,9 +385,7 @@ class basic_buffer {
|
||||
}
|
||||
|
||||
/** Clears this buffer. */
|
||||
void clear() {
|
||||
size_ = 0;
|
||||
}
|
||||
void clear() { size_ = 0; }
|
||||
|
||||
/** Reserves space to store at least *capacity* elements. */
|
||||
void reserve(std::size_t new_capacity) {
|
||||
@ -1356,14 +1354,13 @@ template <typename String, typename... Args>
|
||||
inline std::basic_string<
|
||||
typename internal::format_string_traits<String>::char_type>
|
||||
format(const String &format_str, const Args & ... args) {
|
||||
typedef typename internal::format_string_traits<String>::char_type char_type;
|
||||
internal::check_format_string<Args...>(format_str);
|
||||
// This should be just
|
||||
// return vformat(format_str, make_format_args(args...));
|
||||
// but gcc has trouble optimizing the latter, so break it down.
|
||||
typedef typename buffer_context<char_type>::type context_type;
|
||||
format_arg_store<context_type, Args...> as{args...};
|
||||
return vformat(basic_string_view<char_type>(format_str), as);
|
||||
typedef typename internal::format_string_traits<String>::char_type char_t;
|
||||
format_arg_store<typename buffer_context<char_t>::type, Args...> as{args...};
|
||||
return vformat(basic_string_view<char_t>(format_str), as);
|
||||
}
|
||||
|
||||
FMT_API void vprint(std::FILE *f, string_view format_str, format_args args);
|
||||
|
@ -1,22 +0,0 @@
|
||||
// Formatting library for C++ - folly::StringPiece formatter
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_FOLLY_H_
|
||||
#define FMT_FOLLY_H_
|
||||
|
||||
#include <folly/Range.h>
|
||||
#include "core.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
template <typename Ctx>
|
||||
inline internal::typed_value<Ctx, internal::string_type>
|
||||
make_value(folly::StringPiece s) {
|
||||
return string_view(s.data(), s.size());
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_FOLLY_H_
|
@ -86,7 +86,6 @@ endfunction()
|
||||
|
||||
add_fmt_test(assert-test)
|
||||
add_fmt_test(gtest-extra-test)
|
||||
add_fmt_test(folly-test)
|
||||
add_fmt_test(format-test)
|
||||
add_fmt_test(format-impl-test)
|
||||
add_fmt_test(ostream-test)
|
||||
|
@ -1,14 +0,0 @@
|
||||
// Formatting library for C++ - folly::StringPiece formatter tests
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#include <fmt/folly.h>
|
||||
#include "gtest.h"
|
||||
|
||||
TEST(FollyTest, FormatStringPiece) {
|
||||
EXPECT_EQ(fmt::format("{}", "foo"), "foo");
|
||||
EXPECT_EQ(fmt::format("{:>5}", "foo"), " foo");
|
||||
}
|
Loading…
Reference in New Issue
Block a user