125 Commits

Author SHA1 Message Date
Lukas Tenbrink
b13a0e1834 Rename String::resize to resize_uninitialized, to better communicate to callers that new characters must be initialized. 2025-06-11 18:13:02 +02:00
Lukas Tenbrink
70672ef008 Optimize String::get_data, length and is_empty by making better assumptions and inlining. 2025-05-30 09:25:21 +02:00
Thaddeus Crews
8bcec7afa9
Merge pull request #106730 from Ivorforce/simplify-memnew-arr-placement
Simplify `Memory::memnew_arr_placement` to always initialize memory
2025-05-26 11:24:43 -05:00
Yufeng Ying
8773f95e40 Optimize and simplify sarray. 2025-05-23 23:47:57 +08:00
Lukas Tenbrink
4371aa864d Simplify Memory::memnew_arr_placement to always initialize memory, to force callers to make the decision of whether to initialize. 2025-05-22 22:25:12 +02:00
Aaron Franke
15de1d6c35
Use Grisu2 algorithm in String::num_scientific to fix serializing 2025-05-22 09:13:16 -07:00
Thaddeus Crews
090d244b16
Merge pull request #101356 from Ivorforce/inline-utf-creation-functions
Inline `String::utf8` and `String::utf16` for their simplicity.
2025-05-07 12:48:32 -05:00
Thaddeus Crews
051712dfb8
Merge pull request #103264 from mhilbrunner/docs-path-join
Rename "file" param for str.path_join() to "path"
2025-05-07 12:48:29 -05:00
Thaddeus Crews
579feb387c
Core: Add [[nodiscard]] to string-like classes 2025-05-06 12:23:41 -05:00
Lukas Tenbrink
26a6d4062d Inline String::utf8 and String::utf16 for their simplicity. 2025-05-06 17:20:03 +02:00
Lukas Tenbrink
ec32dae1da Rename _strlen_clipped to strnlen (and use the system equivalent for char * inputs).
Add `strnlen` for `char16_t *` and `wchar_t *`.
2025-05-06 15:17:07 +02:00
Thaddeus Crews
999294d77a
Core: Integrate CharStringT 2025-04-27 09:58:39 -05:00
Lukas Tenbrink
b711d72e8f Remove unnecessary friend class declarations of CowData.
Use default implementations for various containers.
2025-04-11 18:26:08 +02:00
Priahoud
bf963e767e Add Options, Functions and Settings to convert Node-Names and Strings to kebab-case
- refactored and renamed String::_camelcase_to_underscore to String:_separate_compound_words
- refactored String::to_snake_case to work with the refactored String::_separate_compound_words
- created char_utils::is_hyphen to catch all hyphen variants in kebab-case conversion
- created String::to_kebab_case using the new String::_separate_compound_words
- created corresponding Documentation in String and StringName
- simplified both switch statements in EditorNode and ProjectDialog
- added new kebab-casing Option for Node Names in ProjectSettings
- added missing camelCase Options to Scene- and Node-Names in ProjectSettings
- simplified Mono RuntimeInterop Functions
- hooked up the ConnectionsDialog
- created additional Unit Tests
2025-04-10 21:22:21 +02:00
A Thousand Ships
889410dcda
Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
Thaddeus Crews
7a6c3b309f
Merge pull request #105130 from bruvzg/uri_fix_plus
Add uri_file_decode to handle + in file names.
2025-04-09 18:11:56 -05:00
Pāvels Nadtočajevs
b106dfd4f9
Base accessibility API. 2025-04-08 20:14:28 +03:00
Pāvels Nadtočajevs
9abe2e5294
Add uri_file_decode to handle + in file names. 2025-04-07 23:49:17 +03:00
Thaddeus Crews
780cf03051
Merge pull request #104556 from Ivorforce/string-extend-instead-of-parse
Use `append_` instead of `parse_` for `String` methods.
2025-03-29 10:16:33 -05:00
bruvzg
48bfe13e4f
Add methods to decode/encode multibyte encodings. 2025-03-28 17:32:34 +02:00
Lukas Tenbrink
ffa6ef220b Use append_ instead of parse_ for String methods. 2025-03-27 17:51:02 +01:00
Thaddeus Crews
f09ee0171a
Style: Begin integrating simple .clangd fixes 2025-03-22 13:24:35 -05: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
8c14766597 Add missing String + char * function, to avoid unnecessary right side allocation to String. 2025-03-17 17:31:35 +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
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
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
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
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
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
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
Max Hilbrunner
3275116304 Rename "file" param for str.path_join() to "path" 2025-02-25 15:58:33 +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
2aeca3e885 Optimize String::chr to avoid calling strlen. Use String::chr instead of String(&chr, 1) where appropriate. 2025-01-10 18:06:46 +01:00
Thaddeus Crews
416a86f47c
Merge pull request #100434 from Ivorforce/string-copy-from-rename
Rename `String::copy_from` functions to their respective encodings (`parse_latin1`, `parse_wstring`, `parse_utf32`).
2024-12-19 19:59:57 -06:00
Yufeng Ying
be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +08:00
Lukas Tenbrink
df3e9291c6 Rename String::copy_from functions to their respective encodings (parse_latin1, parse_wstring, parse_utf32). 2024-12-15 21:46:50 +01:00
Lukas Tenbrink
57073ba14e Add move constructor and move assignment to CowData, String, Char16String, CharString and Vector. 2024-12-11 15:52:15 +01:00
Lukas Tenbrink
a3f48f7047 Optimize String construction from statically known strings allowing strlen to be evaluated at compile time, where possible. 2024-12-09 21:47:28 +01:00
Lukas Tenbrink
b5c31ebb41 Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +01:00