Commit Graph

51 Commits

Author SHA1 Message Date
Rémi Verschelde 2beaae4b6f
String: Remove `erase` method, bindings can't mutate String 2021-11-11 11:23:32 +01:00
Haoyu Qiu 367d75fab0 Add missing characters for property name quoting 2021-11-11 13:18:09 +08:00
Rémi Verschelde 3a6be64c12
clang-format: Various fixes to comments alignment from `clang-format` 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 15:43:36 +02:00
Rémi Verschelde f9be8b8e8e
Merge pull request #54081 from Rubonnek/add_bin_messages_master 2021-10-22 19:31:55 +02:00
Wilson E. Alvarez 5736a0ed3c
Accept capital B in String::bin_to_int prefix 2021-10-21 13:18:49 -04:00
Wilson E. Alvarez 549a48ccc9
Add error messages to String::hex_to_int, and accept capital X in prefix 2021-10-21 12:40:14 -04:00
Aaron Franke 5d03c0e0b6
Fix String::num_real and String test cases when compiling with doubles 2021-09-15 13:41:12 -05:00
Rémi Verschelde 41562b9198
Merge pull request #52049 from theraot/master 2021-09-13 16:49:24 +02:00
Hugo Locurcio fc0bfbb33b
Remove `#ifdefs` for handling compilation with Visual Studio < 2015
Godot 3.3 and later require Visual Studio 2017 to be compiled.
2021-08-31 20:04:17 +02:00
Wilson E. Alvarez d11c1afc04
Rename String::is_rel_path to String::is_relative_path 2021-08-29 20:41:29 -04:00
Theraot ef54d35395 Fix get_base_dir windows top level directory logic
This is a fix for https://github.com/godotengine/godot/issues/52048
2021-08-24 04:16:59 -05:00
Rémi Verschelde b033dff983
String: Remove old NO_USE_STDLIB code path
We're using the standard library in many core classes by now so
this code path no longer makes sense.
2021-08-18 14:38:04 +02:00
Rémi Verschelde 066dbc2f0c
String: Fix default decimals truncation in num and num_real
Fixes undefined behavior, and fixes the logic for negative powers of ten.
Fixes #51764.

Adds tests to validate the changes and prevent regressions.
Adds docs for `String.num`.
2021-08-18 00:48:03 +02:00
Anilforextra c350a33898 Convert ustring macros to inline functions and use them wherever possible.
Add new inline functions to check if a character is lowercase or uppercase.

Remove unused upper case macro.
2021-08-13 10:32:29 +05:45
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Rémi Verschelde e2b79e9591
Merge pull request #49291 from NoFr1ends/fix-49262
String::format leave passed values untouched
2021-07-13 09:33:46 +02:00
Lightning_A b6af2a29eb Rename `is_valid_integer()` to `is_valid_int()`
Method from `String`
2021-06-16 10:32:22 -06:00
Rémi Verschelde badad53438
Merge pull request #49505 from underdoeg/patch-2
fix url parsing with port numbers
2021-06-16 14:20:29 +02:00
Aaron Franke 554c776e08
Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant).

For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
2021-06-11 10:53:20 -04:00
Rémi Verschelde 6b0183ec89
Merge pull request #49279 from Calinou/rename-string-is-abs-path-method
Rename `String.is_abs_path()` to `String.is_absolute_path()`
2021-06-11 15:58:16 +02:00
Philip Whitfield 3d9f29910c
fix url parsing with port numbers
String.get_slice_count is always at least 1 or 2 for bases with a port number.
Before this change the following URL would return ERR_INVALID_PARAMETER ```ws://127.0.0.1:8000/test```
2021-06-11 10:09:05 +02:00
Jonas Bernemann a403efb67c String::format leave passed values untouched
If the passed value or key contains double quotation marks it will no
longer get removed.
2021-06-03 23:07:38 +02:00
Hugo Locurcio 5ea1c75d63
Rename `String.is_abs_path()` to `String.is_absolute_path()`
This is more consistent with `NodePath.is_absolute()`.
2021-06-03 16:00:06 +02:00
Heikki Simojoki 09a905ca80
Increase String::num default decimal precision
Fixes #34541

