Commit graph

82 commits

Author SHA1 Message Date
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
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
bruvzg
de4c97758a
Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
bruvzg
f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
Bartłomiej T. Listwon
3f7f780a4c Optimize String concatenation and copy functions 2022-02-24 09:47:15 +01:00
bruvzg
244db37508
Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
Rémi Verschelde
9686d680b7
Merge pull request #57116 from bruvzg/win_net_share 2022-01-28 11:03:23 +01:00
Wilson E. Alvarez
3eb5e0ac50
Rename String::is_subsequence_ofi to String::is_subsequence_ofn 2022-01-26 18:03:56 -05:00
bruvzg
cba8280515 [Windows] Add support for handling network share paths. 2022-01-24 16:22:59 +02:00
Omar Polo
bd448e5535 Rename or refactor macros to avoid leading underscores
These are not used consistently and some can conflict with
system-specific defines.  While here, also delete some unused macros.
2022-01-20 20:29:15 +01:00
Aaron Franke
13939734e0
Replace String::num_real code with a wrapper around String::num 2022-01-15 00:21:49 -06:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Haoyu Qiu
e4e4e475f8 Make --doctool locale aware
* Adds `indent(str)` to `String`:
    * Indent the (multiline) string with the given indentation.
    * This method is added in order to keep the translated XML correctly
      indented.
* Moves the loading of tool/doc translation into
  `editor/editor_translation.{h,cpp}`.
    * This will be used from both `EditorSettings` and the doc tool from
      `main`.
* Makes use of doc translation when generating XML class references, and
  setup the translation locale based on `-l LOCALE` CLI parameter.

The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.
2021-12-16 17:49:22 +08:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Rémi Verschelde
7da392bcc5
Don't return reference on copy assignment operators
We prefer to prevent using chained assignment (`T a = b = c = T();`) as this
can lead to confusing code and subtle bugs.

According to https://en.wikipedia.org/wiki/Assignment_operator_(C%2B%2B), C++
allows any arbitrary return type, so this is standard compliant.

This could be re-assessed if/when we have an actual need for a behavior more
akin to that of the C++ STL, for now this PR simply changes a handful of
cases which were inconsistent with the rest of the codebase (`void` return
type was already the most common case prior to this commit).
2021-11-30 16:26:29 +01:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
Rémi Verschelde
5341e6010e
Allow dehardcoding documentation branch and URL in docs links
This makes it possible to change the branch of the documentation that
URLs are pointing to without having to modify all class reference
files.

In the XML class reference, the `$DOCS_URL` placeholder should be used,
and will be replaced automatically in the editor and when generating
the RST class reference.

The documentation branch string is set in `version.py`.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-11-15 13:02:21 +01:00
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