Victor Zverovich
0302927f56
Optimize pointer formatting
2019-04-05 20:36:37 -07:00
Victor Zverovich
bb6842ba35
Simplify to_string
2019-04-05 19:15:22 -07:00
Victor Zverovich
b23c8633fa
Detect presence of uintptr_t
2019-04-05 07:43:00 -07:00
Victor Zverovich
018d8b57f6
Remove broken snprintf
2019-03-30 20:27:52 -07:00
Billy Donahue
1987db663b
clang-format
2019-03-30 07:48:53 -07:00
Billy Donahue
a6d1ad741d
handle fwrite results #1098
2019-03-30 07:48:53 -07:00
Ivan Shynkarenka
e979c782d3
Extend basic_writer with write() method for doubles with optional format_specs argument
2019-03-25 19:16:41 -07:00
Victor Zverovich
91acfe6852
Fix UBSAN warning
2019-03-22 07:56:02 -07:00
Victor Zverovich
b7e6bf9671
clang format
2019-03-21 20:51:37 -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
ricco19
6d416cf674
Forward declare is_string<FILE*> specializations
2019-03-19 05:20:18 -07:00
Victor Zverovich
294fd7df96
Remove isinf workaround
2019-03-17 14:49:19 -07:00
Victor Zverovich
0faa968cc3
Make floating-point formatting locale-independent
2019-03-17 13:26:56 -07:00
Victor Zverovich
bc784d3625
Remove isnan workaround
2019-03-17 12:23:36 -07:00
Victor Zverovich
76d326a2a2
Enable grisu for general format
2019-03-17 09:48:50 -07:00
Victor Zverovich
c21c6b8c4b
Move enable_if to template params
2019-03-16 15:15:38 -07:00
Victor Zverovich
ae0b0dab9f
Remove obsolete TODO
2019-03-16 10:04:16 -07:00
Victor Zverovich
97619e27a2
More fixed precision tests
2019-03-15 10:20:20 -07:00
Victor Zverovich
a939c75956
Merge fmt/time.h into fmt/chrono.h
2019-03-14 18:07:42 -07:00
Victor Zverovich
17e4b53926
Make chrono formatting work without exceptions ( #1062 )
2019-03-14 18:01:03 -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
49bbf3c876
Simplify shadowing warning fix
2019-03-13 08:29:37 -07:00
Ivan Shynkarenka
e06523361d
Visual Studio 2017: warning C4456: declaration of 'result' hides previous local declaration
2019-03-11 14:15:23 -07:00
Victor Zverovich
4c66dad8c1
Refactor digit generation
2019-03-10 15:45:06 -07:00
Victor Zverovich
b1f7cca89e
stop -> handler and swap args
2019-03-10 14:43:26 -07:00
Victor Zverovich
f90d33ca12
error_ulp -> error
2019-03-10 14:29:28 -07:00
Victor Zverovich
1632f72cbe
Test get_round_direction
2019-03-10 11:14:50 -07:00
Bruce Mitchener
4523053e6f
Fix typos.
2019-03-10 07:49:33 -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
Victor Zverovich
3466d9c845
Don't override fixed formatting depending on exponent ( #1072 )
2019-03-09 13:22:07 -08:00
Victor Zverovich
93d22dec35
Implement rounding up and clean up FP formatting
2019-03-09 10:40:36 -08:00
Victor Zverovich
d560ddac25
Temporarily disable Grisu for fixed formatting
2019-03-08 19:09:05 -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
8f7780a4f6
Correct comment
2019-03-06 09:23:16 -08: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
Brian
327d4b6e9e
Fixes for some pedantic warnings ( #1054 )
...
* Fix order of initializers
* Remove unused parameter
* Disable warning "-Wswitch-enum"
2019-02-23 09:40:08 -10:00
Victor Zverovich
8af651be39
Implement fixed precision
2019-02-22 10:47:27 -10:00
Michael Lui
187bd1b8b2
Clarify lifetimes of named_arg parameters ( #1051 )
...
* Clarify usage of fmt::arg
Document that fmt::arg takes a non-owning
reference, even if that reference is to
a temporary. As such, users should make sure
the lifetime of the reference lasts as long
as the named argument.
* Clean up language
Remove mentions of `std::reference_wrapper` and rvalues
in favor of more common terminology like dangling references.
2019-02-22 06:37:19 -10:00
Victor Zverovich
82c24edcf6
Workaround a bogus Qt Creator warning
2019-02-19 06:33:55 -10:00
Victor Zverovich
c5aad69f2a
Restore deprecated begin()
2019-02-15 15:00:02 -08:00
Victor Zverovich
5b0006476a
Make stopping condition configurable in grisu
2019-02-14 18:25:13 -08:00
Victor Zverovich
a44238f2ef
Improve grisu
2019-02-13 20:03:27 -08:00
Victor Zverovich
83808076e3
Minor cleanup
2019-02-13 19:28:02 -08:00
Victor Zverovich
9660ea1bff
Simplify format string checks
2019-02-10 18:00:19 -08:00
Victor Zverovich
f041f128f5
Minor cleanup
2019-02-10 15:20:40 -08:00
Victor Zverovich
e4572e5def
Update std implementation
2019-02-10 07:56:33 -08: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
morinmorin
430e6ac9b6
Protect against overloaded comma operators in decltype
2019-02-06 15:44:59 -08:00
Victor Zverovich
467520e7a4
Remove unused macro
2019-02-06 11:34:59 -08:00
Victor Zverovich
5a314a5288
Eliminate extra copy on floating-point formatting
2019-02-06 10:17:50 -08:00
Daniela Engert
31510cb437
Fix warnings from Visual Studio
...
Name hiding.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-02-04 11:58:56 -08:00
Daniela Engert
61c9b563c2
Replace 'std::result_of' by 'std::invoke_result' where possible ( #1025 )
...
C++17 deprecated 'std::result_of' in favour of 'std::invoke_result' and will ban it outright in C++20. Therefore
- implement 'internal::result_of' in terms of 'std::invoke_result' when compiling C++17 mode.
- implement 'internal::result_of' in terms of 'std::result_of' when compiling in modes C++11 or C++14.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-02-04 11:25:22 -08:00
Victor Zverovich
864b9a2202
Correct the comment
2019-02-04 08:29:39 -08:00
Victor Zverovich
1538336836
Remove unnecessary checks
2019-02-04 08:25:41 -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
Victor Zverovich
e61cac687d
Minor grisu improvements
2019-02-02 07:41:52 -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
Elias Kosunen
34951f1999
Replace comments regarding deprecation with attributes
2019-02-02 05:48:39 -08:00
Victor Zverovich
3f52336e6c
Simplify formatter selection
2019-01-30 19:39:42 -08:00
Victor Zverovich
7ca8fc3b17
Fix a bogus warning
2019-01-30 07:06:40 -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
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
7cdb1e5e40
Workaround broken is_default_constructible in MSVC
2019-01-21 10:54:49 -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
dad1eec842
Workaround unimplemented T... on gcc 4.6.x ( #1008 )
2019-01-16 11:41:20 -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
dde095fab8
Revert "Reorder defines"
...
This reverts commit 4a059914a9
.
2019-01-13 08:13:38 -08:00
Victor Zverovich
4a059914a9
Reorder defines
2019-01-13 07:40:37 -08: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
Daniela Engert
f5cc77cea0
Get rid of 'null_terminating_iterator' in printf.h ( #980 )
...
The iterator class itself and its helpers 'to_pointer' are removed after reformulating the formatting loop in terms of a 'basic_string_view<Char>::iterator'.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-04 12:18:14 -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
Victor Zverovich
b3ad759a0a
Bump version and correct changelog
2018-12-28 13:09:31 -08:00
Victor Zverovich
b34d92b051
Bump version
2018-12-28 12:23:29 -08:00
Victor Zverovich
84e5170c9c
Update changelog and deprecate visit
2018-12-24 10:02:41 -08: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
1f92f8a9d8
Remove noexcept
2018-12-15 06:41:32 -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
7f7504b3f5
Clean up docs
2018-12-12 18:21:13 -08:00
Victor Zverovich
37f599b1a1
Fix docs
2018-12-12 17:50:50 -08:00
Victor Zverovich
8c2e15aed5
Make printf work in search ( #164 )
2018-12-12 16:07:54 -08:00
Victor Zverovich
de71db6d42
Fix asan error ( #977 )
2018-12-12 11:29:39 -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
b6bc6ec246
Add default ctor and fix use of constexpr macros in text_style
2018-12-07 07:22:18 -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
3242ddf7b5
Fix warnings
2018-12-06 08:16:12 -08:00
Nicolas
81b5c4a5fd
Add experimental emphasis support ( #961 )
2018-12-06 07:56:01 -08:00
Victor Zverovich
7c4eb0fbeb
Fix warnings in time.h
2018-12-05 14:38:08 -08:00
Victor Zverovich
2d624218bf
Fix another warning
2018-12-05 10:19:53 -08:00
Victor Zverovich
0497875ff3
Stop the orgy of casts
2018-12-05 06:27:31 -08:00
Victor Zverovich
37dc495b9d
Simplify MSVC workaround
2018-12-05 06:22:18 -08:00
liuping
2ff4996d05
Fix ambiguous complier error C2666 in vs2017.The '+' opeator may cause ambiguity.Avoid implicit conversion.
2018-12-05 05:55:43 -08:00
Florin Iucha
77656c672c
Fix sign-conversion warnings reported by Clang7
2018-12-03 16:22:59 -08:00
Victor Zverovich
ea5e4790bd
Fix formatting
2018-12-03 08:58:48 -08:00
Johan J
e867768ee6
Do not override user provided compile flag
2018-12-03 07:31:19 -08:00
Daniela Engert
e7e2ab1070
Make return type of basic_format_args::max_size() consistent.
...
This squashes nasty narrowing conversion warnings.
2018-12-01 17:07:21 -08:00
Victor Zverovich
68214bd904
More time formatting
2018-11-30 20:12:01 -08:00
Victor Zverovich
bcf3fcd673
Clean up bit fiddling for argument packing
2018-11-30 17:04:49 -08:00
Victor Zverovich
9dcf127fa5
Workaround a bogus MSVC warning
2018-11-30 13:47:04 -08:00
Victor Zverovich
b8b06e3e10
Fix conversion warnings in Grisu
2018-11-30 10:37:40 -08:00
Victor Zverovich
322b2594e0
Implement more time specifiers
2018-11-30 09:25:18 -08:00
Victor Zverovich
fa1d4dbcfd
Fix warnings
2018-11-28 16:15:15 -08:00
Victor Zverovich
99744f8f8f
Suppress unfixable warning
2018-11-28 12:52:41 -08:00
Victor Zverovich
f5fe849238
Specialize formatter for chrono durations
2018-11-28 11:39:21 -08:00
Victor Zverovich
a5a9805a91
First stub at the datetime format parser
2018-11-25 17:25:22 -08:00
Victor Zverovich
645c76a9a5
Fix dummy warnings
2018-11-25 15:33:28 -08:00
Daniela Engert
fecb2d6f0d
Eliminate msvc compiler warnings ( #931 )
...
The sheer presence of 'std::gmtime' or 'std::localtime' gives rise to C4996 warnings in Microsofts compilers. Alas, the 'fallback(internal::null<>)'functions containing these library calls are never ADL-picked in the respective 'handle(internal::null<>)' selectors. Therefore hiding the fallbacks from msvc is perfectly fine.
2018-11-25 13:48:52 -08:00
Victor Zverovich
64690d3a97
Add context_base::arg()
2018-11-24 10:49:48 -08:00
Victor Zverovich
01640f44cf
Fully qualify dummy_int ( #941 )
2018-11-24 06:22:59 -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
b7b8548559
thousands_sep -> thousands_sep_impl ( #939 )
2018-11-20 15:43:17 -08:00
Victor Zverovich
6c95fb3562
Default Context to format_context
2018-11-18 07:19:25 -08:00
christinaa
16b78ee629
fix incompatibilities with c++2a mode in clang
2018-11-17 08:38:04 -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
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
Victor Zverovich
324eac1aa5
Make locales work with any character type
2018-10-28 09:03:27 -07:00
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