Commit Graph

116 Commits

Author SHA1 Message Date
bruvzg 88afb1a8ba [String] Fix string conversion for -0.0 float values.
(cherry picked from commit 2b3bbde6da)
2023-09-21 14:57:13 +02:00
MewPurPur a4547db15b Fix erroneous pad_zeros warning
(cherry picked from commit cc5500f7de)
2023-07-10 17:46:09 +02:00
Rémi Verschelde 100082b3ac
Merge pull request #74760 from lassade/unicode-err-uses-replacement-char
Don't append non unicode scalar values on the string, instead use the unicode replacement char
2023-06-22 18:30:04 +02:00
Rémi Verschelde 5ade250c7d
Merge pull request #76735 from AThousandShips/natural_cmp
Add `naturalcasecmp_to` function to `String`
2023-05-09 17:44:37 +02:00
Ninni Pipping 46a7018e3c Add `naturalcasecmp_to` function to `String`
Functions as a complement to `naturalnocasecmp_to`
2023-05-07 10:17:53 +02:00
Clay John 7a13cf9aeb
Merge pull request #75510 from SilicDev/string_erase
Reimplement `String.erase()` as immutable method
2023-05-05 10:03:49 -07:00
Clay John 610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
SilicDev 6fa4f71ca6 Reimplement String.erase 2023-05-04 00:52:35 +02:00
VolTer 6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
Danil Alexeev 36bedd341a
Fix misuses of error macros 2023-04-18 10:20:48 +03:00
Juan Linietsky 223ce4fcb9 Optimize Node::add_child validation
Adding 10k nodes is almost twice as fast.
2023-04-07 13:18:47 +02:00
bendn ca0feabbb0
add `hex_decode()` to `String` 2023-04-05 19:44:00 +07:00
bruvzg d72b563250
Add GDScript `to_wchar_buffer` and `get_string_from_wchar` functions. 2023-03-21 15:39:54 +02:00
Felipe Jorge 999f3e2c13 use the unicode replacement char on error
update tests

also fix utf8 and ascii parse functions to use the replacement char

created a _replacement_char const inside the string
2023-03-12 11:46:56 -03:00
VolTer 57e39d0ce9 Fix String.split() with empty string and delimeter 2023-02-02 01:34:11 +01:00
K. S. Ernest (iFire) Lee 39922d7167 Handle gltf binary
[ Ignore and Warn | Extract Textures (default) | Optimize Loading Embedded as Basisu ]

Enable compressed mip maps from Basis Universal for faster compressions.

Increase the quality of Basis to avoid corruption.

To keep compatibility use the first mip of the previous internal Godot format.

Because texture names may have invalid filename characters, adds String::validate_filename to sanitize filenames for import pipeline use.
2023-01-27 02:02:02 -08:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Haoyu Qiu 207e52c161 Fix String::word_wrap() for long words
- Changes `TextServer.string_get_word_breaks()`
  - Returns pairs of boundary start and end offsets
  - Accepts `chars_per_line` to return line breaks
