Commit Graph

536 Commits

Author SHA1 Message Date
Victor Zverovich
c156093ffd Fix carry in fallback_format 2020-09-25 10:12:44 -07:00
Victor Zverovich
2d4fde3a2e Don't emit trailing zero for consistency with std::format 2020-09-23 09:19:12 -07:00
Victor Zverovich
16410056bf Optimize copy_str for counting_iterator 2020-09-22 07:56:09 -07:00
Victor Zverovich
7e6827521a Remove trailing zeros when using fallback formatter (#1873) 2020-09-17 08:16:21 -07:00
Victor Zverovich
5b5a597198 Fix handling of wide alignment 2020-09-15 06:53:06 -07:00
Victor Zverovich
dce8e49b4f Handle float in fallback formatter 2020-09-13 09:28:40 -07:00
Victor Zverovich
9f312fe87e Implement fallback FP formatting with given precision (#1526) 2020-09-07 09:34:30 -07:00
Barry Revzin
6be6544668
Fixing buffer_appender's ++ slicing (#1822)
* Fixing buffer_appender's ++ slicing.

* This test requires C++14.

* Removing string_view dependency.

* Simplifying test case.

* Adding message to static_assert
2020-08-18 12:37:56 -07:00
medithe
f9f02df719
CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion (#1817)
* CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion

* test/ranges-test.cc: changed type of integer literals to unsigned

* test/format-test.cc: fixed implicit conversion changes signedness warning in clang

Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
2020-08-14 13:58:20 -07:00
Victor Zverovich
4fd95e4b4d Don't remove trailing zeros with # 2020-08-08 08:14:39 -07:00
Victor Zverovich
065889a593 Use correct capacity in iterator_buffer (#1807) 2020-08-08 07:01:21 -07:00
Barry Revzin
d0dd678693 Adding convenience append(range) 2020-08-08 06:33:46 -07:00
Victor Zverovich
21c8b5c142 Report error on missing named argument (#1796) 2020-07-30 07:16:15 -07:00
Victor Zverovich
a2c4fed981 Double buffering no more 2020-07-10 20:35:14 -07:00
Victor Zverovich
b998e0f30b Reduce symbol sizes and simplify iterator use 2020-07-09 08:51:43 -07:00
Victor Zverovich
56fed78149 FMT_NUMERIC_ALIGN -> FMT_DEPRECATED_NUMERIC_ALIGN 2020-07-03 08:53:01 -07:00
Victor Zverovich
56e63078ff Make the n specifier an opt-in 2020-07-03 08:02:48 -07:00
Victor Zverovich
98a7a8b405 Update changelog and disable internal 2020-06-26 19:07:33 -07:00
Victor Zverovich
2cac8a9d2e Reintroduce UDT support to fmt::to_string and test ADL 2020-06-21 09:21:07 -07:00
Victor Zverovich
397ad1bec3 Optimize common case 2020-06-15 18:30:31 -07:00
Victor Zverovich
50bad7d62d Optimize format string parsing 2020-06-06 10:15:19 -07:00
Victor Zverovich
f11e968708 Optimize format string parsing 2020-06-06 08:15:33 -07:00
Victor Zverovich
f095c67b6a Remove uses of buffer_range 2020-05-29 18:14:03 -07:00
Victor Zverovich
19c5b5d159 Simplify arg_formatter 2020-05-29 16:53:12 -07:00
Victor Zverovich
519571edec Simplify arg_formatter_base 2020-05-29 14:44:18 -07:00
Victor Zverovich
6d66de3805 Add c specifier support to integral types (#1652) 2020-05-17 08:44:59 -07:00
Victor Zverovich
8069265373 internal -> detail (#1538) 2020-05-10 07:34:30 -07:00
Victor Zverovich
7f723fbcb8 Consistently namespace qualify size_t 2020-05-07 15:59:46 -07:00
Victor Zverovich
c06851456d Purge basic_writer 2020-05-07 15:04:48 -07:00
Victor Zverovich
2f05054dd3 Purge basic_writer 2020-05-07 11:35:41 -07:00
Victor Zverovich
a71bc9c825 Use '0' fill with numeric align for consistency with std::format 2020-05-03 09:52:31 -07:00
Victor Zverovich
1e1ac6e964 Check dynamic width/precision id at compile time (#1614) 2020-04-25 08:36:24 -07:00
Victor Zverovich
e51c449fe6 Revert "Check dynamic widht/precision id at compile time (#1614)"
This reverts commit 7d748a6f82.
2020-04-25 07:43:56 -07:00
Victor Zverovich
7d748a6f82 Check dynamic widht/precision id at compile time (#1614) 2020-04-22 14:45:37 -07:00
Victor Zverovich
2b75bd7ce6 Get rid of do_check_format_string 2020-04-22 12:15:29 -07:00
Victor Zverovich
811b0f9054 Enable compile-time error tests 2020-04-22 11:00:20 -07:00
Victor Zverovich
5944fcad37 Remove remaining wchar_t instantiation 2020-04-19 16:48:15 -07:00
Victor Zverovich
8a4630686e Improve handling of named arguments 2020-04-14 11:56:55 -07:00
Victor Zverovich
e99809f29d Fix ostream support in sprintf (#1631) 2020-04-12 07:53:17 -07:00
Victor Zverovich
bbb6b357c7 Add floating-point L specifier (#1624) 2020-04-10 07:16:20 -07:00
Victor Zverovich
d1d653d895 Implement the L specifier 2020-04-02 06:58:38 -07:00
Victor Zverovich
80ce222ca6 Fix wide print overload (#1609) 2020-03-28 09:44:18 -07:00
Scott Ramsby
664dd88e31 Enable FMT_STRING() use with types other than string literals 2020-03-24 12:56:21 -07:00
Victor Zverovich
69779b4ed6 Fix handling of small precision in general format 2020-03-24 09:01:57 -07:00
Victor Zverovich
ff486a72a7 Allow leading zeros in precision (#1579) 2020-03-14 11:37:38 -07:00
Victor Zverovich
678341275b Deprecate fmt::char8_t 2020-03-14 10:32:34 -07:00
Victor Zverovich
153f753bde Deprecate undocumented _u suffix 2020-03-04 19:20:19 -08:00
Victor Zverovich
eafd079868 Improve width computation 2020-03-04 17:17:34 -08:00
Victor Zverovich
1e8493196e Make compile-time checks in format_to handle references 2020-03-01 07:57:34 -08:00
Victor Zverovich
09a13244c8 Disallow passing non-string-literals to FMT_STRING 2020-01-22 21:05:46 -08:00
Victor Zverovich
419db8baa1 Fix length computation of constexpr C strings 2020-01-22 18:25:07 -08:00
Victor Zverovich
b4218aa0f8 Test invalid fill 2020-01-19 16:52:36 -08:00
Victor Zverovich
e5f2f8ce7a Add variable-width fill support (#1109) 2020-01-19 14:49:51 -08:00
Victor Zverovich
9e3f3e8cff Fix handling of output iterators in format_to_n (#1506) 2020-01-05 09:59:01 -10:00
Daniela Engert
cb8e7caf7c Convert 'char8_t' character sequences to 'char' sequences
Otherwise, Google Test will insist on inserting 'char8_t' NTBS into 'char' streams, but basic_ostream<char>::operator<< overloads taking 'char8_t' arguments are defined as deleted by P1423.
Handling individual 'char8_t's is done inline.

This fixes the compilation errors seen in C++20 mode beginning with VS2019 Update 2.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2020-01-04 07:01:48 -10:00
Victor Zverovich
c85efef312 More showpoint fixes and tests (#1498) 2019-12-30 13:08:35 -10:00
Victor Zverovich
f219dcd59b Add fmt::bytes 2019-12-24 10:45:15 -08:00
Victor Zverovich
dea7fde8b7 Deprecate u8string_view 2019-12-24 09:44:57 -08:00
Victor Zverovich
e6b37b4aff Handle block boundaries in utf8_to_utf16 2019-12-21 16:33:34 -08:00
Victor Zverovich
74532c23a3 Make type a scoped enum 2019-12-21 12:22:17 -08:00
Victor Zverovich
1b1c70108a trailing_zeros -> showpoint 2019-12-18 12:12:09 -08:00
Victor Zverovich
1afe201ae8 Handle block boundaries in utf8_to_utf16 2019-12-18 10:35:51 -08:00
Victor Zverovich
35959a31d7 Move OS-specific APIs to a separate header 2019-12-15 11:46:45 -08:00
Victor Zverovich
ec2463c905 Implement utf8_to_utf16 using utf8_decode 2019-12-15 09:35:26 -08:00
Victor Zverovich
9e450911fa Give an error on precision overflow 2019-12-14 07:45:27 -08:00
Victor Zverovich
9f2e7edaeb Fix handling of types convertible to std::string_view 2019-12-09 13:25:08 -08:00
Florin Iucha
d3aa0c3a28 Clean-up sign-conversion warnings in test code 2019-12-08 16:07:43 -08:00
Victor Zverovich
31de9a1b80 Revert "Clean-up sign-conversion warnings in test code"
This reverts commit 227bfe62dd.
2019-12-08 15:47:24 -08:00
Florin Iucha
227bfe62dd Clean-up sign-conversion warnings in test code 2019-12-08 15:21:38 -08:00
Deniz Evrenci
1ab80aa92c Fix handling of types with custom formatters that are convertible to std::string_view 2019-12-06 11:40:21 -08:00
Victor Zverovich
8bbe76af3a Add a missing decimal point in exponent notation with trailing zeros 2019-12-02 11:36:33 -08:00
Victor Zverovich
b994a0ab13 Fix handling of missing fraction in snprintf_float 2019-11-29 06:17:29 -08:00
Victor Zverovich
d19ed6716d Fix hexfloat buffer reallocation 2019-11-25 15:54:04 -08:00
Victor Zverovich
28d7191c27 Don't print trailing zero with fixed, precision=0, and showpoint (#1417) 2019-11-24 08:23:10 -08:00
Victor Zverovich
43271ba8e8 Handle null terminator at the end of the buffer 2019-11-24 07:15:25 -08:00
Victor Zverovich
66d7746bb3 Use grisu for exponent notation 2019-11-19 16:55:11 -08:00
Leon Klingele
78842ce0d6 test: add default constructor for a const value
This fixed a compilation error of the OS X 10.11.6 C++ compiler:

    ./fmt/test/format-test.cc:1861:16: error: default initialization of an object of const type 'const Answer' without a user-provided default constructor
      const Answer const_answer;
                   ^
                               {}
2019-11-19 08:32:35 -08:00
Victor Zverovich
5420bcce2d Make % an opt-in to improve compatibility with std::format 2019-11-18 08:04:43 -08:00
Victor Zverovich
dcde089b4e Improve POSIX API detection 2019-11-15 07:28:02 -08:00
David P. Sicilia
2145a7bdcc Move has_formatter into the public fmt namespace. (#1407)
* Move has_formatter into the public fmt namespace.

This will allow users to do SFINAE-friendly checks for
the formattability of a type.

Fixes #1369
2019-11-14 07:08:24 -08:00
daniel
f1559e1d56 Use grouping() from locale for specifier 'n' 2019-11-05 07:22:12 +00:00
Attila Tajti
0889856d61 Fix UTF-8 truncation 2019-11-03 11:53:15 +00:00
Victor Zverovich
213e09644f Workaround X11 madness (#1388) 2019-11-01 08:47:11 -07:00
Victor Zverovich
d39ebf3ff2 Optimize counting 2019-10-21 06:57:42 -07:00
Victor Zverovich
8498bc97dd Initialize all the things 2019-10-20 17:53:18 -07:00
Orivej Desh
a1079e9fd6 Fix undefined in format-test (#1349)
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null,
but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This
succeeds nevertheless because a typical `std::allocator<char>::allocate` does
not use `this`, so it does not crash when `this` is null.

Fixes #1344
2019-10-08 15:42:51 -07:00
Victor Zverovich
c85ae23c73 Add max_value 2019-09-08 09:21:30 -07:00
Victor Zverovich
f7a4b4ab91 Make numeric alignment optional 2019-09-06 09:43:53 -07:00
Victor Zverovich
611cf0b3c6 Format octal 0 as 0 2019-09-06 07:03:47 -07:00
Victor Zverovich
1882b9687b Reduce the numer of ifdefs with an empty (u)int128_t fallback 2019-09-05 18:03:47 -07:00
Deniz Evrenci
6de0454b42 Add support for built-in __int128 when available 2019-09-04 07:05:08 -07:00
Victor Zverovich
422e7b9d70 Fix compile-time checks for user-defined types (#1292) 2019-08-31 08:35:38 -07:00
Victor Zverovich
c76957565c FixedEnum -> StrongEnum and make it a regression test 2019-08-31 08:16:47 -07:00
Egor Seredin
bcd9b9331a Map not int enum to correct underlying_type (#1286)
* Map not int enum to correct underlying_type

* Use non-zero constant in TestFixedEnum
2019-08-31 06:25:38 -07:00
Victor Zverovich
3f75e2b69e Make buffer_range public and update custom formatting docs (#1281) 2019-08-28 06:50:20 -07:00
Victor Zverovich
c1e97392be Fix warnings 2019-08-11 08:44:12 -07:00
Jack Andersen
699fe8e711 Remove const qualification in compile-time checks 2019-07-15 09:20:16 +02:00
Victor Zverovich
e4f84ee1c6 Refactor format_specs for #1109 and #940
Refactor `format_specs` and related APIs to support variable-width fill
(#1109), improve naming consistency, remove legacy setters (#940), and
optimize layout.
2019-07-06 20:57:40 -07:00
Victor Zverovich
bc14c6ee20 Use the decimal point from locale 2019-07-03 17:55:00 -07:00
Victor Zverovich
c9d5a08ed8 Add the 'n' float format specifier 2019-07-03 16:36:23 -07:00