Commit Graph

1010 Commits

Author SHA1 Message Date
Victor Zverovich
4c721e3a2f Fix chrono formatting with invalid argument id (#1132) 2019-04-28 07:08:41 -07:00
Victor Zverovich
8d8ea21c69 Partially implement Grisu3 2019-04-27 12:17:21 -07:00
Victor Zverovich
40a7975640 Remove trailing zeros 2019-04-27 07:42:27 -07:00
Victor Zverovich
cb46397dfb Fix typo 2019-04-27 07:13:35 -07:00
Victor Zverovich
134904c886 Re-enabled constexpr tests 2019-04-26 17:07:37 -07:00
Victor Zverovich
bd516e3429 Convert negative precision to zero in printf (#1127)
and remove redundant check in grisu2_prettify.
2019-04-21 07:44:04 -07:00
Victor Zverovich
5efb24dd2b Add specialization test 2019-04-19 17:15:46 -07:00
Victor Zverovich
946498cfbc Fix handling of zero precision 2019-04-19 15:10:12 -07:00
HE, Tao
6b20863918 fmt::ptr: support unique_ptr and shared_ptr. 2019-04-18 10:12:11 -07:00
Victor Zverovich
d306585a3f Don't inject internal names into std (#1120) 2019-04-17 13:25:31 -07:00
Victor Zverovich
dc94010fa5 Remove char_traits (#1117) 2019-04-16 17:08:24 -07:00
Victor Zverovich
397e8dd9d5 clang-format 2019-04-15 11:39:19 -07:00
ToolsDevler
2b415b7af7 Restructure printf_arg_formatter to make it customizable 2019-04-15 11:10:31 -07:00
Victor Zverovich
5d755d0a4e Fix handling of volatile char (#1115) 2019-04-14 12:34:56 -07:00
Victor Zverovich
41fbaeb3b1 Add <format> test 2019-04-13 11:37:52 -07:00
Victor Zverovich
8bc0adb9ba Get rid of obsolete cmake stuff 2019-04-13 11:37:52 -07:00
Bruce Mitchener
aeb5ad3ce1 Enable [[noreturn]] some. 2019-04-08 07:53:59 -07:00
Victor Zverovich
2808395481 basic_buffer -> buffer
This reduces symbol sizes and gets rid of shadowing warnings.
2019-04-07 20:32:28 -07:00
Victor Zverovich
07d5a86a7c Fix warnings 2019-04-06 22:10:10 -07:00
Victor Zverovich
f10a7e2e46 Test exotic pointer formatting 2019-04-06 09:04:44 -07:00
Victor Zverovich
bd8177177a Add support for platforms without uintptr_t 2019-04-06 08:11:03 -07:00
Victor Zverovich
018d8b57f6 Remove broken snprintf 2019-03-30 20:27:52 -07:00
Victor Zverovich
da0ea4161a Make compile-time checks work with fallback formatter (#1088) 2019-03-21 19:26:53 -07:00
mwinterb
7ad3015f5b Added missing typename to FMT_STRING. (#1089)
* Added missing typename to FMT_STRING.

This is so that FMT_STRING can be used in a template.
2019-03-20 20:37:00 -07:00
Victor Zverovich
294fd7df96 Remove isinf workaround 2019-03-17 14:49:19 -07:00
Victor Zverovich
76d326a2a2 Enable grisu for general format 2019-03-17 09:48:50 -07:00
Victor Zverovich
97619e27a2 More fixed precision tests 2019-03-15 10:20:20 -07:00
Victor Zverovich
dd6cc0e6ac Merge time-test into chrono-test 2019-03-14 18:10:56 -07:00
Victor Zverovich
a939c75956 Merge fmt/time.h into fmt/chrono.h 2019-03-14 18:07:42 -07:00
Victor Zverovich
a82b3680dc More tests and fixed precision fixes 2019-03-13 19:47:07 -07:00
Victor Zverovich
e28429ee73 Prevent overflow with zero precision 2019-03-13 10:46:25 -07:00
Victor Zverovich
1632f72cbe Test get_round_direction 2019-03-10 11:14:50 -07:00
Victor Zverovich
8129b9bc46 Test that the library can be compiled witout locales 2019-03-10 07:57:29 -07:00
Victor Zverovich
835087dd04 Add color-test 2019-03-10 07:57:29 -07:00
Victor Zverovich
8407f4cb24 Round close to zero fixed precision 2019-03-09 15:18:34 -08:00
Victor Zverovich
49d244c065 Don't emit more than precision digits (#1072) 2019-03-09 13:53:23 -08:00
Michael Winterberg
d8434baa03 Declare the size of RESET_COLOR.
This is so that the format with a text_tyle will compile even if
header-only mode isn't enabled. Addresses #1063.
2019-03-06 09:41:45 -10:00
Victor Zverovich
2e526a664a Fix handling of output iterator in ranges 2019-03-06 08:10:46 -08:00
gawain
79b79f329e Add support for '%' type to output floating point values as a
percentage.

This helps with compatibility with Python's format strings.
2019-03-05 17:36:20 -08:00
Alexander Bolz
287eaab3b2 Increment output iterator in basic_writer::write for character types (#1056) 2019-02-26 12:16:34 -10:00
Victor Zverovich
a97757736b Use grisu for fixed precision 2019-02-23 15:50:50 -10:00
Victor Zverovich
8af651be39 Implement fixed precision 2019-02-22 10:47:27 -10:00
Victor Zverovich
ed138d794a test: assert-test: fix typo in else-branch of EXPECT_DEBUG_DEATH_IF_SUPPORTED
Patch by Ievgen Liubymkin (jackyf).
2019-02-18 14:02:02 -10:00
Victor Zverovich
442fa1bd46 Decouple format and parse contexts 2019-02-09 20:39:37 -08:00
Victor Zverovich
744e66bb08 Deprecate format_context::parse_context() 2019-02-09 16:15:20 -08:00
Daniela Engert
01f34d0b0b Fix library deprecation warning
Since C++17, using template specialization 'std::allocator<void>' in any shape or form (even just mentioning it) is deprecated! A simple workaround is replacing 'void' by another (preferably empty) type, e.g. 'fmt::monostate'.

Found by Clang 9 in Visual Studio.
2019-02-07 12:20:46 -08:00
morinmorin
9a0a24f90b Test is_streamable with overloaded comma operators 2019-02-06 15:44:59 -08:00
Victor Zverovich
5a314a5288 Eliminate extra copy on floating-point formatting 2019-02-06 10:17:50 -08:00
Elias Kosunen
22de5a755f Fix warnings from Travis 2019-02-03 15:25:09 -08:00
Victor Zverovich
355eb6d29a Enable grisu for shortest roundtrip (default) formatting 2019-02-03 10:38:28 -08:00
Victor Zverovich
b8d34e0db3 Fix rounding 2019-02-02 09:19:46 -08:00
Elias Kosunen
7fbbfed8c6 Fix warnings caused by usage of deprecated functionality 2019-02-02 05:48:39 -08:00
Elias Kosunen
c3268f4e50 Remove use cases of deprecated functionality 2019-02-02 05:48:39 -08:00
Victor Zverovich
5289dd600b Test formatting of special numbers 2019-01-30 06:56:46 -08:00
Daniela Engert
0700612249 Implement 'chrono' formatting specifiers '%Q' and '%q'
Howard Hinnant's 'date' library recently gained these two new formatting specifiers. This implementation in {fmt} includes support for 'std::chrono::duration' specializations with floating-point representation types and user-definable precision.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-27 11:10:08 -08:00
Victor Zverovich
06c005b7b0 Clarify that compile-time checks don't support named arguments 2019-01-27 10:10:13 -08:00
Victor Zverovich
4f6fda558c Add a grisu test stub 2019-01-27 10:10:13 -08:00
Daniela Engert
9f70b034e1 Implement precision for floating-point durations.
The formatting syntax follows p1361r0, augmented by a precision field as proposed in #1004.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-23 07:17:00 -08:00
Victor Zverovich
5f1ceebc7f Make formatter<T> override ostream<< for templates (#952) 2019-01-21 09:42:55 -08:00
Victor Zverovich
83f052930a Add code from p0645 2019-01-20 15:12:01 -08:00
Victor Zverovich
fdd8e333c1 Fix compilation with locales disabled (#1011) 2019-01-19 07:16:05 -08:00
Daniela Engert
b0cde860ae Implement 'snprintf(OutputIt it, size_t n, const S &format, const Args & ... args)' (#917)
Mostly equivalent to 'sprintf(const S &format, const Args & ... args)' but generates at most 'n' characters through output iterator 'it'. The output type is the same as with 'format_to_n'.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-13 13:08:01 -05:00
Daniela Engert
e05dfb0887 Fix compile errors due to name-hiding and an unused function argument.
These problems are pointed out by clang-tidy and fail compilation on msvc at /W4 /WX.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-13 12:18:05 -05:00
Victor Zverovich
58b6f8db48 Format the code using clang-format 2019-01-13 06:58:20 -08:00
stryku
9a777b9e1c Implemented fmt::prepare()
Implementation of fmt::prepare() function and features around it.
2019-01-12 10:53:31 -08:00
Victor Zverovich
dc8f8ce4c0 Fix handling of dynamic width in chrono formatter
Thanks to Howard Hinnant.
2019-01-09 15:23:21 -08:00
Michael Winterberg
39623a7400 Replaced usage of gtest's internal scoped_ptr with unique_ptr.
scoped_ptr was removed in with gtest google/googletest@e857f9cdd9.
2019-01-02 19:05:51 -05:00
Denis Blank
ae1de3a8d3 Add support for using text_style in format and vformat directly (#993)
* Closes #993
2019-01-01 09:26:54 -05:00
Sign Bit
0bbdca5b8b Fix conversion warnings (#989)
* Fix sign conversion warnings

* Ignore unused local typedefs

* Remove cast reported as useless on GCC

* Remove warning on unused variable

* Enable conversion warning checking for pedantic build

* Fix sign-conversion warnings in headers
2018-12-20 06:24:19 -08:00
Victor Zverovich
77a7244804 Implement fill/align/width for strftime-like formatting 2018-12-19 07:03:02 -08:00
Victor Zverovich
3e01376e08 Implement fill/align/width parsing in chrono formatter 2018-12-16 09:08:11 -08:00
Victor Zverovich
8668639ae2 Get rid of null_terminating_iterator in format 2018-12-15 06:17:25 -08:00
Nicolas
93fd473b8f Add support for builtin terminal colors. (#974) 2018-12-15 06:16:00 -08:00
Victor Zverovich
b180b39152 Fix default formatting 2018-12-12 06:39:47 -08:00
Nicolas
24594c747e Disable printing the reset escape code when no style modifiers where applied. (#973) 2018-12-09 15:57:20 -08:00
Victor Zverovich
b0f2224719 Implement default chrono formatting 2018-12-09 15:56:15 -08:00
Nicolas
749276072f Add file stream support for stylized text printing. (#967) 2018-12-09 09:28:48 -08:00
Victor Zverovich
f54f3d0fb7 Move chrono-specific code to a separate header 2018-12-09 06:45:20 -08:00
Victor Zverovich
bf1f1c73e3 Fix time test 2018-12-07 08:19:13 -08:00
Victor Zverovich
acfa95d4a8 Workaround a bug in MSVC's strftime (#965) 2018-12-07 07:07:21 -08:00
Victor Zverovich
628f830583 More chrono formatting 2018-12-07 06:36:08 -08:00
Victor Zverovich
aa3b5aba41 Implement locale-specific minute formatting 2018-12-06 16:12:10 -08:00
Victor Zverovich
639de21757 Workaround more MSVC bugs 2018-12-06 12:16:04 -08:00
Victor Zverovich
bd1104046b Workaround a bug in MSVC 2018-12-06 08:16:01 -08:00
Nicolas
81b5c4a5fd Add experimental emphasis support (#961) 2018-12-06 07:56:01 -08:00
Victor Zverovich
b31680990e Fix a warning 2018-12-05 09:49:39 -08:00
Victor Zverovich
68214bd904 More time formatting 2018-11-30 20:12:01 -08:00
Victor Zverovich
322b2594e0 Implement more time specifiers 2018-11-30 09:25:18 -08:00
Victor Zverovich
f5fe849238 Specialize formatter for chrono durations 2018-11-28 11:39:21 -08:00
tnovotny
e37d6a9840 add make_printf_args and make_wprintf_args functions (#934)
* add make_printf_args and make_wprintf_args to printf.h
add minimal test for make_printf_args and make_wprintf_args to printf-test.cc

renamed the old printf_context template to basic_printf_context_t. the original wish was to rename it basic_printf_context, but that clashed with the name of the inner typedef. this style matches the format_context_t struct.
2018-11-22 13:57:07 -08:00
Victor Zverovich
982ee5c699 parse_context -> format_parse_context 2018-11-21 07:10:22 -08:00
Victor Zverovich
00a8cc8325 Fix formatting 2018-11-20 07:43:40 -08:00
Andreas Schönle
bd6121596f Disable fmt-impl-test in windows + shared lib. 2018-11-20 07:01:21 -08:00
Victor Zverovich
19e008876b More locale support 2018-11-14 16:25:49 -08:00
Victor Zverovich
f2ee988105 Improve locale support 2018-11-14 12:07:39 -08:00
Victor Zverovich
1385050e26 More formatter tests 2018-11-08 16:26:55 -08:00
Victor Zverovich
03c1b110a5 Fix gcc 4.4 build 2018-11-08 12:41:55 -08:00
Victor Zverovich
cc805c6162 Test enabled formatters 2018-11-08 10:59:10 -08:00
Victor Zverovich
e01579231d Disallow leading zeros in arg-id 2018-11-08 08:48:56 -08:00
Victor Zverovich
a23d592472 Fix check_format_string (#925) 2018-11-03 16:51:15 -07:00