Commit Graph

263 Commits (master)

Author SHA1 Message Date
Pāvels Nadtočajevs a9ef3e5804
Fix duplicate minus in print output.
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2025-12-02 18:58:55 +07:00
Yarvin 364e98afc5 Fix String::rfindn for strings with only one character.
----

Remove optimization – no need to introduce extra complexity for
negligible (if any) gains.
2025-11-22 16:52:55 +07:00
Lukas Tenbrink 43a8009a56 Clean up String::find to remove duplicate code, and speed up comparison with `memcmp` where possible. 2025-11-19 22:39:05 +07:00
Lukas Tenbrink d7f5c13db8 Add `Span` equality (`==` and `!=`) operators.
Exchange duplicate equality iteration implementations across `Vector` and `String` with the `Span` version, for a speed boost.
2025-11-15 14:21:54 +07:00
Thaddeus Crews 20430236e7
Merge pull request #107999 from timothyqiu/translation-cleanup
Clean up editor translation related methods
2025-10-15 16:31:09 +07:00
Lukas Tenbrink 839e0358b3 Assert that `dictionary.h` does not include `String`, and that neither of the fundamental containers include `Object`. 2025-10-06 23:03:27 +07:00
Lukas Tenbrink dc5e615a1d Remove `Array` include from `dictionary.h` and `ustring.h`. 2025-10-06 16:21:36 +07:00
Lukas Tenbrink 712bc99668 Add `STATIC_ASSERT_INCOMPLETE_TYPE` to enforce include minimality.
Add enforcements against `Dictionary` for `ustring.h` and two for `Dictionary` and `String` from `array.h`.
2025-10-01 23:46:35 +07:00
Thaddeus Crews 62933b683e
Merge pull request #105928 from Ivorforce/cowdata-reserve-capacity
Core: Add `reserve` function to `Array`, `Vector`, and `String`
2025-09-30 11:19:13 +07:00
Thaddeus Crews f6fc2f4a08
Core: Remove `skip_cr` argument from `String` 2025-09-28 10:07:24 +07:00
Lukas Tenbrink 1bf821c1e1 Store current capacity in `CowData` buffers, and rewrite most of it.
Add `reserve` to `CowData`, `Vector` and `Array`.

# Conflicts:
#	core/os/memory.h
#	core/templates/cowdata.h
2025-09-25 22:00:17 +07:00
Thaddeus Crews 40bd86819b
Merge pull request #104332 from ColinSORourke/FindSeq
Add 'Find Sequence' to `Span`s, and consolidate negative indexing behavior
2025-09-20 13:41:34 +07:00
Thaddeus Crews 8eeef165d4
Merge pull request #104781 from Ivorforce/string-encode-complete
Expose missing `String` encoding conversion functions
2025-09-19 20:54:26 +07:00
Lukas Tenbrink a916325e6a Use `Span` for `String.sprintf`, to accelerate `vformat` not needing to allocate an `Array`. 2025-09-18 19:29:04 +07:00
Lukas Tenbrink d1fd42bf3c Expose `copy_from_unchecked` as `append_utf32_unchecked` and `String::utf32_unchecked` in `String` for high performance string copies. Expose `append_wstring` and `String::wstring` for platform strings. 2025-09-18 19:26:57 +07:00
Haoyu Qiu 3f03260a21 Cleanup editor translation related methods
- Unify logic for loading editor/property/doc/extractable translations.
- Replace legacy `TranslationServer` methods with translation domains for internal translations.
- Only pre-create editor/property/doc translation domains in editor builds.
- Prevent adding `null` translation.
- Fixes potential loading of duplicated editor translations.
- Add internal `has_translation_for_locale()` instead of calling `get_loaded_translations().has()`.
2025-09-18 20:27:09 +07:00
Colin O'Rourke 03d32c68a9 Added Find Sequence to Spans
Added FindSequence to Span.h

