Commit Graph

171 Commits

Author SHA1 Message Date
884cbb5333 Don't repeat calls to strlen in split, and make splitter_length const in get_slice. 2024-11-28 01:55:48 +01:00
68f638cf02 Use (r)find_char instead of (r)find for single characters 2024-11-17 10:02:18 +01:00
63838c936c Merge pull request #98278 from a-johnston/fuzzy-search-rebase
Add fuzzy string matching to quick open search
2024-11-10 12:12:56 -06:00
363c0b5fec Merge pull request #47502 from KoBeWi/add_0
Always add decimal when converting float to string
2024-10-31 20:14:39 -05:00
98c89f17c4 Add Object support for String.format 2024-10-29 22:27:33 +01:00
3ac043c508 Add fuzzy string matching to quick open search
Co-authored-by: sam <samsface@gmail.com>
2024-10-28 11:24:36 -07:00
5c0f2414cd Always add decimal when printing float 2024-10-23 15:00:21 +02:00
b3b24ded19 Add checks for valid base in String::num_int64, uint64().
- Ensure String::num_int64, uint64 returns an empty string for bases less than 2 or greater than 36.
- Added corresponding test cases to verify the behavior.
- Error messages are printed when invalid bases are encountered. These messages are suppressed in the test output.
2024-10-20 00:22:08 -07:00
6516ca6b11 Parse fragment from URL 2024-09-27 19:42:30 +08:00
a751c05b15 Fix script editor wrongly replaces and quotes non-ASCII letters 2024-09-23 00:05:16 +08:00
8bf4ecc026 Add String.is_valid_unicode_identifier()
- Adds `is_valid_unicode_identifier()`
- Adds `is_valid_ascii_identifier()`
- Deprecates `is_valid_identifier()`
- Renames `validate_identifier()` to `validate_ascii_identifier()`
2024-08-27 11:34:08 +08:00
c7702b350a Merge pull request #92548 from AThousandShips/string_cleaning
[Core] Optimize some `String` methods
2024-08-26 23:28:24 +02:00
4afcbb1c8b Merge pull request #92546 from AThousandShips/faster_replace
[Core] Optimize `String::replace` methods
2024-08-19 12:08:45 +02:00
49e5fbfbd2 Merge pull request #95184 from jsjtxietian/shader-include-relative
Fix `String::simplify_path` handling of relative paths to parent dir (`../`), fixes relative shader includes
2024-08-17 00:46:11 +02:00
803dfcc3cb Merge pull request #95613 from timothyqiu/split-empty
Fix `split_floats` behavior when spaces are used as separators
2024-08-16 14:36:40 +02:00
f01e052162 Merge pull request #95549 from timothyqiu/split-translation-server
Split `TranslationServer` into its own file
2024-08-16 14:36:16 +02:00
f483c3aafa Fix split_floats behavior when spaces are used as separators 2024-08-16 17:30:44 +08:00
70096c0e6a Merge pull request #94558 from stuartcarnie/sgc/sprintf_allocations
Reduce allocations in `String::sprintf`
2024-08-16 10:34:28 +02:00
71ca5aa5ec Merge pull request #92555 from AThousandShips/insert_improve
[Core] Optimize `String::insert`
2024-08-16 10:33:47 +02:00
ee19a092d9 [Core] Optimize some String methods
Avoids unnecessary COW checks by using pointers directly.
2024-08-15 17:17:11 +02:00
e211d08c92 [Core] Optimize String::join
Avoid reallocation by pre-computing size
2024-08-15 16:19:07 +02:00
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
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
9bcda8f94c Prefer family name in fonts' names table 2024-04-06 16:08:59 +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
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
c0aa88ae4f Add Unicode support to String.to_*_case() methods 2024-02-22 13:58:46 +03:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
15369fdb1d Remove unnecessary this-> expressions 2024-01-29 09:59:18 +01: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
a3cb1b096f Add const references detected by clang-tidy 2023-12-16 13:36:44 -05: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
edcad2ea88 Allow auto-generated node names in PopupMenu::add_submenu_item 2023-11-09 17:12:41 +01:00
931928feb9 Optimize String.humanize_size() 2023-11-05 02:42:54 +02:00
dbc49d2a68 Add const references in String class 2023-11-02 13:49:39 -04:00
5cd7ca0ccc Do not replace starting digit with underscore when making identifier 2023-10-04 08:05:04 -05:00