Renamed MAX_DIGITS to MAX_DECIMALS, since it only changes the
amount of digits after the decimal point.

Increased MAX_DECIMALS to 32, and made String::num use
MAX_DECIMALS consistently. If -1 is passed as
decimal precision to String::num, it now gets changed to
the correct precision based on the number's magnitude,
instead of using printf default(which is 6)

String::num_real also calculates the correct precision now.

Also made the types used in floating-point math more
consistent in a few places.
2021-05-29 11:24:57 -04:00
kobewi ea9660e1cf Fix usage of String.left() 2021-05-21 23:01:44 +02:00
Tomasz Chabora b1859510ab Change behavior of String.right 2021-05-20 23:07:57 +02:00
Fabio Alessandrelli 015fc2ad4f
Merge pull request #48205 from Faless/net/4.x_url_parsing
[Net] Implement String::parse_url for parsing URLs.
2021-05-03 13:55:57 +02:00
bruvzg b6a21f85a7
Fix `url_decode` with mixed percent-encoding/Unicode strings. Treat Unix drive names as UTF-8 encoded. 2021-04-30 21:22:39 +03:00
Rémi Verschelde 8247667a3e
Core: Drop custom `copymem`/`zeromem` defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Fabio Alessandrelli 3bb40669d5 [Net] Implement String::parse_url for parsing URLs.
Splits the URL into (scheme, host, port, path).
Supports both literal IPv4 and IPv6.
Strip credentials when present (e.g. http://user:pass@example.com/).

Use that function in both HTTPRequest and WebSocketClient.
2021-04-26 09:55:24 +02:00
Fabio Alessandrelli 6138396e00
Merge pull request #47512 from DanielKriz/bugfix/uri_encode
fix wrong encoding format in uri_encode
2021-04-10 18:58:40 +02:00
Daniel Kříž 13c999d9d7 fix wrong encoding in uri_encode 2021-04-10 17:54:18 +02:00
Marcel Admiraal 755c70b871 Rename Array.invert() to Array.reverse()
Does the same internally for List and Vector<>, which includes all
PackedArray types.
2021-03-21 10:20:08 +00:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Rémi Verschelde 83b1acdc60
Merge pull request #45545 from abaire/relaxes_gltf_name_sanitization
Relaxes node name sanitization in gltf documents.
2021-03-09 14:54:33 +01:00
abaire 61cc1c8624 Relaxes Node naming constraints in glTF documents to match the Editor. 2021-02-24 08:22:27 -08:00
Henry Conklin c6a911f037 Add support for numeric XML entities to XMLParser
* Add support for decimal numeric entities to String::xml_unescape
* Add more error checks to String::xml_unescape
* Refactor XMLParser to use String::xml_unescape instead of an internal
implementation
2021-02-14 11:00:25 -06:00
kleonc ad0943e3d3 Make String::ends_with don't use String::rfind 2021-02-09 00:31:28 +01:00
Aaron Franke e829b7aee4
Unify URI encoding/decoding and add to C#
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-28 07:45:01 -05:00
Aaron Franke a3e3bf8227
Make hex_to_int and bin_to_int handle the prefix automatically
Also add BinToInt to C#
2021-01-28 07:43:53 -05:00
Rémi Verschelde 976e768e71
Merge pull request #45489 from aaronfranke/core
Type consistencies in core
2021-01-27 21:16:20 +01:00
Aaron Franke 1be0d6b30e
Type consistencies in core 2021-01-26 13:04:22 -05:00
Yuri Roubinsky 38a5d22079 Renamed String.ord_at to unicode_at 2021-01-26 20:36:12 +03:00
Vedat Günel 1d0437c95b Fix String.ends_with() for empty string arguments 2021-01-19 15:33:41 +03:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Fredia Huya-Kouadio 8edacea04a Fix the `String::get_base_dir()` logic to properly check for top level directories on Windows. 2020-12-23 00:48:18 -08:00
bruvzg 493da99269
[Complex Text Layouts] Implement TextServer interface. Implement Fallback TextServer. 2020-11-26 13:55:26 +02:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00