Refactored String find to use Span::Find_Seq in Ustring.cpp
2025-09-16 12:37:07 +07:00
Lukas Tenbrink 0d700e53f3 Check for `NUL` characters in string parsing functions. 2025-09-16 10:55:44 +07:00
Thaddeus Crews 8de08c7c21
Merge pull request #107646 from stuartcarnie/string_append_utf8_bug
Core: Fix invalid resize after appending
2025-06-18 18:14:11 +07:00
Thaddeus Crews d4fa7e15ed
Merge pull request #106919 from kitbdev/fix-codeedit-hover-word-lookup
Fix CodeEdit hover word lookup
2025-06-18 18:13:43 +07:00
Stuart Carnie 4b3800582e Core: Fix invalid resize after appending 2025-06-18 08:57:05 +07:00
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 +07:00
Lukas Tenbrink 70672ef008 Optimize `String::get_data`, `length` and `is_empty` by making better assumptions and inlining. 2025-05-30 09:25:21 +07:00
kit ebf71cd4f3 Fix CodeEdit hover word lookup 2025-05-28 18:35:15 +07:00
Aaron Franke 15de1d6c35
Use Grisu2 algorithm in String::num_scientific to fix serializing 2025-05-22 09:13:16 +07:00
Lukas Tenbrink 26a6d4062d Inline `String::utf8` and `String::utf16` for their simplicity. 2025-05-06 17:20:03 +07:00
aaronp64 a4ba8c37c9 Reduce allocations/copies in String::format
- Updated initial new_string copy to use copy constructor/increase ref count instead of copying to new allocated memory
- Removed Variant copies from Array before assigning to String
- Only convert i to String when needed
2025-05-02 12:32:11 +07:00
Thaddeus Crews 60aae6d856
Merge pull request #86653 from Mickeon/string-format-error
Improve error message for `String.format` when using nested Arrays
2025-04-29 16:05:20 +07:00
Thaddeus Crews 3947cbe3b2
Merge pull request #104386 from Repiteo/core/cpp-math
Core: Replace C math headers with C++ equivalents
2025-04-27 19:21:22 +07:00
Thaddeus Crews 999294d77a
Core: Integrate `CharStringT` 2025-04-27 09:58:39 +07:00
Thaddeus Crews ad40939b6f
Core: Replace C math headers with C++ equivalents
- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
2025-04-16 15:49:02 +07: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 +07:00
A Thousand Ships 889410dcda
Add `String::replace_char(s)` methods for performance and convenience 2025-04-10 13:08:45 +07: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 +07:00
Pāvels Nadtočajevs b106dfd4f9
Base accessibility API. 2025-04-08 20:14:28 +07:00
Pāvels Nadtočajevs 9abe2e5294
Add `uri_file_decode` to handle `+` in file names. 2025-04-07 23:49:17 +07:00
Yufeng Ying 4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +07: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 +07:00
bruvzg 48bfe13e4f
Add methods to decode/encode multibyte encodings. 2025-03-28 17:32:34 +07:00
Rémi Verschelde 10799d0b44
Merge pull request #104389 from Ivorforce/color-string-append
Optimize `Color::to_html` by allocating less.
2025-03-28 14:32:54 +07:00
Lukas Tenbrink ffa6ef220b Use `append_` instead of `parse_` for `String` methods. 2025-03-27 17:51:02 +07:00
Thaddeus Crews 7fed5f29ed
Merge pull request #99826 from kiroxas/improveParseUTF8Performance
Improve `parse_utf8` performance
2025-03-24 10:00:55 +07:00
Lukas Tenbrink 143f8e933e Optimize `Color::to_html` by allocating less. 2025-03-20 13:42:03 +07:00
kobewi 10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +07: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 +07:00
rune-scape 0c7d78f455 StringLikeVariantOrder: Compare in-place 2025-03-18 11:21:30 +07: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 +07: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 +07:00
Lukas Tenbrink 8c14766597 Add missing `String + char *` function, to avoid unnecessary right side allocation to `String`. 2025-03-17 17:31:35 +07:00
Lukas Tenbrink 49e860159a Move `CowData` `find`, `rfind` and `count` to `Span`. 2025-03-16 03:31:11 +07:00