Commit Graph

279 Commits

Author SHA1 Message Date
A Thousand Ships 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
Wilson E. Alvarez 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
Rémi Verschelde 25fe3d4b46
Merge pull request #81639 from MJacred/is_letter
Add `is_valid_letter()` to `TextServer`
2024-05-03 01:21:34 +02:00
MJacred 717513a62d Add is_valid_letter() to TextServer 2024-05-02 21:32:20 +02:00
Aaron Franke b1f5e9fe3a
Rename internal is_ascii_char to is_ascii_alphabet_char 2024-04-20 02:36:41 -07:00
Haoyu Qiu 9bcda8f94c Prefer family name in fonts' names table 2024-04-06 16:08:59 +08:00
Haoyu Qiu 479b7afa8e Add context support for editor property name i18n 2024-03-31 18:40:14 +08:00
A Thousand Ships bb6305d1c4
[Core] Fix incorrect file sort method 2024-03-24 17:54:57 +01:00
Rémi Verschelde 8f9136963d
Merge pull request #89671 from alesliehughes/string_underrun
Stop possible underrun when processing a string
2024-03-24 01:21:12 +01:00
A Thousand Ships 2cbf469912
Fix sorting of files/dirs in dialogs
Sorts leading `_` before other characters except `.`.
2024-03-20 13:45:47 +01:00
Alistair Leslie-Hughes 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
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
Mika Viskari 3026b566b0 Fix String::begins_with when both strings are empty 2024-03-05 20:46:10 +02:00
Rémi Verschelde 0a089e284b
Merge pull request #87191 from Mickeon/autocompletion-TranslationServer
Add autocompletion for TranslationServer
2024-03-01 14:56:18 +01:00
Micky ffd498c57d Add autocompletion for TranslationServer 2024-02-29 20:43:19 +01:00
Rémi Verschelde 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
Rémi Verschelde 1cc9190c70
Merge pull request #81822 from nlupugla/nodepath-slice
Add `NodePath::slice` method
2024-02-29 13:53:34 +01:00
Michael Alexsander d70c45b5c8
Add option to add built-in strings in the POT generation 2024-02-28 11:34:26 -03:00
Robert Yevdokimov 13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
Rémi Verschelde 3ce9ae71fc
Merge pull request #84906 from /fix-some-defvals 2024-02-23 11:29:22 +01:00
Raul Santos 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
Danil Alexeev c0aa88ae4f
Add Unicode support to `String.to_*_case()` methods 2024-02-22 13:58:46 +03:00
Rémi Verschelde 0fb7e3fc57
Merge pull request #88339 from Rubonnek/remove-hashunion
Remove `_HashUnion` from `StringName`
2024-02-15 15:45:19 +01:00
Wilson E. Alvarez d2003d2025
Remove _HashUnion from StringName 2024-02-14 15:38:57 -05:00
Muller-Castro a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Bartłomiej T. Listwon 5ee4b49e42 Link xid_start and xid_continue externally to prevent data duplication in binary 2024-02-11 12:54:53 +01:00
A Thousand Ships 15369fdb1d
Remove unnecessary `this->` expressions 2024-01-29 09:59:18 +01:00
bruvzg e7bdb60e56
[Pseudolocalization] Prevent out of bounds reads. 2024-01-05 14:10:26 +02:00
Rémi Verschelde 5fd5176a79
Merge pull request #84462 from MewPurPur/optimize-humanizesize
Optimize `String.humanize_size()`
2024-01-04 14:25:40 +01:00
Rémi Verschelde 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
Rémi Verschelde b66d16fcc9
Merge pull request #84375 from Rubonnek/use-const-reference
Add const references in `String` class
2024-01-04 14:25:27 +01:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
nlupugla cd221c1816 Added NodePath::slice method. 2023-12-13 13:30:28 -05:00
Rémi Verschelde 41365c6c8b
Merge pull request #70315 from RandomShaper/d3d12_mesa
Direct3D 12 Rendering Driver (Mesa NIR approach)
2023-12-12 21:58:57 +01:00
bruvzg 829349d2ca
Do not reload resources and send notification if locale is not changed. 2023-12-05 16:17:22 +02:00
Pedro J. Estébanez 208c1020f5 Add 'u' format modifier for unsigned int/hex 2023-12-01 16:42:26 +01:00
bruvzg ec052cd38a
Add unsigned char cast ifdef. 2023-11-29 11:59:18 +02:00
bruvzg 8b2260544a
Fix remapped font reloading on locale change. 2023-11-13 21:25:41 +02:00
Yuri Sizov edcad2ea88 Allow auto-generated node names in `PopupMenu::add_submenu_item` 2023-11-09 17:12:41 +01:00
bruvzg f3d4f5a77e
[X11] Add fallback from desktop GL to GLES, suppress PRIME detector error spam. 2023-11-06 12:40:44 +02:00
MewPurPur 931928feb9 Optimize String.humanize_size() 2023-11-05 02:42:54 +02:00
Wilson E. Alvarez dbc49d2a68
Add const references in String class 2023-11-02 13:49:39 -04:00
Yuri Sizov 4952d37f4b Fix StringName leaks in VariantParser 2023-10-19 17:13:15 +02:00
Alfonso J. Ramos 5cd7ca0ccc Do not replace starting digit with underscore when making identifier 2023-10-04 08:05:04 -05:00
Jan Haller 43be9fa0c8 Fix platform-dependent hashing for char* and wchar_t*
Since char/wchar_t can be either signed or unsigned, its conversion to uint32_t leads to different values depending on platform.
In particular, the same string represented as char* (Latin-1; StringName direct construction) or uint32_t (UTF-8; constructed
via String) previously resulted in different hashes.
2023-09-24 20:57:57 +02:00
A Thousand Ships 893f889d74 [Core] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-11 19:45:49 +02:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
bruvzg 2b3bbde6da
[String] Fix string conversion for -0.0 float values. 2023-09-05 11:32:55 +03:00
MewPurPur c9287e5224 Optimize String.left() and String.right() 2023-08-20 20:01:06 +03:00
Rémi Verschelde 20e24bd2bb
Merge pull request #78529 from Chaosus/string_reverse
Add `String.reverse` method
2023-08-16 16:53:40 +02:00