Rubidium
af25eecc15
Codechange: use const for std::string_view where appropriate
2025-04-29 10:15:18 +02:00
frosch
d2c9828b4c
Codechange: Move IsUtf8Part to only file using it.
2025-04-14 18:56:23 +02:00
frosch
588fedb5db
Codechange: Remove unused Utf8Consume, Utf8Decode, Utf8EncodedCharLen.
2025-04-14 18:56:23 +02:00
frosch
96eee0e8e4
Codechange: Base ByteReader on StringConsumer.
2025-04-13 21:59:10 +02:00
frosch
294f826364
Codechange: Replace last usage of Utf8CharLen with Utf8View.
2025-04-09 17:19:11 +02:00
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
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
f19e75b606
Codechange: Use Utf8View in Utf8StringLength.
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
Patric Stout
155aaa5967
Fix fd2949d: use std::prev() to walk back from a possible string::end()
2025-02-16 16:36:25 +01:00
Rubidium
8b7460759a
Codechange: rework StringFilter to not need MallocT anymore
2025-02-15 23:43:57 +01:00
Rubidium
ad8f394835
Codechange: introduce string::iterator aware Utf8Decode, Utf8Encode and Utf8PrevChar
2025-02-15 21:52:55 +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
Peter Nelson
a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. ( #12455 )
...
* Codechange: Replace C-style casts to size_t with static_cast.
This touches only simple value-type casts.
* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX
Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +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
Rubidium
3a676a5af0
Codechange: replace static inline with static for non-class functions
2024-01-06 13:37:33 +01:00
Michael Lutz
86e28e79fb
Fix #11402 : Make string filter locale-aware.
2023-11-03 22:34:01 +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
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
Rubidium
f1fb6c95fe
Add: case insensitive string comparator
2023-05-09 23:14:48 +02: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
c829930440
Codechange: replace strnatcmp with C++ string capable version
2023-04-29 12:07:45 +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
Michael Lutz
a05fd7aa50
Change: [Network] Transfer command data as serialized byte stream without fixed structure.
...
The data will be transmitted as the length followed by the serialized data. This allows the command
data to be different for every command type in the future.
2021-12-16 22:28:32 +01:00
rubidium42
fed3e3305f
Codechange: add function to determine whether are string starts or ends with a given other string
2021-06-13 10:26:58 +02:00
rubidium42
b4aedef848
Codechange: add std::string variant of Utf8StringLength
2021-05-29 19:02:18 +02:00
Patric Stout
7713c3e3cc
Codechange: move casting a "const char *" to "char *" to the caller
...
It is not nice to have your definition say you won't change a value
while in fact the whole reason for your existance is to change it.
2021-05-29 16:23:59 +02:00
Patric Stout
ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) ( #9304 )
...
This to be more explicit the function changes the value, and not
returns yes/no.
2021-05-29 11:21:38 +02:00