Commit Graph

54 Commits

Author SHA1 Message Date
Barry Revzin
0b2862a1e4
Range formatter (#2983)
* Implement range_formatter and format_kind

* Attempted gcc 4.8 fix

* gcc 4.8 interprets inaccessible as a hard error (instead of... not available)

* Attempting to delete set_debug_format.

* clang-format

* Different implementation of FMT_STATICALLY_WIDEN

* Renaming copy_str_range to copy_str.

* I guess I need a definition

* Forgot to delete these.

* Other PR comments.
2022-07-29 13:55:16 -07:00
Barry Revzin
92d36e82c4
The n specifier for ranges (#2981)
* The n specifier for ranges.

* Flipping flag polarity.
2022-07-12 10:08:38 -07:00
Victor Zverovich
0c06c81da8 Deprecated implicit conversion of enums to ints for consistency with scoped enums 2022-07-03 09:02:22 -07:00
jehelset
5682338891
Fix is_formattable for tuple-like types. (#2940) 2022-06-19 08:25:58 -07:00
Victor Zverovich
c83a5d42bb FMT_MSC_VER -> FMT_MSC_VERSION 2022-05-29 15:39:08 -07:00
Vladislav Shchapov
1f9eae7e31 Add xchar support for write_escaped_string.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-05-27 08:36:38 -07:00
Riccardo Brugo
a8fe8becf4
Fix compilation error for ranges with ADL begin/end (#2807)
* Use `range_begin`/`end` to get formatted range iterators

* Add test for adl `begin`/`end`

* Apply clang-format

* Simplify tests
2022-03-11 11:36:39 -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
8a21e328b8 Remove problematic constructibility check 2022-02-04 12:20:02 -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
796662a612 Escape range items convertible to std::string_view 2021-12-27 09:38:06 -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
fd62fba985 Don't convert scoped enums to integers 2021-12-09 12:09:33 -08:00
Barry Revzin
7aca36bca4
Extending fmt::join to support C++20-only ranges. (#2549) 2021-10-16 10:02:03 -07:00
Victor Zverovich
2fe94ad7e3 Make specifiers support in tuple_join an opt-in 2021-09-05 07:34:06 -07:00
Victor Zverovich
60cd5ea3f2 Add support for more formattable types in ranges 2021-09-03 14:55:41 -07:00
sunmy2019
a44c8f651b
reimplement formatter<tuple_join_view> (#2457)
* reimplement `formatter<tuple_join_view>`

1. completely reimplement `formatter<tuple_join_view<Char, T...>, Char>`
2. Add some tests

* use FMT_THROW
2021-08-23 09:51:19 -07:00
Victor Zverovich
2207ea0b36 More escaping 2021-08-22 16:54:26 -07:00
Victor Zverovich
a212ff757f Escape invalid code points 2021-08-22 15:51:33 -07:00
Victor Zverovich
07d033ecb4 Fix is_printable 2021-08-22 10:37:18 -07:00
Victor Zverovich
371d8e2ee0 Escape Unicode 2021-08-22 07:55:59 -07:00
Victor Zverovich
6397095ca4 More escaping 2021-08-21 16:36:25 -07:00
Victor Zverovich
11b07a56b2 We should escape 2021-08-19 14:50:59 -07:00
Victor Zverovich
b559cfd4c0 Implement basic escaping 2021-08-19 14:12:26 -07:00
Victor Zverovich
76ee490468 Move wchar/custom char overloads to xchar.h 2021-06-05 22:57:45 -07:00
Victor Zverovich
400b953fbb Use [] instead of {} in ranges for consistency with Python format 2021-05-04 21:04:21 -07:00
Victor Zverovich
38bcc04a11 Drop range limit and cleanup tests 2021-05-04 20:53:56 -07:00
Victor Zverovich
c738c3431f Cleanup tests 2021-05-04 17:23:13 -07:00
Alexey Ochapov
53ca0cbe75 gtest: move GTest/GMock files to separate directory, update GTest/GMock usages
* all GTest/GMock files moved to `test/gtest` directory
* `CMakeLists.txt` created in `test/gtest` from `CMakeLists.txt` in `test`
* GTest/GMock target in CMake renamed to `gtest` (was `gmock`)
* CMake `gtest` target updated to export includes as "gtest/gtest.h" or "gmock/gmock.h" only
* includes in tests updated: "gtest.h" -> "gtest/gtest.h", "gmock.h" -> "gmock/gmock.h"
* removed duplications of `target_include_directories` for GTest/GMock directories (CMake manages them)
2021-04-29 07:11:49 -07:00
crbrz
9260114162
Ranges wide strings support (#2236)
* Ranges copy wchar_t

* arg_join formatter not working for wide strings

* Added ranges wide string tests

Co-authored-by: Cristi <cristi@emailaddressmanager.com>
2021-04-16 06:25:35 -07:00
Alexey Ochapov
2a25e2bf4d
Make ranges-test available with C++11 (#2114)
* make ranges-test available with C++11, fix problem with some gcc versions

* potentially fix build for MSVC 19.10, a bit reorganizing in test
2021-01-30 07:42:58 -08:00
Walter Gray
4fa4c9248f
Add tests for FMT_ENFORCE_COMPILE_STRING, fix several errors (#2038) 2020-12-24 06:40:46 -08:00
kitegi
f4ca065cfb Range support 2020-10-28 05:35:37 -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
2f7e08856b Disable range formatter if value type is not formattable (#1885) 2020-09-20 08:37:49 -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
Tony E Lewis
febffa4e64
Make join() handle non-const-only begin/end ranges (#1786)
See fmtlib/fmt#1784.

Add tests that demonstrate the problem and check obvious variations.
2020-07-21 12:13:00 -07:00
Barry Revzin
c66aae1652
Adding sentinel support to fmt::join(). (#1689) 2020-05-18 06:31:01 -07:00
Victor Zverovich
7f723fbcb8 Consistently namespace qualify size_t 2020-05-07 15:59:46 -07:00
Nikolay Rapotkin
85050aa2e6 Ability to join elements of std::initializer_list was added 2020-03-15 16:10:00 -07:00
Victor Zverovich
61c5a51604 Fix handling of empty tuples (#1588) 2020-03-14 07:41:08 -07:00
Victor Zverovich
0fc7bd1573 Fix ambiguity for types with dodgy conversions 2019-09-28 11:35:20 -07:00
Jeremy Ong
b4f1988c4b Provide overload for fmt::join that handles std::tuples
Address enhancement request #1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
2019-09-27 14:05:35 -07:00
Victor Zverovich
b2d4ca1546 Workaround an issue with std::filesystem::path being an infinitely deep range (#1268) 2019-08-21 11:22: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
2e526a664a Fix handling of output iterator in ranges 2019-03-06 08:10:46 -08:00
Victor Zverovich
58b6f8db48 Format the code using clang-format 2019-01-13 06:58:20 -08:00
Victor Zverovich
20c708bf6d Fix build on gcc 4.4 2018-10-24 10:52:02 -07:00
Victor Zverovich
479ee2a8c6 Fix MSVC build, take 2 2018-07-04 14:24:07 -07:00