Commit Graph

540 Commits

Author SHA1 Message Date
Victor Zverovich
bdda4d6030 Simplify compile-time strings 2018-10-28 09:02:03 -07:00
Daniela Engert
5ee1a4bc8a check for property 'mutable iterator' and SFINAE on it 2018-10-28 08:57:43 -07:00
XZiar
2dea780fbd change type naming and fix sfinae bug 2018-10-28 06:00:55 -07:00
XZiar
b98e8301d5 add non-char support for compile-time format check 2018-10-28 06:00:55 -07:00
Victor Zverovich
ccd3e8bbf3 Make is_constructible public (#918) 2018-10-27 17:10:19 -07:00
Victor Zverovich
73cfd8f325 Fix colored print 2018-10-25 17:18:46 -07:00
Victor Zverovich
0a96c032b9 Parameterize v*printf on string type (#920) 2018-10-25 13:52:08 -07:00
Victor Zverovich
61e6d2e38c Fix core version of vformat_to 2018-10-25 06:21:41 -07:00
Victor Zverovich
ea4010d704 Merge has_to_string_view into is_string 2018-10-24 18:16:00 -07:00
Victor Zverovich
486fff597c Add sprintf_format instantiations and remove syntactic noise 2018-10-24 16:46:32 -07:00
Daniela Engert
1e3dcbba81 fix: 'format_to_n' compiles 'std::back_inserter' arguments
std::back_insert_iterators model the OutputIterator concept but differ considerably in their traits and behavior. In particular the former made compilation to fail when format_to_n is given a back_inserter as first argument. The emulation of an OutputIterator is not perfect due to the behavioural differences of back_insert_iterators (e.g. assignment always implies increment) but good enough to be used within fmt's machinery.
2018-10-24 16:45:18 -07:00
Victor Zverovich
f0328f8e36 Use char_traits::length in string_view ctor (#914) 2018-10-24 15:21:21 -07:00
Victor Zverovich
20c708bf6d Fix build on gcc 4.4 2018-10-24 10:52:02 -07:00
Victor Zverovich
2d2326a76d Fix compilation with older gcc 2018-10-23 07:31:24 -07:00
Victor Zverovich
1ec0272303 Get rid of FMT_UNION 2018-10-22 20:19:31 -07:00
Daniela Engert
2c81c851b2 Adapt any string-like type to be used by {fmt} just like the standard string types already supported. The adaption is totally non-intrusive.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-10-22 18:25:52 -07:00
Victor Zverovich
13d472bd8c Compute output size for grisu 2018-10-18 17:16:50 -07:00
Victor Zverovich
b71d3fe7ab Remove use_grisu 2018-10-17 17:01:45 -07:00
Victor Zverovich
847abb6f8f Fix test 2018-10-17 11:57:06 -07:00
Victor Zverovich
dda47c9466 Merge min_digits and max_digits 2018-10-17 10:49:30 -07:00
Victor Zverovich
2924622157 Fix naming of basic_format_specs members 2018-10-17 10:13:10 -07:00
Victor Zverovich
bda5f9a556 Replace grisu2_specs with core_format_specs 2018-10-17 08:55:45 -07:00
Victor Zverovich
b1ca608bac Remove unused empty_spec 2018-10-17 08:39:58 -07:00
Victor Zverovich
e8efdef8de Avoid extra copy 2018-10-17 08:19:46 -07:00
Victor Zverovich
98f1c1fe87 Remove unused code 2018-10-14 15:36:45 -07:00
Victor Zverovich
50b18a3c10 Integrate Grisu 2018-10-14 14:33:25 -07:00
Victor Zverovich
699297520a Implement Grisu rounding 2018-10-13 11:18:54 -07:00
Victor Zverovich
4bb76ef0c7 Remove redundant definition of print 2018-10-13 11:15:46 -07:00
Victor Zverovich
ddd7caf38e Fix locale-dependent formatting (#905) 2018-10-13 11:15:41 -07:00
Victor Zverovich
08a65c2282 Workaround broken constexpr in MSVC2017 2018-10-11 06:38:25 -07:00
Victor Zverovich
57983423c3 Remove signbit workaround 2018-10-10 09:41:46 -07:00
superfunc
939fbe5567 Remove basic_fixed_buffer.
Issue #873 indicates that this class is no longer required,
as it has been superseded by a new API.

Fixes #873
2018-10-09 06:51:01 -07:00
Daniela Engert
f27defc639 Parameterize printf functions on the type of the format string.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-10-08 06:22:04 -07:00
Daniela Engert
6a685571df Make 'std::*::basic_string_view' a valid argument type for 'format_str' parameters.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-10-08 06:12:02 -07:00
Victor Zverovich
87a0408c64 Fix ostream.h build 2018-10-07 12:58:20 -07:00
Victor Zverovich
2b5acad4a9 Remove redundant size argument to write_padded 2018-10-07 12:45:34 -07:00
Victor Zverovich
655ce53383 is_format_string -> is_string 2018-10-07 12:45:22 -07:00
Daniela Engert
fea712abb1 Parameterize ostream functions on the type of the format string.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-10-07 09:21:14 -07:00
Daniela Engert
f16a118e88 Fix non-matching char types.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-10-07 05:56:21 -07:00
Victor Zverovich
041bf83d9b Improve fmt::format readability 2018-10-05 18:42:02 -07:00
Victor Zverovich
f5480635c0 visit -> visit_format_arg 2018-10-05 07:15:41 -07:00
Victor Zverovich
cdf3fa08dc Put related code together in fmt/core.h 2018-10-04 19:44:09 -07:00
Victor Zverovich
38325248e5 Count width in code points (#628) 2018-10-03 20:09:46 -07:00
Daniela Engert
deb901b9e4 Parameterize core functions on the type of the format string.
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-10-03 14:19:08 -07:00
Victor Zverovich
0f98de3011 Update docs 2018-10-03 12:07:55 -07:00
Victor Zverovich
c797708fcc Workaround strlen being non-constexpr in ARM toolchain 2018-10-03 09:23:49 -07:00
Victor Zverovich
63a87beba4 Add to_string_view 2018-10-01 18:48:18 -07:00
Victor Zverovich
4e0c314654 checked_format_args -> checked_args 2018-10-01 07:14:59 -07:00
Victor Zverovich
c3538a1eee Simplify variadic functions further 2018-09-30 22:19:32 -07:00
Victor Zverovich
2d7d0835d7 Simplify variadic functions 2018-09-30 21:52:47 -07:00
Victor Zverovich
3f4cfa6c60 Implement UTF-8 string support 2018-09-30 15:45:58 -07:00
Victor Zverovich
f8027414f5 Impelement char8_t support 2018-09-30 12:31:25 -07:00
Victor Zverovich
76a47d41c8 Cleanup the use of FMT_CHAR 2018-09-30 08:45:57 -07:00
Daniela Engert
267fdc7a1b Parameterize core functions on the type of the format string.
Take #1 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-09-30 08:40:58 -07:00
Victor Zverovich
5bced12421 Parameterize more functions on string type 2018-09-30 08:02:19 -07:00
Steven Hoving
674999c527 fix vs2017 warning fmt::v5::localtime 'not all control paths return a value'. 2018-09-30 07:23:35 -07:00
Victor Zverovich
e4fea22d15 Make char8_t a strongly-typed enum 2018-09-30 07:11:37 -07:00
Victor Zverovich
66992e90d2 Clarify that writing to memory_buffer appends (#877) 2018-09-28 06:22:12 -07:00
Guillaume Fraux
e864acfdbd Fix compilation with intel compilers (ICC/ICPC) v14.0 2018-09-27 07:11:23 -07:00
Daniela Engert
4cf21f58b2 constrain templated format_to on proper format string type.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-09-26 21:05:47 -07:00
Victor Zverovich
d7f17613f5 Fix compilation on platforms with exotic double (#878) 2018-09-26 08:45:34 -07:00
Victor Zverovich
e4ca37ccf6 Parameterize format_to on string type (#880) 2018-09-25 07:47:15 -07:00
Victor Zverovich
d66fa2216e Reduce syntactic noise 2018-09-23 14:31:14 -07:00
Victor Zverovich
48e6dcd0f2 Implement workarounds for gcc 4.4 2018-09-23 12:29:48 -07:00
Victor Zverovich
0ea3221d34 Remove is_named_arg and add FMT_CHAR 2018-09-23 09:44:01 -07:00
Daniela Engert
73c53d7833 Parameterize 'printf(rgb color, ...)' and 'vprint_rgb(rgb color, ...)' on the type of the format string.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-09-23 09:15:27 -07:00
Victor Zverovich
d41be23acd Simplify string_view detection 2018-09-23 07:29:35 -07:00
Victor Zverovich
2def9e4c82 Remove FMT_DTOR_NOEXCEPT 2018-09-22 18:51:32 -07:00
Victor Zverovich
ff6e46ed97 More cleanup 2018-09-22 16:00:34 -07:00
Victor Zverovich
715f2b4c00 Remove require_wchar and internalize no_formatter_error 2018-09-21 18:25:24 -07:00
Victor Zverovich
4f043f8e00 Bump version 2018-09-21 10:07:56 -07:00
Victor Zverovich
cc02cbc455 Fix formatting 2018-09-21 09:48:21 -07:00
Victor Zverovich
cb122a4d03 Fix format_to formatting to wmemory_buffer 2018-09-21 09:48:21 -07:00
Candy Gumdrop
9d8021f0d6 Add checks for NVIDIA's CUDA compiler
- Disable templated user-defined literals when compiled under nvcc

Similarly to Intel's C++ compiler, nvcc fails to compile templated UDLs
as they both share the same parsing engine (EDG C++ Front End).  This
fixes building CUDA programs which make use of fmt.
2018-09-21 06:55:45 -07:00
Jonathan Müller
9d2221b954 Improve error message when formatting unknown types 2018-09-20 07:01:39 -07:00
hhggit
70a6a4bb01 prevent ""fmt/range.h"" from specializing fmt::basic_string_view (#865) 2018-09-19 20:13:05 -07:00
Victor Zverovich
3f4984fb36 Clean core-test and fix linkage errors on older gcc 2018-09-19 12:24:38 -07:00
medithe
d43665056d Workaround visit lookup issues in printf.h on gcc 2018-09-19 09:16:26 -07:00
Victor Zverovich
59f555ad8f Workaround more visit lookup issues on gcc 2018-09-15 08:46:12 -07:00
Victor Zverovich
66381e308d Minor cleanup 2018-09-13 07:37:50 -07:00
Victor Zverovich
1fb1c4c912 Update docs 2018-09-13 07:20:43 -07:00
Victor Zverovich
fbca830dd1 Update changelog, readme and improve compat 2018-09-12 12:44:04 -07:00
Victor Zverovich
bc26fbf1b0 Move experimental color API to fmt/color.h 2018-09-12 09:04:26 -07:00
Victor Zverovich
97cc889374 Workaround a visit lookup issue in gcc 8 (#851) 2018-09-12 08:45:14 -07:00
Victor Zverovich
7110b46076 Optimize default formatting 2018-09-12 08:45:14 -07:00
Victor Zverovich
c8a8464f7d Optimize buffer construction 2018-09-12 08:45:14 -07:00
medithe
8cbfb6e727 Get rid of conversion warning in gcc-4.8 (#854)
Get rid of conversion warning in gcc-4.8 

Get rid of the following warning:
conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Werror=conversion]
2018-09-11 06:14:39 -07:00
Victor Zverovich
6ffc828a79 Phasing out null_terminating_iterator 2018-09-10 06:51:38 -07:00
Victor Zverovich
aeb6add336 Skip strchr for the common case 2018-09-09 09:08:41 -07:00
Victor Zverovich
5614289dd8 Optimize and simplify format string parsing 2018-09-09 08:41:27 -07:00
Victor Zverovich
10c7f89351 Optimize format string processing on dumb compilers 2018-09-09 08:13:06 -07:00
Victor Zverovich
59c268a5f8 Use strlen when possible since it's constexpr on gcc 2018-09-08 16:17:22 -07:00
Victor Zverovich
918bb1ce8f Optimize argument capture 2018-09-08 15:29:32 -07:00
Victor Zverovich
a3ba6b4f62 Disable the fmt(...) macro by default (#853) 2018-09-08 09:55:41 -07:00
Victor Zverovich
8671689449 Update docs and formatting 2018-09-08 09:06:54 -07:00
Victor Zverovich
cc10b4607f Make format_to faster on older gcc 2018-09-08 07:22:29 -07:00
medithe
981797f059 Get rid of implicit-fallthrough warn. in GCC 7 and 8
This change enables FMT_FALLLTHROUGH also for GCC-Compilers in the versions 7 and 8.
2018-09-07 12:43:32 -07:00
Victor Zverovich
2117775747 Micro-optimize parsing 2018-09-05 07:10:50 -07:00
Victor Zverovich
be0e268468 Optimize processing of trailing '}' 2018-08-31 15:34:31 -07:00
Victor Zverovich
fbc38b9083 Pass heavy arguments by ref 2018-08-31 15:17:18 -07:00
Victor Zverovich
8dc69b9da9 Workaround a bug in Intellisense 2018-08-29 20:40:54 -07:00
Victor Zverovich
1489d3b7fa Implement exponential notation 2018-08-29 18:55:57 -07:00
Victor Zverovich
dd8c5ce442 Implement more FP formatting options 2018-08-29 09:34:57 -07:00
Victor Zverovich
802ff8866e Fix compilation of time.h when localtime_t is a macro (#843) 2018-08-29 06:40:54 -07:00
medithe
95a718992c Remove conversion compiler warnings (#844)
* Remove conversion compiler warning

When compiling with g++8, I get the following two errors:
include/fmt/format-inl.h:400:29: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
       buffer[size++] = zero + static_cast<char>(digit);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/fmt/format-inl.h:416:28: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
       buffer[size++] = '0' + digit;
                        ~~~~^~~~~~~

With this change, the errors are gone.
2018-08-29 06:38:56 -07:00
Victor Zverovich
e483a01a0f Implement some formatting options in Grisu 2018-08-27 17:51:49 -07:00
Victor Zverovich
f51080916e Revert "Implement some formatting options in Grisu"
This reverts commit 2a952dd0b2.
2018-08-27 17:51:27 -07:00
Victor Zverovich
2a952dd0b2 Implement some formatting options in Grisu 2018-08-26 09:51:49 -07:00
Victor Zverovich
0de44a469a Implement exponent formatting 2018-08-26 08:12:35 -07:00
Victor Zverovich
f0d0a1ebd7 Implement Grisu2 digit generation 2018-08-25 20:45:50 -07:00
Victor Zverovich
569ac91e0b Implement Grisu boundary computation 2018-08-25 11:39:38 -07:00
Victor Zverovich
a11eb3a090 Workaround various icc bugs (#822) 2018-08-22 09:07:17 -07:00
Victor Zverovich
62010520ed Disable gnu-string-literal-operator-template warning 2018-08-22 08:12:59 -07:00
Victor Zverovich
987514761e Make convert_to_int public (#818) 2018-08-22 07:40:06 -07:00
Thomas Bernard
abde38b4fb Add compilation support with Newlib nano for embedded targets
Remove the dependency on std::locale to reduce executable sizes

For embedded target the usage of locale bring a huge amount of code to the executable, just to get hold of the thousands separator. Using a static defined thousands separator makes libfmt embedded target friendly.
2018-08-19 07:40:34 -07:00
Elias Daler
18400503da Fix C4127 warning in basic_writer<Range>::write_double 2018-08-17 07:36:38 -07:00
Victor Zverovich
9de312112a Reformat and add a comment 2018-08-15 06:54:43 -07:00
Victor Zverovich
8b9fb9fb7e Fix ambiguous instantiation with formatter in fmt/ostream.h (#830) 2018-08-11 09:13:54 -07:00
medithe
4b868b8922 Re-enable compile-time format-string checking
Since the commit 691a7a9 compile-time string checking was accidently not possible anymore.
With this change, it should be possible again.
2018-08-07 07:43:47 -07:00
Victor Zverovich
4061a0d35d Parameterize vformat to support custom char types 2018-08-05 10:44:59 -07:00
Victor Zverovich
c68bab7014 Remove broken fmt::internal::format_enum (#818) 2018-08-01 07:11:53 -07:00
Victor Zverovich
ce19309d09 Workaround a bug in icc 15 2018-07-26 07:59:41 -07:00
Victor Zverovich
c684349195 Move contiguous version of format_to to fmt/core.h 2018-07-22 18:09:22 -07:00
Victor Zverovich
8db14efa84 util-test -> core-test and minor cleanup 2018-07-22 17:05:23 -07:00
Victor Zverovich
ffe414cad1 Add compile-time format string checks to format_to (#783) 2018-07-22 15:30:51 -07:00
Victor Zverovich
c178ab440f Remove FMT_USE_RVALUE_REFERENCES 2018-07-22 15:07:53 -07:00
Victor Zverovich
5befe6584d Remove fmt/folly.h and clean up core API 2018-07-22 14:42:25 -07:00
Victor Zverovich
35538ca66c Merge more format overloads 2018-07-22 12:24:47 -07:00
Victor Zverovich
4f16409730 Merge format overloads using SFINAE 2018-07-22 08:06:42 -07:00
Victor Zverovich
2a4e948864 Add UTF-8 types 2018-07-22 06:36:21 -07:00
MikePopoloski
7b4f170c94 Fix warning about using old-style cast 2018-07-20 17:07:23 -07:00
MikePopoloski
b1d10a2884 Add support for dynamic arg sets
This allows construction of basic_format_args from a dynamic set of arguments. The syntax is a little clunky and could probably be improved but this at least enables the functionality.
2018-07-20 17:07:23 -07:00
Victor Zverovich
cf2719bd12 Add support for types explicitly convertible to wstring_view 2018-07-18 19:12:10 -07:00
Victor Zverovich
73bed45b7a Add support for types explicitly convertible to fmt::string_view 2018-07-18 14:42:26 -07:00
Victor Zverovich
6eaa507473 Fix global initialization issue (#807) 2018-07-18 09:49:21 -07:00
Victor Zverovich
48dff9f3c5 Update docs 2018-07-18 06:44:46 -07:00
Victor Zverovich
a9e261599b Minor cleanup 2018-07-17 08:54:22 -07:00
Victor Zverovich
8615ff2acc Micro-optimize argument retrieval 2018-07-15 07:28:31 -07:00
Victor Zverovich
916ed99dab Micro-optimize argument retrieval 2018-07-14 15:28:55 -07:00
Victor Zverovich
e7e9578ed4 Optimize format string parsing 2018-07-14 14:27:56 -07:00
Victor Zverovich
c99a259739 Mark new functions with FMT_API (#808) 2018-07-14 07:43:16 -07:00
Victor Zverovich
e0f6a2f8be Add a formatter for folly::StringPiece 2018-07-14 07:31:47 -07:00
Alexej Harm
a317448bd4 Keep noexcept specifier when exceptions are disabled. 2018-07-13 12:46:15 -07:00
Marek Kurdej
2a4cd6d05e Fix the returned value of format_to_n with user-defined types having operator<<. 2018-07-10 14:01:12 -07:00
Henry Schreiner
9c32e73abf Fixing return unreachable warning on NVCC 2018-07-09 21:33:10 -07:00
gabime
e5c93108e6 Added clear() to basic_buffer 2018-07-09 20:25:49 -07:00
Victor Zverovich
f66ba6508a Optimize format string parsing 2018-07-08 10:15:24 -07:00
Victor Zverovich
f21268aa72 Revert "Optimize format string parsing" because of a bug in MSVC
https://godbolt.org/g/rpiDgh

This reverts commit f9e9bf0231.
2018-07-08 08:08:50 -07:00
Victor Zverovich
f9e9bf0231 Optimize format string parsing 2018-07-07 16:50:22 -07:00
Florin Iucha
e6362642cf Fix pedantic conversion warning 2018-07-04 17:45:28 -07:00