mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2024-11-27 03:30:32 +00:00
🎨 🐛 Rename all shadowed types and variables
This commit is contained in:
parent
771292c328
commit
e904e891bd
@ -175,9 +175,9 @@ class format_string_compiler : public error_handler {
|
||||
repl.arg_id = part_.part_kind == part::kind::arg_index
|
||||
? arg_ref<Char>(part_.val.arg_index)
|
||||
: arg_ref<Char>(part_.val.str);
|
||||
auto part = part::make_replacement(repl);
|
||||
part.arg_id_end = begin;
|
||||
handler_(part);
|
||||
auto replacement_part = part::make_replacement(repl);
|
||||
replacement_part.arg_id_end = begin;
|
||||
handler_(replacement_part);
|
||||
return it;
|
||||
}
|
||||
};
|
||||
@ -530,14 +530,14 @@ constexpr auto compile_format_string(S format_str) {
|
||||
if constexpr (str[POS + 1] == '{') {
|
||||
return parse_tail<Args, POS + 2, ID>(make_text(str, POS, 1), format_str);
|
||||
} else if constexpr (str[POS + 1] == '}') {
|
||||
using type = get_type<ID, Args>;
|
||||
return parse_tail<Args, POS + 2, ID + 1>(field<char_type, type, ID>(),
|
||||
using id_type = get_type<ID, Args>;
|
||||
return parse_tail<Args, POS + 2, ID + 1>(field<char_type, id_type, ID>(),
|
||||
format_str);
|
||||
} else if constexpr (str[POS + 1] == ':') {
|
||||
using type = get_type<ID, Args>;
|
||||
constexpr auto result = parse_specs<type>(str, POS + 2, ID);
|
||||
using id_type = get_type<ID, Args>;
|
||||
constexpr auto result = parse_specs<id_type>(str, POS + 2, ID);
|
||||
return parse_tail<Args, result.end, result.next_arg_id>(
|
||||
spec_field<char_type, type, ID>{result.fmt}, format_str);
|
||||
spec_field<char_type, id_type, ID>{result.fmt}, format_str);
|
||||
} else {
|
||||
return unknown_format();
|
||||
}
|
||||
|
@ -363,8 +363,8 @@ struct ostream_params {
|
||||
ostream_params() {}
|
||||
|
||||
template <typename... T>
|
||||
ostream_params(T... params, int oflag) : ostream_params(params...) {
|
||||
this->oflag = oflag;
|
||||
ostream_params(T... params, int new_oflag) : ostream_params(params...) {
|
||||
oflag = new_oflag;
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
|
@ -108,8 +108,8 @@ TEST(TimeTest, TimePoint) {
|
||||
|
||||
#define EXPECT_TIME(spec, time, duration) \
|
||||
{ \
|
||||
std::locale loc("ja_JP.utf8"); \
|
||||
EXPECT_EQ(format_tm(time, spec, loc), \
|
||||
std::locale jp_loc("ja_JP.utf8"); \
|
||||
EXPECT_EQ(format_tm(time, spec, jp_loc), \
|
||||
fmt::format(loc, "{:" spec "}", duration)); \
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ template <typename T> struct mock_buffer final : buffer<T> {
|
||||
|
||||
void grow(size_t capacity) { this->set(this->data(), do_grow(capacity)); }
|
||||
|
||||
mock_buffer(T* data = nullptr, size_t capacity = 0) {
|
||||
this->set(data, capacity);
|
||||
mock_buffer(T* data = nullptr, size_t buf_capacity = 0) {
|
||||
this->set(data, buf_capacity);
|
||||
ON_CALL(*this, do_grow(_)).WillByDefault(Invoke([](size_t capacity) {
|
||||
return capacity;
|
||||
}));
|
||||
@ -224,9 +224,9 @@ struct custom_context {
|
||||
};
|
||||
|
||||
bool called;
|
||||
fmt::format_parse_context ctx;
|
||||
fmt::format_parse_context parse_ctx;
|
||||
|
||||
fmt::format_parse_context& parse_context() { return ctx; }
|
||||
fmt::format_parse_context& parse_context() { return parse_ctx; }
|
||||
void advance_to(const char*) {}
|
||||
};
|
||||
|
||||
@ -688,9 +688,9 @@ TYPED_TEST(IsStringTest, IsString) {
|
||||
EXPECT_TRUE(fmt::detail::is_string<fmt::basic_string_view<TypeParam>>::value);
|
||||
EXPECT_TRUE(
|
||||
fmt::detail::is_string<derived_from_string_view<TypeParam>>::value);
|
||||
using string_view = fmt::detail::std_string_view<TypeParam>;
|
||||
EXPECT_TRUE(std::is_empty<string_view>::value !=
|
||||
fmt::detail::is_string<string_view>::value);
|
||||
using fmt_string_view = fmt::detail::std_string_view<TypeParam>;
|
||||
EXPECT_TRUE(std::is_empty<fmt_string_view>::value !=
|
||||
fmt::detail::is_string<fmt_string_view>::value);
|
||||
EXPECT_TRUE(fmt::detail::is_string<my_ns::my_string<TypeParam>>::value);
|
||||
EXPECT_FALSE(fmt::detail::is_string<my_ns::non_string>::value);
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ TEST(AllocatorTest, allocator_ref) {
|
||||
check_forwarding(alloc, ref3);
|
||||
}
|
||||
|
||||
typedef allocator_ref<std::allocator<char>> TestAllocator;
|
||||
typedef allocator_ref<std::allocator<char>> std_allocator;
|
||||
|
||||
static void check_move_buffer(
|
||||
const char* str, basic_memory_buffer<char, 5, TestAllocator>& buffer) {
|
||||
const char* str, basic_memory_buffer<char, 5, std_allocator>& buffer) {
|
||||
std::allocator<char>* alloc = buffer.get_allocator().get();
|
||||
basic_memory_buffer<char, 5, TestAllocator> buffer2(std::move(buffer));
|
||||
basic_memory_buffer<char, 5, std_allocator> buffer2(std::move(buffer));
|
||||
// Move shouldn't destroy the inline content of the first buffer.
|
||||
EXPECT_EQ(str, std::string(&buffer[0], buffer.size()));
|
||||
EXPECT_EQ(str, std::string(&buffer2[0], buffer2.size()));
|
||||
@ -236,7 +236,7 @@ static void check_move_buffer(
|
||||
|
||||
TEST(MemoryBufferTest, MoveCtorInlineBuffer) {
|
||||
std::allocator<char> alloc;
|
||||
basic_memory_buffer<char, 5, TestAllocator> buffer((TestAllocator(&alloc)));
|
||||
basic_memory_buffer<char, 5, std_allocator> buffer((std_allocator(&alloc)));
|
||||
const char test[] = "test";
|
||||
buffer.append(string_view(test, 4));
|
||||
check_move_buffer("test", buffer);
|
||||
@ -248,14 +248,14 @@ TEST(MemoryBufferTest, MoveCtorInlineBuffer) {
|
||||
|
||||
TEST(MemoryBufferTest, MoveCtorDynamicBuffer) {
|
||||
std::allocator<char> alloc;
|
||||
basic_memory_buffer<char, 4, TestAllocator> buffer((TestAllocator(&alloc)));
|
||||
basic_memory_buffer<char, 4, std_allocator> buffer((std_allocator(&alloc)));
|
||||
const char test[] = "test";
|
||||
buffer.append(test, test + 4);
|
||||
const char* inline_buffer_ptr = &buffer[0];
|
||||
// Adding one more character causes the content to move from the inline to
|
||||
// a dynamically allocated buffer.
|
||||
buffer.push_back('a');
|
||||
basic_memory_buffer<char, 4, TestAllocator> buffer2(std::move(buffer));
|
||||
basic_memory_buffer<char, 4, std_allocator> buffer2(std::move(buffer));
|
||||
// Move should rip the guts of the first buffer.
|
||||
EXPECT_EQ(inline_buffer_ptr, &buffer[0]);
|
||||
EXPECT_EQ("testa", std::string(&buffer2[0], buffer2.size()));
|
||||
@ -446,9 +446,9 @@ TEST(UtilTest, FormatSystemError) {
|
||||
}
|
||||
|
||||
TEST(UtilTest, SystemError) {
|
||||
fmt::system_error e(EDOM, "test");
|
||||
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), e.what());
|
||||
EXPECT_EQ(EDOM, e.error_code());
|
||||
fmt::system_error test_error(EDOM, "test");
|
||||
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), test_error.what());
|
||||
EXPECT_EQ(EDOM, test_error.error_code());
|
||||
|
||||
fmt::system_error error(0, "");
|
||||
try {
|
||||
@ -2097,7 +2097,7 @@ struct test_format_specs_handler {
|
||||
enum Result { NONE, PLUS, MINUS, SPACE, HASH, ZERO, ERROR };
|
||||
Result res = NONE;
|
||||
|
||||
fmt::align_t align = fmt::align::none;
|
||||
fmt::align_t alignment = fmt::align::none;
|
||||
char fill = 0;
|
||||
int width = 0;
|
||||
fmt::detail::arg_ref<char> width_ref;
|
||||
@ -2111,7 +2111,7 @@ struct test_format_specs_handler {
|
||||
FMT_CONSTEXPR test_format_specs_handler(
|
||||
const test_format_specs_handler& other)
|
||||
: res(other.res),
|
||||
align(other.align),
|
||||
alignment(other.alignment),
|
||||
fill(other.fill),
|
||||
width(other.width),
|
||||
width_ref(other.width_ref),
|
||||
@ -2119,7 +2119,7 @@ struct test_format_specs_handler {
|
||||
precision_ref(other.precision_ref),
|
||||
type(other.type) {}
|
||||
|
||||
FMT_CONSTEXPR void on_align(fmt::align_t a) { align = a; }
|
||||
FMT_CONSTEXPR void on_align(fmt::align_t a) { alignment = a; }
|
||||
FMT_CONSTEXPR void on_fill(fmt::string_view f) { fill = f[0]; }
|
||||
FMT_CONSTEXPR void on_plus() { res = PLUS; }
|
||||
FMT_CONSTEXPR void on_minus() { res = MINUS; }
|
||||
@ -2151,7 +2151,7 @@ FMT_CONSTEXPR test_format_specs_handler parse_test_specs(const char (&s)[N]) {
|
||||
|
||||
TEST(FormatTest, ConstexprParseFormatSpecs) {
|
||||
typedef test_format_specs_handler handler;
|
||||
static_assert(parse_test_specs("<").align == fmt::align::left, "");
|
||||
static_assert(parse_test_specs("<").alignment == fmt::align::left, "");
|
||||
static_assert(parse_test_specs("*^").fill == '*', "");
|
||||
static_assert(parse_test_specs("+").res == handler::PLUS, "");
|
||||
static_assert(parse_test_specs("-").res == handler::MINUS, "");
|
||||
@ -2262,7 +2262,7 @@ FMT_CONSTEXPR test_format_specs_handler check_specs(const char (&s)[N]) {
|
||||
|
||||
TEST(FormatTest, ConstexprSpecsChecker) {
|
||||
typedef test_format_specs_handler handler;
|
||||
static_assert(check_specs("<").align == fmt::align::left, "");
|
||||
static_assert(check_specs("<").alignment == fmt::align::left, "");
|
||||
static_assert(check_specs("*^").fill == '*', "");
|
||||
static_assert(check_specs("+").res == handler::PLUS, "");
|
||||
static_assert(check_specs("-").res == handler::MINUS, "");
|
||||
|
@ -131,15 +131,13 @@ template <class charT> struct formatter<std::complex<double>, charT> {
|
||||
FormatContext& ctx) {
|
||||
detail::handle_dynamic_spec<detail::precision_checker>(
|
||||
specs_.precision, specs_.precision_ref, ctx);
|
||||
auto format_specs = std::string();
|
||||
if (specs_.precision > 0)
|
||||
format_specs = fmt::format(".{}", specs_.precision);
|
||||
if (specs_.type)
|
||||
format_specs += specs_.type;
|
||||
auto specs = std::string();
|
||||
if (specs_.precision > 0) specs = fmt::format(".{}", specs_.precision);
|
||||
if (specs_.type) specs += specs_.type;
|
||||
auto real = fmt::format(ctx.locale().template get<std::locale>(),
|
||||
"{:" + format_specs + "}", c.real());
|
||||
"{:" + specs + "}", c.real());
|
||||
auto imag = fmt::format(ctx.locale().template get<std::locale>(),
|
||||
"{:" + format_specs + "}", c.imag());
|
||||
"{:" + specs + "}", c.imag());
|
||||
auto fill_align_width = std::string();
|
||||
if (specs_.width > 0)
|
||||
fill_align_width = fmt::format(">{}", specs_.width);
|
||||
|
@ -152,7 +152,7 @@ TEST(OStreamTest, WriteToOStreamMaxSize) {
|
||||
|
||||
struct test_buffer final : fmt::detail::buffer<char> {
|
||||
explicit test_buffer(size_t size)
|
||||
: fmt::detail::buffer<char>(nullptr, size, size) {}
|
||||
: fmt::detail::buffer<char>(nullptr, size, size) {}
|
||||
void grow(size_t) {}
|
||||
} buffer(max_size);
|
||||
|
||||
@ -165,7 +165,8 @@ TEST(OStreamTest, WriteToOStreamMaxSize) {
|
||||
} streambuf;
|
||||
|
||||
struct test_ostream : std::ostream {
|
||||
explicit test_ostream(mock_streambuf& buffer) : std::ostream(&buffer) {}
|
||||
explicit test_ostream(mock_streambuf& output_buffer)
|
||||
: std::ostream(&output_buffer) {}
|
||||
} os(streambuf);
|
||||
|
||||
testing::InSequence sequence;
|
||||
|
Loading…
Reference in New Issue
Block a user