Commit graph

430 commits

Author SHA1 Message Date
kobewi
10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +01:00
Rémi Verschelde
64bd03269f
Merge pull request #104286 from Ivorforce/localvector-find
Harmonize `String`, `Vector` and `LocalVector` `find` and `rfind`.
2025-03-19 12:27:27 +01:00
Rémi Verschelde
2fa721b1bc
Merge pull request #104127 from Ivorforce/360-noclip
Remove `String` clipping constructors.
2025-03-19 12:27:10 +01:00
Thaddeus Crews
fdbf6ecc9f
Merge pull request #98408 from rune-scape/stringlikevariantorder-in-place
StringLikeVariantOrder: Compare in-place
2025-03-18 14:42:58 -05:00
rune-scape
0c7d78f455 StringLikeVariantOrder: Compare in-place 2025-03-18 11:21:30 -07:00
Yyf2333
b28d6d1fa3 Don't inline certain functions for smaller binary size.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>
2025-03-18 21:40:25 +08:00
Lukas Tenbrink
fde71e0382 Harmonize String, Vector and LocalVector find and rfind.
Use `Span::find` for `LocalVector::find`, accepting negative `p_from`.
Return `-1` for invalid `p_from` values in `rfind`.
Accept negative values for `p_from` in `find`, starting from the back.
2025-03-18 12:37:36 +01:00
Thaddeus Crews
bb60b05ca4
Merge pull request #104182 from Ivorforce/small-little-string-function
Add missing `String + char *` function, to avoid unnecessary right side allocation to `String`.
2025-03-17 16:03:25 -05:00
Thaddeus Crews
4320800621
Core: Expand is_zero_constructible coverage 2025-03-17 11:45:26 -05:00
Lukas Tenbrink
8c14766597 Add missing String + char * function, to avoid unnecessary right side allocation to String. 2025-03-17 17:31:35 +01:00
Lukas Tenbrink
49e860159a Move CowData find, rfind and count to Span. 2025-03-16 03:31:11 +01:00
Lukas Tenbrink
a23f630781 Remove String clipping constructors.
Callers should instead call constructors with explicit encoding names, with known length `Span`.
2025-03-15 12:34:44 +01:00
Lukas Tenbrink
626ff950fb Deduplicate string::parse_utf32(char32_t) in favor of just using the Span based function. 2025-03-13 15:11:55 +01:00
Thaddeus Crews
c1b7865ae9
Merge pull request #103557 from aaronfranke/godot-version-defines
Rename version defines to `GODOT_VERSION_*` to match GDExtension godot-cpp
2025-03-13 08:57:42 -05:00
Thaddeus Crews
22a7079afd
Merge pull request #104047 from YYF233333/dict_iter
Add const iteration support to `Dictionary`
2025-03-13 08:57:23 -05:00
Thaddeus Crews
e97bb76142
Merge pull request #100314 from Ivorforce/use-string-chr
Optimize `String::chr` to avoid calling `strlen`. Use `String::chr` instead of `String(&chr, 1)` where appropriate.
2025-03-13 08:57:20 -05:00
Aaron Franke
97ee05e9b7
Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp 2025-03-12 11:11:38 -07:00
Yufeng Ying
bebe037abf Add ConstIterator to Dictionary. 2025-03-13 01:28:46 +08:00
Thaddeus Crews
74907876d3
Merge pull request #103759 from Ivorforce/zero-constructible
Optimize `Array.resize` by using `memset` (through new `is_zero_constructible` type trait)
2025-03-12 10:31:55 -05:00
Thaddeus Crews
19057494db
Merge pull request #100238 from Ivorforce/copy-from-unchecked-unchecked
Optimize String `copy_from_unchecked` to actually not check the string.
2025-03-12 10:31:54 -05:00
Lukas Tenbrink
75bc471965 Add is_zero_constructible to denote if a type can be semi-trivially constructed with all 0 bytes.
Optimize `CowData` and `LocalVector` resize for zero constructible types.
Mark several compatible types as `is_zero_constructible`.
2025-03-12 09:49:24 +01:00
Thaddeus Crews
754e3b3f9a
Merge pull request #103825 from JulianHeuser/region_highlight_crash_fix
Fix crash related to #region/#endregion caused by trailing spaces
2025-03-11 19:54:46 -05:00
Lukas Tenbrink
541e721cac Change String copy_from_unchecked to actually not check the string, leading to performance optimizations across substr, count, and StringBuilder. 2025-03-11 13:47:47 +01:00
Julian
659d1b5d0c Fix crash caused by trailing spaces 2025-03-11 00:06:08 -04:00
Lukas Tenbrink
1818453faa Make use of latin1 encoding explicit in gdextension_interface.cpp. 2025-03-10 19:33:56 +01:00
Thaddeus Crews
8d1c1c5867
Merge pull request #92476 from AThousandShips/string_remove_char
Add `String::remove_char(s)` methods for performance and convenience
2025-03-10 10:01:04 -05:00
A Thousand Ships
331a43a9d8
Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
Lukas Tenbrink
605b62cd29 Add Span struct (replacing StrRange). Spans represent read-only access to a contiguous array, resembling std::span. 2025-03-09 18:19:51 +01:00
Thaddeus Crews
cae3d722a3
Merge pull request #99321 from AThousandShips/use_get_slicec
Use `get_slicec` instead of `get_slice` for single character splitters
2025-03-09 09:05:29 -05:00
Thaddeus Crews
3a0b8da168
Merge pull request #101304 from Ivorforce/string-parse-ascii
Add `String::ascii` creator functions, to parse a char buffer as ASCII.
2025-03-09 09:05:28 -05:00
A Thousand Ships
466590d0ec
Use get_slicec instead of get_slice for single character splitters 2025-03-08 20:36:37 +01:00
Thaddeus Crews
324512e11c
Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Lukas Tenbrink
b6cfcdeab5 Add String::ascii creator functions, to parse a char buffer as ASCII.
The function will log errors if any characters above value 127 are found.
2025-03-08 00:01:27 +01:00
Thaddeus Crews
3c43508ed7
Merge pull request #102427 from AThousandShips/fix_substr
Clean up some uses of `String::substr`
2025-03-07 15:12:33 -06:00
Thaddeus Crews
bb8ef4e052
Merge pull request #101878 from Chubercik/automate_char_range
Core: Automate generation of the `char_range.inc` file
2025-03-07 15:12:31 -06:00
Thaddeus Crews
c937b6d180
Merge pull request #102419 from Ivorforce/std-size
Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase.
2025-03-07 15:12:25 -06:00
Thaddeus Crews
d9125ebebe
Merge pull request #101293 from Ivorforce/string-to-pointer-conversion
Remove implicit conversions from `String`, `Char16String` and `CharString` to data pointers.
2025-03-07 15:12:12 -06:00
A Thousand Ships
5113022dfe
Clean up some uses of String::substr
Cases where the end position is either equvalent to the default or past
the end of the string.
2025-03-07 14:50:38 +01:00
Thaddeus Crews
c838fe27cd
Merge pull request #99059 from MarcusPaulsson/issue_branch_2
Fix String::is_valid_hex_number
2025-03-06 16:36:17 -06:00
Pāvels Nadtočajevs
9ae5f09c20 Fix editor UI showing empty string for unknown locales. 2025-02-13 08:07:26 +02:00
Pāvels Nadtočajevs
e9fd760357 Use fallback locale from project settings instead of hardcoded "en" for TextServer. 2025-02-10 08:55:50 +02:00
Lukas Tenbrink
e34f1f504c Use std::size instead of sizeof(a) / sizeof(a[0]) pattern throughout the codebase. 2025-02-07 14:57:48 +01:00
bruvzg
a6ff518763 Add ZWSP to the list of space characters. 2025-02-06 10:31:32 +02:00
Pāvels Nadtočajevs
b50d9742c2 Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation. 2025-02-05 18:39:40 +02:00
Jakub Marcowski
104857687c
Update ucaps.h to contain proper case matchings 2025-01-29 12:37:33 +01:00
Jakub Marcowski
10485764a7
Automate generation of the char_range.inc file
Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>
2025-01-23 19:25:59 +01:00
Lukas Tenbrink
512abc38b2 Remove implicit conversions from String, Char16String and CharString to data pointers. Make conversions to StrRange implicit to aid transition. 2025-01-17 17:31:58 +01:00
Lukas Tenbrink
dbf189e28f Lock the StringName::mutex after hashing the string, to spend less time hoarding it unnecessarily. 2025-01-15 21:20:48 +01:00
Lukas Tenbrink
2e600789dd Optimize String ==, ends_with and begins_with by using memcmp. 2025-01-13 15:23:08 +01:00
Rémi Verschelde
ad74e337b9 Merge pull request #100954 from Bromeon/bugfix/nodepath-slice
Fix `NodePath::slice()` incorrect behavior for subname indexing
2025-01-10 23:05:56 +01:00