Commit Graph

29 Commits

Author SHA1 Message Date
4489d513be migrate to std::ranges
Move the various seq_ functions, as well as std::(stable_)sort,
std::accumulate, std::transform, std::find, std::find_if to their C++20
std::ranges counterparts.
2026-08-20 15:05:31 -07:00
1e1311fc39 mu-utils: cleanups
Fix some types

Improve error handling

Remove dead/unused code
2026-08-20 15:05:31 -07:00
a03fd48551 utils: support negative lexnums
We use "lexnums" to efficiently/sortably store numbers >= 0; let's
support negative numbers as well (albeit not very optimal in size yet)
2026-08-20 15:05:31 -07:00
86464cd083 modernization: tweaks for c++20
Update various places for what we can do with C++20:

- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED

Also remove some unnecessary 'static'
2026-08-20 15:05:30 -07:00
f2960a197e utils: add ascii ctype helpers
Add some constexpr ctype helpers that avoid any possible UB (i.e.,
handling casting to unsigned), and explicitly avoid any
locale-specifics.
2026-08-20 15:05:30 -07:00
ab6017d5a9 utils: rework MU_ENABLE_BITOPS using C++20 code
Instead of macros, we using C++20 concepts to define the helpers to deal with
bitops on enum-class conveniently.

x# Please enter the commit message for your changes. Lines starting
2026-08-20 15:05:28 -07:00
5f7686a767 test-utils: fix some clang-tidy warnings 2026-08-20 15:04:27 -07:00
5c6642c9b9 utils: add utf8_clean helper
To morph text into valid utf8 if it isn't already.
2026-08-20 15:04:27 -07:00
29ce96923a test-mu-utils: update parse_date_time tests
We're using ::time_t now.
2024-04-14 11:30:20 +03:00
4a0eba8ddf improve unit tests 2023-09-24 20:21:57 +03:00
04e3a2f9a8 mu-utils: improve tests 2023-09-21 23:41:15 +03:00
7cbab21099 utils: add utf8_wordbreak
Determine if a string has wordbreaks in a mostly Xapian-compatible way.
We need this to determine what strings should be considered "phrases".
2023-09-17 18:11:10 +03:00
9c28c65d45 utils: handle "unbroken" scripts
Do not removing combining characters from scripts without explicit word
boundaries, such as those for CJK.

Reuse some Xapian code for that.
2023-09-09 11:40:36 +03:00
15f08488d3 remove Mu::format, use mu_format
Use the new fmt-based formatting.
2023-08-19 20:04:50 +03:00
82235b9d49 fmt: more update to use new fmt-based APIs 2023-07-06 21:49:50 +03:00
6979a66630 utils: get rid of mu-util.[ch]
It was getting old...
Remove the unused parts, refactor the few parts still in use.
2023-01-14 20:02:05 +02:00
27ecbbdd65 many: use Mu::Regex instead of std::regex
The former is PCRE-compatible, and faster than std::regex.
2022-12-30 11:15:03 +02:00
9e60ebb683 utils: add helpers for assoc-pairs
Add some unit-test, too.
2022-10-02 18:24:23 +03:00
317fe53ff7 tests: update test helpers and users
Move test-mu-common to mu-test-utils. Use mu_test_init as a wrapper for
g_test_init. Update users.
2022-08-11 22:55:10 +03:00
f69ad37e7a utils: add regex-split 2022-06-16 22:49:46 +03:00
646a672ae0 test-utils: add error test 2022-06-09 00:39:34 +03:00
015a7ee0cb utils: improve locale_workaround
Fixes: #2270.
2022-06-04 00:41:28 +03:00
13f0e24241 lib: improve test coverage
Add a bunch of tests
2022-06-02 21:07:41 +03:00
b03590cca8 tests: skip missing timezones in queries, too 2022-05-18 01:08:40 +03:00
33d30775ee test-utils: Skip test if timezone is not available 2022-05-18 00:52:28 +03:00
b7a30c0a36 utils: update date/size parsing, factor out format
And update tests
2022-04-30 10:40:45 +03:00
e0096c3dee utils: improve split / join 2022-03-19 10:58:13 +02:00
4990792f02 utils: rework Mu::split
And add some tests, cleanups.
2022-02-22 23:07:30 +02:00
48d3f9cfab tests: move to subdir, move to meson
De-clutter the source directories a bit. Ensure tests build with meson, and
remove from autotools in a few places (no need to do things twice).
2021-11-08 23:58:05 +02:00