Commit Graph

313 Commits

Author SHA1 Message Date
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 8950943356 Optimize Object::get_class_name
* Run the static function once per class instead of one per instance.
* Saves some memory in Object derived classes.
2023-04-08 19:25:50 +02: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
bruvzg 82d7923c65
Improve layout direction/locale automatic selection. 2023-02-22 08:37:14 +02:00
Haoyu Qiu 52b4014362 Don't warn when using TTRN() in a language without plurals 2023-02-11 13:21:57 +08:00
Rémi Verschelde ab4a7b2b77
Merge pull request #72547 from MewPurPur/string-split-fix
Fix String.split() with empty string and delimeter
2023-02-09 16:12:57 +01:00
Haoyu Qiu 5d7e003b29
Prepare for moving editor and classref translations to godot-editor-l10n repo
- Separate editor interface and property translations.
- Add property translation in TranslationServer.
- The split and merge of the POT/PO/Makefiles and extract scripts is done
  directly in godot-editor-l10n, the files will be removed in the next commit.
- Remove the hardcoded "to_include" lists from the SCsub, we'll only commit the
  files which are ready to inclue.
2023-02-07 14:20:40 +01:00
Lyuma 82c52eab6c StringName: fix returning dangling data from char constructor.
Fixes a copy paste mistake in the `StringName(const char *,bool)` constructor,
to match the same form as the other two constrcutors.
This fixes a case where this constructor can return a dangling pointer and cause use-after-free.
2023-02-06 07:16:55 -08:00
VolTer 57e39d0ce9 Fix String.split() with empty string and delimeter 2023-02-02 01:34:11 +01:00
Aaron Franke 0fcdf48f83
Remove unused `has_slashes` from NodePath 2023-02-01 11:32:39 -06: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 163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01: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
Yuri Rubinsky 522d4243bf Add missing != operator to `StringName` 2022-12-20 17:25:54 +03: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
kobewi 7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01: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
Rémi Verschelde 5b3a03bf5c
Merge pull request #68448 from bruvzg/font_imp_tr
[Font] Add an import option to pre-render all glyphs required for the translation.
2022-11-14 11:12:01 +01:00
bruvzg 35528b800c
[Font] Add an import option to pre-render all glyphs required for the translation. 2022-11-10 10:43:15 +02: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
Rémi Verschelde 0e9878b12a
Merge pull request #67931 from bruvzg/locale_no_def
Do not auto add default script and country codes to the locale.
2022-10-31 14:30:18 +01:00
Rémi Verschelde 5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
bruvzg ec3c4fcba9
Do not auto add default script and country codes to the locale. 2022-10-27 09:31:05 +03:00
Gilles Roudière 56fa8f1d58 Fix localize_path with custom protocol identifiers 2022-10-20 14:12:25 +02:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +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
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03: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
Rémi Verschelde 49fcf4ffad Style: Cleanup header guards for consistency
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
bruvzg ec8084d87f
HarfBuzz: Update to version 5.2.0, add new Unicode 15 blocks and scripts. 2022-09-17 23:19:11 +03:00
Rémi Verschelde 10bd79cc6a Merge pull request #64714 from Chaosus/string_remove_erase 2022-09-01 22:57:22 +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
kobewi f7f4873ed0 Replace Array return types with TypedArray 3 2022-08-24 12:53:36 +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
Yuri Rubinsky 772b0d2818 Remove `String::erase` method declaration 2022-08-22 10:30:08 +03:00
kleonc 1324ca5eb0 Fix undefined behavior in `String::operator+=(const String &)` 2022-08-18 14:57:24 +02:00
Yuri Sizov 1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
Rémi Verschelde 33258d850c
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
2022-08-02 15:54:18 +02:00
bruvzg 5aa48b6ae5
[TextServer] Implement ICU/UAX 31 based `is_valid_identifier` function. 2022-08-02 08:30:20 +03: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
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +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
lawnjelly b221eab426 Variant memory pools
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
2022-07-04 12:01:46 +01:00
Silc Renew dc43cfc830 implement bone renamer in importer 2022-07-01 03:55:28 +09:00
Voylin c6291bcd8a Adding print_rich for printing with BBCode 2022-06-29 00:41:29 +09: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
reduz 45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02: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
Aaron Record 900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Haoyu Qiu fc3b845c07 Add dedicated macros for property name extraction
* Replace case-by-case extraction with PNAME & GNAME
* Fix group handling when group hint begins with property name
* Exclude properties that are PROPERTY_USAGE_NO_EDITOR
* Extract missing ADD_ARRAY*, ADD_SUBGROUP* macros
2022-05-19 14:08:47 +08:00
Haoyu Qiu 3094e739f5 Create onready variables when dropping nodes and holding Ctrl 2022-05-17 11:51:22 +08:00
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Hugo Locurcio a581908ea0
Add documentation comments for internationalization C++ macros 2022-05-12 22:50:28 +02:00
reduz 8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
Rémi Verschelde c273ddc3ee Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init`
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +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
Rémi Verschelde df51e5fab0
Merge pull request #60046 from Zylann/print_line_function 2022-04-11 17:51:10 +02:00
bruvzg 9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
Marc Gilleron cc29d39800 Changed print_line macro to a function 2022-04-09 00:45:34 +01:00
bruvzg f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Rémi Verschelde 7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
bruvzg f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
Hugo Locurcio 38995961df
Improve `--debug-stringnames` to be more useful
- Print all StringNames, not just the top 100.
- Print statistics at the end of the list of StringNames,
  with unreferenced and rarely referenced StringNames.
- List the CLI argument in `--help` and shell completion.
2022-03-15 18:54:51 +01:00
Bartłomiej T. Listwon 3f7f780a4c Optimize String concatenation and copy functions 2022-02-24 09:47:15 +01:00
bruvzg 759ca45820
[Editor] Fix "en" editor translation detection. 2022-02-18 22:15:02 +02:00
Hendrik Brucker 77fb65debf Use EditorFileDialog instead of FileDialog in the project manager 2022-02-12 12:06:51 +01:00
Rémi Verschelde 1bdb82c64e
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.
2022-02-10 12:30:19 +01:00
Rémi Verschelde 13d4cbb87c
Merge pull request #57788 from reduz/describe-sname-usage 2022-02-08 11:13:38 +01:00
reduz 38232c70db Clarify SNAME usage
* Explain where it should be used, with examples.
* Clarify that it should _not_ be used everywhere, only where needed.
* Supersedes #57720

This PR is the result of the discussion that happened in a contractor meeting, and it attempts to clarify the intended use for this macro for other contributors.
As a personal note, It is my view that other approaches to using SNAME (like having a global or per class table of string names) are mere overengineering without any real benefit (performance remains the same, and usage of stringnames becomes more cumbersome. Additionally, there was not any significant amount of errors in name mismatching as a result of using strings since Godot was open sourced).
2022-02-08 09:21:10 +01:00
bruvzg b801742b77
[GDExtension] Add binds for missing methods, operators, and constants required for GDExtension TextServer implementation. 2022-02-08 09:49:14 +02:00
Rémi Verschelde 9d1626b4d7
Merge pull request #57017 from godotengine/string-name-static-false-unclaimed 2022-02-05 20:26:34 +01:00
bruvzg 244db37508
Cleanup and move char functions to the `char_utils.h` header. 2022-02-04 11:35:01 +02:00
Anilforextra adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Rémi Verschelde 9686d680b7
Merge pull request #57116 from bruvzg/win_net_share 2022-01-28 11:03:23 +01:00
Rémi Verschelde 899cd34426
Merge pull request #57281 from Rubonnek/rename-subsequence 2022-01-27 11:03:13 +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 9456454109
Fix translation with multiple sources for the same language.
Remove unnecessary locale length checks.
Add "C" -> "en" locale remap.
2022-01-24 18:58:16 +02:00
bruvzg cba8280515 [Windows] Add support for handling network share paths. 2022-01-24 16:22:59 +02:00
Ignacio Roldán Etcheverry 0e659b4230
Fix false reporting unclaimed StringName at exit due to static refs 2022-01-20 22:09:03 +01: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
bruvzg de48d5101b
Fix locale always selecting translation instead of "en", when no match found. 2022-01-19 16:46:48 +02:00
bruvzg 40c56ed410
Improve locale detection.
Use separate language, script and country lists.
Add locale selection dialog and property hint.
2022-01-18 14:30:00 +02: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
luz paz a124f1effe Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 01:03:58 -05: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
raphaelazev 82527df55c Added check to get_all_locales to avoid adding duplicate locales to array 2021-12-10 19:25:59 -03: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
Hugo Locurcio c012fbc8b2
Rename `PROPERTY_USAGE_NOEDITOR` to `PROPERTY_USAGE_NO_EDITOR`
This is consistent with other constants that include `NO`,
such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-11-03 23:06:17 +01:00
Rémi Verschelde f7d852b532
Merge pull request #54350 from akien-mga/clang-format-dont-align-operands 2021-10-28 17:10:52 +02:00
Rémi Verschelde 6b090e325a
Merge pull request #53526 from KoBeWi/super_print 2021-10-28 15:47:52 +02: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 3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +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
K. S. Ernest (iFire) Lee 8f0c056431 Fix specific warnings issues by Clang
Found by `scons dev=yes` on llvm-mingw.
2021-10-14 14:14:26 -07:00
kobewi 31012fd060 Change print_line() to use any number of Variants 2021-10-07 16:28:22 +02:00
Rémi Verschelde 2ac320681a
Merge pull request #53225 from aaronfranke/c-locale 2021-10-05 11:20:08 +02:00
Rémi Verschelde b85dfd990e
GDScript completion: Handle quote style ad-hoc to remove editor dependency
`core` and `scene` shouldn't depend on `editor`, so they can't query this style
setting in `get_argument_options`. But we can handle it after the fact in
GDScript's completion code.

Also cleans up a couple extra unused invalid includes in `core`.
2021-10-04 16:16:05 +02:00
Rémi Verschelde 463dbe5210
Merge pull request #53270 from akien-mga/charproxy-add-copy-constructor 2021-10-04 10:39:37 +02:00
Lightning_A c63b18507d Use range iterators for `Map` 2021-09-30 15:09:12 -06:00
Rémi Verschelde cc57cbb73a
CharProxy: Add copy constructor
Adding the copy constructor is needed to solve a `-Wdeprecated-copy` warning
from GCC and Clang, which is raised when upgrading doctest from 2.4.4 to 2.4.6.
2021-09-30 23:06:40 +02:00
Aaron Franke 1cbec15084
Add locale rename for the "C" locale 2021-09-29 11:57:53 -05:00
O01eg 9302b6547a
Implement override of get_message and get_plural_message 2021-09-29 14:19:14 +03: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
Fabio Alessandrelli e6106edd16
Merge pull request #52408 from GiantBlargg/fix-string-cast
Fix invalid string cast
2021-09-08 15:31:25 +02:00
Daniel Doran 3264ba296e fix invalid string cast 2021-09-04 21:38:07 -06: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 73cd3f0b38
Merge pull request #51395 from angad-k/pseudolocalization-squashed
Add pseudolocalization to Godot. (GSoC'21)
2021-08-08 17:55:30 +02:00
Angad Kambli e79dde1cbb add pseudolocalization to Godot 2021-08-08 20:37:57 +05:30
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