Commit Graph

491 Commits

Author SHA1 Message Date
746c6b87eb [Core] Optimize String::insert 2024-08-15 16:18:47 +02:00
cbaec62b03 [Core] Optimize String::replace methods
Performs a single allocation, only when any instances are found, and
avoids concatenations and other unnecessary conversions.
2024-08-15 16:15:58 +02:00
7343dc3a5d Split TranslationServer into its own file 2024-08-15 15:00:47 +08:00
6cf9af2817 Fix error when use relative #include in .gdshader / .gdshaderinc file 2024-08-08 11:59:14 +08:00
67eb6bed2b use operator += (char32_t)
This prevents an allocation of a new string for every character.

Additionally, use some static constants for padding and sign characters
2024-07-25 09:17:58 +10:00
723878bbab StringName: Use inline static field definitions
Before this change StringName used regular static field
definitions for its mutex, _table, configured and debug_stringname
fields.

Since in the general case the ordering of the static variable and field
initialization and destruction is undefined, it was possible that
the destruction of StringName's static fields happened prior to
the destruction of statically allocated StringName instances.

By changing the static field definitions to inline in string_name.h,
the C++17 standard guarantees the correct initialization and destruction
ordering.
2024-07-24 02:40:36 +02:00
f11e8d033d Remove editor pseudolocalization debug feature
We've seen multiple users enable it by mistake and get utterly confused,
reporting as a bug that the interface text is garbled.

On the other hand we haven't really seen much use of the feature by editor
UI developers, so we can likely simply remove it.

If there's a need eventually, we can re-add it as a command line option
(which is also better than an editor setting as one would typically want
to toggle it during development).
2024-06-24 17:08:26 +02:00
dd883bebd4 Improve PR plural translation rules handling. 2024-06-18 19:04:00 +03:00
12571a1e95 Match the coding style for concatenating String 2024-06-09 18:35:23 +09:00
a9a1d0a162 Merge pull request #91619 from AThousandShips/find_improve
Replace `find` with `contains/has` where applicable
2024-05-08 14:35:44 +02:00
b4c6cc7d82 [Core] Add case-insensitive String::containsn 2024-05-08 12:48:01 +02:00
a0dbdcc3ab Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
d4154dbc55 Add const char * overloads to String class
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-05-07 10:53:00 -04:00
25fe3d4b46 Merge pull request #81639 from MJacred/is_letter
Add `is_valid_letter()` to `TextServer`
2024-05-03 01:21:34 +02:00
717513a62d Add is_valid_letter() to TextServer 2024-05-02 21:32:20 +02:00
b1f5e9fe3a Rename internal is_ascii_char to is_ascii_alphabet_char 2024-04-20 02:36:41 -07:00
9bcda8f94c Prefer family name in fonts' names table 2024-04-06 16:08:59 +08:00
479b7afa8e Add context support for editor property name i18n 2024-03-31 18:40:14 +08:00
bb6305d1c4 [Core] Fix incorrect file sort method 2024-03-24 17:54:57 +01:00
8f9136963d Merge pull request #89671 from alesliehughes/string_underrun
Stop possible underrun when processing a string
2024-03-24 01:21:12 +01:00
2cbf469912 Fix sorting of files/dirs in dialogs
Sorts leading `_` before other characters except `.`.
2024-03-20 13:45:47 +01:00
87fe71f52f Stop possible underrun when processing a string
Calling String::utf8("Unicode String", -1) assumes that the string will be NULL terminated.
However, the length parameter is always used to find the end of the string.  So there is the
chance the character before th start of the string is read.

Making the pointer NULL in the case where it's out of range, still allows the following
to work as expected
while (ptrtmp != ptrtmp_limit && *ptrtmp)
....
2024-03-19 20:17:11 +11:00
9903e6779b Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
3026b566b0 Fix String::begins_with when both strings are empty 2024-03-05 20:46:10 +02:00
0a089e284b Merge pull request #87191 from Mickeon/autocompletion-TranslationServer
Add autocompletion for TranslationServer
2024-03-01 14:56:18 +01:00
ffd498c57d Add autocompletion for TranslationServer 2024-02-29 20:43:19 +01:00
846428e0c6 Merge pull request #86222 from YeldhamDev/give_me_those_strings_baby
Add option to add built-in strings in the POT generation
2024-02-29 13:53:38 +01:00
1cc9190c70 Merge pull request #81822 from nlupugla/nodepath-slice
Add `NodePath::slice` method
2024-02-29 13:53:34 +01:00
d70c45b5c8 Add option to add built-in strings in the POT generation 2024-02-28 11:34:26 -03:00
13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
3ce9ae71fc Merge pull request #84906 from /fix-some-defvals 2024-02-23 11:29:22 +01:00
5ba92e5a57 Fix some DEFVALs to use the right type
- Use `StringName()` in DEFVAL for StringNames.
- Use `Variant()` in DEFVAL for Variants.
2024-02-23 01:50:18 +01:00
c0aa88ae4f Add Unicode support to String.to_*_case() methods 2024-02-22 13:58:46 +03:00
0fb7e3fc57 Merge pull request #88339 from Rubonnek/remove-hashunion
Remove `_HashUnion` from `StringName`
2024-02-15 15:45:19 +01:00
d2003d2025 Remove _HashUnion from StringName 2024-02-14 15:38:57 -05:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
5ee4b49e42 Link xid_start and xid_continue externally to prevent data duplication in binary 2024-02-11 12:54:53 +01:00
15369fdb1d Remove unnecessary this-> expressions 2024-01-29 09:59:18 +01:00
e7bdb60e56 [Pseudolocalization] Prevent out of bounds reads. 2024-01-05 14:10:26 +02:00
5fd5176a79 Merge pull request #84462 from MewPurPur/optimize-humanizesize
Optimize `String.humanize_size()`
2024-01-04 14:25:40 +01:00
6c390b620d Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
b66d16fcc9 Merge pull request #84375 from Rubonnek/use-const-reference
Add const references in `String` class
2024-01-04 14:25:27 +01:00
3b2d4ac156 Improve error message for String.format when using nested Arrays 2023-12-30 20:32:01 +01:00
a3cb1b096f Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
cd221c1816 Added NodePath::slice method. 2023-12-13 13:30:28 -05:00
41365c6c8b Merge pull request #70315 from RandomShaper/d3d12_mesa
Direct3D 12 Rendering Driver (Mesa NIR approach)
2023-12-12 21:58:57 +01:00
829349d2ca Do not reload resources and send notification if locale is not changed. 2023-12-05 16:17:22 +02:00
208c1020f5 Add 'u' format modifier for unsigned int/hex 2023-12-01 16:42:26 +01:00
ec052cd38a Add unsigned char cast ifdef. 2023-11-29 11:59:18 +02:00
8b2260544a Fix remapped font reloading on locale change. 2023-11-13 21:25:41 +02:00