Commit Graph

1588 Commits

Author SHA1 Message Date
Riccardo Brugo
8c9bc070f5
Implement styled arguments (#2793)
* Implement styled arguments

* Inherit from formatter<Arg> to get the underlying `parse` and `format`

* Move styled_arg definition into the previous detail block

* Change styled_arg ctor parameters names to avoid shadowing members

* Move const before auto

* Remove redundant constructor for styled_arg

* Use the iterator instead of the buffer in styled_arg::format

* Remove unnecessary `styled` overloads

* Remove defaulted text_style parameter in styled function
2022-03-08 09:50:14 -08:00
Boris Dalstein
e3d688e79a
Fix warning C4251: class fmt::v8::file needs to have dll-interface (#2797)
* Fix warning C4251: class fmt::v8::file needs to have dll-interface

* Add CMake target dependency between test-main and fmt
2022-03-07 12:09:48 -08:00
Barry Revzin
0cef1f819e
Fixing formatting of certain kinds of ranges of ranges. (#2787)
* Fixing formatting of certain kinds of ranges of ranges.

* Renaming const_range to range_type.
2022-03-04 16:21:00 -08:00
Victor Zverovich
4fcacea354 Parameterized fp on significand type 2022-02-21 07:25:13 -08:00
Victor Zverovich
cbc59ca893 Clear moved from memory buffer 2022-02-20 08:12:59 -08:00
Vladislav Shchapov
ea3d326c63
Fix clang -Wliteral-range warning (#2779) 2022-02-19 10:52:33 -08:00
Victor Zverovich
aad44f2839 Add fmt::enums::format_as 2022-02-19 08:03:42 -08:00
Victor Zverovich
a0b43bfae2 Add support for 96-bit long double 2022-02-18 18:01:49 -08:00
Victor Zverovich
2c8cd2db34 Fix handling of zero precision 2022-02-18 12:38:30 -08:00
Victor Zverovich
47da218cc3 Remove uintptr_fallback 2022-02-18 07:03:33 -08:00
Victor Zverovich
4ddab8901c Merge accumulator into int128_fallback 2022-02-18 06:17:28 -08:00
Victor Zverovich
d38f72aff2 Refactor fallback ints 2022-02-17 20:24:42 -08:00
Victor Zverovich
15c2a3bacc int128_t -> int128_opt 2022-02-17 20:03:25 -08:00
Victor Zverovich
ce93a66dfb Implement a fallback uint128_t 2022-02-17 07:37:09 -08:00
Victor Zverovich
6a13464059 Include 128-bit with other signed integers in specifier check 2022-02-16 16:57:06 -08:00
Vladislav Shchapov
10e3b83a75
Replace `make_args_checked with make_format_args` (#2760)
* Replace make_args_checked to make_format_args

* Deprecate legacy make_args_checked
2022-02-13 20:13:35 -08:00
Victor Zverovich
afbcf1e8ea Remove legacy C locale wrapper 2022-02-05 12:37:21 -08:00
Victor Zverovich
17b362f78c Simplify ostream opt-in API 2022-02-04 18:33:59 -08:00
Victor Zverovich
f055ebbd25 Make ostream operators opt in to reduce the risk of ODR violations 2022-02-04 15:06:45 -08:00
Victor Zverovich
8a21e328b8 Remove problematic constructibility check 2022-02-04 12:20:02 -08:00
Victor Zverovich
31e743d06e Don't use ostream for types convertible to string_view 2022-02-04 11:00:00 -08:00
Barry Revzin
a34a97cc1d
Supporting ? as a string presentation type (#2674)
* Supporting ? as a string presentation type.

* Supporting ? as a char presentation type.

* Adding iterator_category to counting_iterator.
2022-01-30 08:55:28 -08:00
Victor Zverovich
1557ab7644 Add format_as for enums 2022-01-28 06:38:02 -08:00
Victor Zverovich
09fde7f4b8 Add fmt::underlying for enum classes 2022-01-22 08:06:22 -08:00
Victor Zverovich
c28500556a FMT_NOEXCEPT -> noexcept 2022-01-20 16:55:47 -08:00
matrackif
5985f0a7d2
Fix overflow for chrono durations (#2722) 2022-01-17 12:14:59 -08:00
Victor Zverovich
8f8a1a02d5 Fix handling of formattable types implicitly convertible to pointers 2022-01-14 13:42:01 -08:00
Vladislav Shchapov
b02e5af52c
fmt::join support FMT_COMPILE (#2720) 2022-01-14 09:58:49 -08:00
Victor Zverovich
d9f045fba1 Fix a UB in chrono 2022-01-09 14:06:13 -08:00
Barry Revzin
6e0f1399d7
Supporting nested format specs for ranges. (#2673)
* Supporting nested format specs for ranges.

* I dedicate this commit to Eric Niebler.

* clang-format

* PR comments.

* throw -> FMT_THROW

* Need to map every element too.

* Clarifying uncvref_type

* Trying to add a workaround for MSVC.
2022-01-08 09:48:26 -08:00
Victor Zverovich
1b193e7b37 Deprecate more 2022-01-03 11:13:09 -08:00
Alexey Ochapov
c7f88180f6 add tests for format string compile-time checks 2021-12-27 20:55:06 -08:00
Alexey Ochapov
8a2c3fb88f add reverse tests to compile-error-test
to make sure that error tests do not fail because they become outdated
2021-12-27 20:55:06 -08:00
Alexey Ochapov
1164eda5af disable compile-error-test on Windows
since it takes too much time to complete, similar to other tests with additional
CMake invocation
2021-12-27 20:55:06 -08:00
Alexey Ochapov
4482f6f1f0 rewrite compile-error-test to use non-header-only library 2021-12-27 20:55:06 -08:00
Victor Zverovich
796662a612 Escape range items convertible to std::string_view 2021-12-27 09:38:06 -08:00
Vladislav Shchapov
33ee4cc516 Improve noexception test 2021-12-26 16:28:41 -08:00
Alexey Ochapov
817788fbf0
remove incorrect C++20 check from test/CMakeLists.txt (#2663)
It disables entire branch of tests declaration unconditionally because CXX_STANDARD
is not defined there. But even we use CMAKE_CXX_STANDARD here, these tests should
not be disabled with standard >= C++20.
2021-12-23 12:32:03 -08:00
Victor Zverovich
4511030af2 Minor code style tweaks for consistency 2021-12-23 11:55:58 -08:00
lucpelletier
7812813a32
Don't explicitly delete copy ctor of dynamic_format_arg_store (#2664)
* Don't explicitly delete copy ctor of dynamic_format_arg_store

Explicitly deleting the copy ctor causes the move constructor to not be
implicitly generated. This behaviour is different than what was in
v8.0.1 and causes code that relied on the move ctor of
dynamic_format_arg_store to break.

* Add test for dynamic_format_arg_store's move ctor

* include <memory>, don't use make_unique
2021-12-23 11:34:16 -08:00
Victor Zverovich
664cd6067d Remove std-format-test 2021-12-23 10:58:02 -08:00
Alexey Ochapov
e46392ea2c deprecate _format UDL in code using FMT_DEPRECATED 2021-12-18 08:33:20 -08:00
Victor Zverovich
c882790a2e Add a set formatter 2021-12-18 07:35:40 -08:00
Victor Zverovich
121002d700 Add a map formatter 2021-12-18 07:12:53 -08:00
Victor Zverovich
be51ee1ceb Disable broken copy ctor of dynamic_format_arg_store 2021-12-17 17:18:18 -08:00
Alexey Ochapov
51b14b6c0c remove commented out lines 2021-12-17 16:05:56 -08:00
Alexey Ochapov
223a0fa55d move gtest-specific check into gtest/CMakeLists.txt 2021-12-17 16:05:56 -08:00
Victor Zverovich
fd62fba985 Don't convert scoped enums to integers 2021-12-09 12:09:33 -08:00
Victor Zverovich
e4f0564aa6 Disable is_streamable for string[_view] 2021-12-09 10:02:18 -08:00
matrackif
0bbc9708f9
Implement c++20 std::chrono::duration subsecond formatting (#2623)
* Add support for subsecond printing for std::chrono::duration according to the c++20 standard

* Remove assert test that overflows intmax_t

* * Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction

* * Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction

* Fix sign conversion (-Wsign-conversion) warning treated as error in num_digits()

* Format chrono.h with clang-format

* Remove extra forward slash in doxygen style comment

Co-authored-by: Victor Zverovich <victor.zverovich@gmail.com>

* Apply all suggestions from GitHub, except for replacing the utility subsecond_helper class with a function

* * Move logic of handling subseconds from utility class to function with name write_fractional_seconds()
* Revert write(Rep value, int width) function to previous state

* Fix -Wshadow warning

* Remove unsued get_subseconds() function, its logic has been moved to write_fractional_seconds()

* Change comment from lowercase int to uppercase Int

* Simplify test check

* Integrate suggested changes

* Remove static from detail functions, they are no longer member functions of a class and static is unnecessary.
* Change comment from "amount" to "number"

Co-authored-by: Victor Zverovich <victor.zverovich@gmail.com>
2021-12-09 06:45:13 -08:00