frosch
9229956f04
Codechange: Replace strcasestr with StrContainsIgnoreCase.
2025-04-09 17:19:11 +02:00
frosch
14bab7d76b
Codechange: Remove unused Utf8TrimString, Utf8PrevChar.
2025-04-09 17:19:11 +02:00
frosch
9dc751ed8a
Codechange: Remove now unused Utf8Encode.
2025-04-08 23:10:58 +02:00
frosch
04246c530f
Codechange: Use fmt::format instead of stringstream with iomanip flags. ( #13964 )
2025-04-08 20:57:50 +00:00
Peter Nelson
5b9d171e63
Codechange: Use EnumBitSet for StringValidationSettings. ( #13974 )
2025-04-08 21:19:17 +01:00
frosch
2cdf2bedfa
Codechange: Add a std::string overload for StrMakeValidInPlace() and a moving std::string&& overload for StrMakeValid(). ( #13962 )
2025-04-07 18:22:47 +02:00
frosch
44984f8410
Codechange: Remove broken and unused StrMakeValidInPlace overload. ( #13960 )
...
If an otherwise valid string without NUL termination was passed, a NUL was appended out of bounds.
2025-04-04 11:48:32 +02:00
frosch
f06bfc0dad
Codechange: Use Utf8View to const-iterate over strings, if no particular error handling is needed.
2025-04-03 18:43:41 +02:00
frosch
f19e75b606
Codechange: Use Utf8View in Utf8StringLength.
2025-04-03 18:43:41 +02:00
frosch
83401ad5e2
Codechange: Use Utf8View::iterator in StringIterator.
2025-04-03 18:43:41 +02:00
frosch
d4ae0f70da
Codechange: StringFilter now uses std::string_view entirely ( #13869 )
2025-03-22 20:35:31 +01:00
Rubidium
02f040b22a
Codechange: remove unused alloc_func.hpp includes
2025-02-24 20:00:19 +01:00
Peter Nelson
1f21e9dc74
Codechange: String parameter encoding for regular strings.
...
This allows a string and its parameters to be encoded and stored as just one string, instead of juggling with capturing and restoring string parameters.
The advantage of EncodedStrings over raw strings is they use current language and parameter values at the point of decoding.
2025-02-10 22:49:14 +00:00
Peter Nelson
dccc6185b9
Codechange: Change internal format of encoded strings to improve robustness and allow expansion. ( #13499 )
2025-02-09 12:45:50 +00:00
Peter Nelson
9cf47e69d6
Fix bb8a0c7641: Skip control codes when sorting strings. ( #13035 )
...
Now that SkipGarbage doesn't skip all multi-byte utf-8 characters, string control codes are not skipped either. This gave unintended sorting when NewGRF names start with colour codes.
Make SkipGarbage UTF-8 aware so that it is able to skip some unicode ranges as well.
2024-10-27 15:49:09 +00:00
Peter Nelson
bb8a0c7641
Fix: SkipGarbage() skipped all multi-byte utf-8 characters. ( #13032 )
...
`char` is signed so `str[0] < '0'` applies to all characters higher than 127.
2024-10-26 21:01:33 +01:00
Peter Nelson
56b0eac2e9
Codechange: Use std::span/std::string_view for strecpy. ( #12848 )
...
This avoids needing to manually pass the last character of the destination buffer, and allows use of standard library functions.
2024-07-09 00:05:42 +01:00
Peter Nelson
aee04e7bc6
Codechange: Pass span to StrValid instead of first and last - 1. ( #12846 )
...
`std::span` is used instead of `std::string_view` as this is only used for fixed-length buffers.
This removes some callers of `lastof()`
2024-07-08 08:36:57 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Ivan Fefer
23d733be95
Add: Basic autocompletion on tab for console commands ( #12163 )
2024-03-13 21:43:08 +01:00
Patric Stout
75f21065c9
Codechange: refactor DecodeHexText to a generic purpose ConvertHexToBytes ( #11866 )
...
DecodeHexText() does more than just decoding hex. ConvertHexToBytes()
now only does pure hex decoding. This required a bit of refactoring
for the code using DecodeHexText().
2024-01-22 19:42:47 +01:00
Rubidium
2d77cf9c80
Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with
2024-01-17 19:48:22 +01:00
Patric Stout
fd073a2810
Remove: replace custom span with std::span
2024-01-17 00:25:08 +01:00
Jonathan G Rennison
88324a253e
Fix #11644 : Off by one error/buffer over-read in StrMakeValid ( #11645 )
...
* Fix #11644 : Off by one error in StrMakeValid UTF-8 decode overrun detection
* Fix #11644 : Off by one error in StrMakeValid buffer last character
* Fix: Unnecessary string duplication at StrMakeValid call sites
2024-01-01 13:26:31 -05:00
Michael Lutz
86e28e79fb
Fix #11402 : Make string filter locale-aware.
2023-11-03 22:34:01 +01:00
Michael Lutz
c294eaacc1
Fix: char_traits::find needs to return nullptr if nothing was found.
2023-11-03 22:34:01 +01:00
Rubidium
37f84b7372
Codechange: replace x.size() != 0 with !x.empty()
2023-10-20 23:05:43 +02:00
Peter Nelson
49dae08a3b
Codechange: Add missing override specifiers.
2023-09-25 21:27:45 +01:00
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium
b958a343fe
Codechange: the templated StrMakeValidInPlace is not in place
2023-07-06 19:59:41 +02:00
Rubidium
e04d43f396
Remove: now unused stredup
2023-07-03 18:08:03 +02:00
Rubidium
48dcb79145
Cleanup: remove seprintf and vsnprintf
2023-06-09 06:41:33 +02:00
Rubidium
97dd84d1e0
Codechange: move saveload string fixing code to saveload
2023-06-08 20:36:27 +02:00
Rubidium
e762855201
Cleanup: remove str_strip_colours; StrMakeValid also removes the colours
...
Essentially str_strip_colours followed by StrMakeValid makes the calling of
str_strip_colours useless, as StrMakeValid would have removed them too.
2023-06-08 19:32:15 +02:00
Rubidium
4ca23a19b6
Cleanup: char-pointer variant of strtolower
2023-06-08 18:09:11 +02:00
Rubidium
ce8933d63e
Add: std::back_insert_iterator<std::string> Utf8Encode function
2023-06-05 23:26:12 +02:00
Rubidium
6a519f5d89
Cleanup: strecat has no uses anymore
2023-06-04 19:45:42 +02:00
Rubidium
acec34a0fe
Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex
2023-05-19 11:24:44 +02:00
Rubidium
d9a04ba446
Codechange: make the MD5 hash/digest/checksum variables a std::array
2023-05-19 11:24:44 +02:00
Peter Nelson
83f2ad500e
Codechange: stdarg.h include not needed as cstdarg is included.
2023-05-17 10:14:41 +01:00
Patric Stout
febe394806
Codechange: replace C-style strings with C++-style strings in textfile ( #10772 )
2023-05-09 19:35:50 +00:00
Rubidium
a312a6c1b2
Codechange: make md5sumToString std::string compatible
2023-05-04 23:23:32 +02:00
Rubidium
ee9239d293
Fix c8299304: retain support ICU < 65
2023-04-30 00:42:15 +02:00
Rubidium
c829930440
Codechange: replace strnatcmp with C++ string capable version
2023-04-29 12:07:45 +02:00
Rubidium
b5f96808a1
Fix: FormatArrayAsHex returns gibberish instead of a hex array
2023-04-29 11:07:57 +02:00
Rubidium
4dd5f994be
Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith
2023-04-29 10:25:25 +02:00
Rubidium
86786a7af6
Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp
2023-04-29 10:25:25 +02:00
Rubidium
9fe853f7b5
Codechange: use fmt::format instead of vseprintf for midi command formatting
2023-04-26 18:46:17 +02:00
Rubidium
c8ff6a9f7c
Codechange: replace str_fmt with std::string constructs
2023-04-26 18:46:17 +02:00
Rubidium
f74e26ca7e
Codechange: replace error/usererror printf variant with fmt variant and rename
2023-04-25 17:55:09 +02:00