- Removes `String::word_wrap()`

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-12-16 13:18:57 +08:00
Bastiaan Olij a479f5af22 Improve logic for detecting and tracking extensions 2022-11-24 21:48:16 +11:00
Micky e791f4fce2 Double precision of `String.split_floats` 2022-11-20 12:29:50 +01:00
Rémi Verschelde 1959284769
Merge pull request #68229 from Mickeon/c-escape-hell
Remove "?" from String.c_escape()
2022-11-14 23:24:35 +01:00
Markus Sauermann 3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
gnumaru 75e617c05d fix a buffer overflow due to a misbehaving vcrt snprintf call on String::num, at core/string/ustring.cpp 2022-11-09 10:25:52 -03:00
kobewi 8a47a12207 Add support for empty delimiter in String.split 2022-11-04 15:09:12 +01:00
Micky 521d8a5d24 Remove "?" from String.c_escape() 2022-11-03 19:52:21 +01:00
Gilles Roudière 56fa8f1d58 Fix localize_path with custom protocol identifiers 2022-10-20 14:12:25 +02:00
Aaron Franke c60ac64e8f
Fix big negative numbers printing incorrect decimals in num_real 2022-10-15 17:57:54 -05:00
Gilles Roudière bf1a40c168 Make String.simplify_path keep the protocol identifier for urls 2022-10-13 12:23:49 +02:00
Rémi Verschelde 58eff50bf1 Merge pull request #64268 from timothyqiu/is-finite
Add `is_finite` method for checking built-in types
2022-10-11 09:25:46 +02:00
kobewi 785e5880b3 Fix simplify_path() breaking uid:// 2022-10-09 14:22:13 +02:00
Haoyu Qiu 5da515773d Add `is_finite` method for checking built-in types 2022-10-08 13:25:08 +08:00
Rémi Verschelde cf6978f286 Merge pull request #64833 from MarcusElg/naninfprinting
Improve string formatting (%f and %v) for inf and nan
2022-10-03 09:23:12 +02:00
Rémi Verschelde 0e53dd642c Fix MSVC warning C4706: assignment within conditional expression
Part of #66537.
2022-09-28 16:05:07 +02:00
Danil Alexeev d4555ef5fb
Add `String.to_{camel,pascal,snake}_case` methods 2022-08-30 12:36:24 +03:00
Aaron Franke 10a56981dc
Rename String `plus_file` to `path_join` 2022-08-29 19:38:13 -05:00
Marcus Elg b21460981d Improve string formatting for %f and %v for inf and nan 2022-08-25 07:41:21 +02:00
Rémi Verschelde 08d8f884cd
Merge pull request #63728 from MarcusElg/%v
Add %v for formatting vectors
2022-08-24 00:42:47 +02:00
Marcus Elg dbc165715b Add %v for formatting vectors 2022-08-23 17:26:06 +02:00
VolTer dae64e5361 Improved performance of String repeat method 2022-08-22 22:47:10 +02:00
kleonc 1324ca5eb0 Fix undefined behavior in `String::operator+=(const String &)` 2022-08-18 14:57:24 +02:00
Rémi Verschelde 1418f97c70 File: Re-add support to skip CR (`\r`) in `File::get_as_text`
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.
2022-08-01 00:40:35 +02:00
bruvzg 0c5431644d
Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose. 2022-07-07 11:07:18 +03:00
Haoyu Qiu 6f38c21253 Fix parameter name for String.left and String.right 2022-06-12 16:34:44 +08:00
Haoyu Qiu 83990c2161 Fix `String.uri_encode` on Windows 2022-06-03 13:58:57 +08:00
Hugo Locurcio 7b5bf3af19
Tweak 64-bit integer overflow message to mention that it's a signed type 2022-05-20 14:12:09 +02:00
Haoyu Qiu 3094e739f5 Create onready variables when dropping nodes and holding Ctrl 2022-05-17 11:51:22 +08:00
Hugo Locurcio a581908ea0
Add documentation comments for internationalization C++ macros 2022-05-12 22:50:28 +02:00
Haoyu Qiu ad1a8777bd Fix left aligned integer sign in string formatting 2022-05-01 12:42:48 +08:00
Rémi Verschelde 8dfa12cae7
Merge pull request #59979 from bruvzg/cpp_check2 2022-04-27 10:08:26 +02:00
reduz 8580f377a3 Implement Scene Unique Nodes
Implements https://github.com/godotengine/godot-proposals/issues/4096

* Nodes can be marked unique to the scene in the editor (or via code).
* Unique nodes can be accessed via the **%** prefix at any point in the path. From that point in the path (depending on whether the scene of the path is), the unique node will be fetched.
* Implementation is very optimal, as these nodes are cached.
2022-04-25 12:19:17 +02:00