summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
AgeCommit message (Collapse)Author
2020-09-03[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg
2020-08-19Updated Translation architecture to have TranslationPO, did some commit ↵SkyJJ
fixes and updated class Reference.
2020-08-19Added plurals and context support to TranslationSkyJJ
2020-07-27Make all String float conversion methods be 64-bitAaron Franke
2020-07-15Docs: Ignore OS specific values (constants, project settings, properties).bruvzg
2020-07-03Remove String::find_last (same as rfind)Stijn Hinlopen
2020-07-02Fix overflow and underflow checks for string conversion to intMaganty Rushyendra
Current error checks for to_int and to_int64 do not issue overflow error messages for INT64_MAX + 1, INT64_MAX + 2, and other numbers close to the integer limits. Likewise, error checks for hex_to_int, hex_to_int64 and bin_to_int64 issue false positive error messages for INT64_MIN or INT32_MIN. This commit fixes these error checks.
2020-07-01Merge pull request #38713 from aaronfranke/string-64bitRémi Verschelde
Make all String integer conversion methods be 64-bit
2020-06-11String: Use ABS macro in padding codeRémi Verschelde
Follow-up to #39261.
2020-06-03Enable zero padding with float specifier for format stringsMaganty Rushyendra
Godot currently supports zero padding for integers, octals and hexadecimals when using format strings, but not for floats. This commit adds support for zero padding for floats, thus ensuring consistent behavior for all types, and making Godot's format specifiers' behavior closer to c's `printf()`. Before: `print("<%07.2f>" % -0.2345)` prints `< -0.23>`. Now: `print("<%07.2f>" % -0.2345)` prints `<-000.23>`. `print("<%7.2f>" % -0.2345)` prints `< -0.23>`.
2020-06-03Rename String bin_to_int64 to bin_to_intAaron Franke
And also change String static to_int(const char *) to return int64_t
2020-06-03Remove 32-bit String hex_to_int methodAaron Franke
2020-06-03Remove 32-bit String to_int methodAaron Franke
2020-05-28Use translated docs in PropertySelectorRémi Verschelde
And do the dedent and stripping for both translated and non-translated strings for consistency, and so that we don't need to do it at the call site.
2020-05-19Style: Remove unnecessary semicolons from `core`Rémi Verschelde
Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-10New lightmapperJuan Linietsky
-Added LocalVector (needed it) -Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too) -Fixes and changes all around the place -Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
2020-04-04Improve the shader error console outputHugo Locurcio
This makes the line gutter look more like an actual line gutter, which makes it less confusing.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-20i18n: Add support for translating the class referenceRémi Verschelde
- Parse `.po` files from `doc/translations/*.po` like already done with `editor/translations/*.po`. - Add logic to register a doc translation mapping in `TranslationServer` and `EditorSettings`. - Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`). Strings are automatically dedented and stripped of whitespace to ensure that they would match the translation catalog. - Use `DTR()` to translate relevant strings in `EditorHelp`, `EditorInspector`, `CreateDialog`, `ConnectionsDialog`. - Small simplification to `TranslationLoaderPO`, the path argument was not really meaningful.
2020-03-16Tweak the invalid Unicode error message to be more descriptiveHugo Locurcio
This closes #28503.
2020-02-23Replace FALLTHROUGH macro by C++17 [[fallthrough]]Rémi Verschelde
This attribute is now part of the standard we target so we no longer need compiler-specific hacks. Also enables -Wimplicit-fallthrough for Clang now that we can properly support it. It's already on by default for GCC's -Wextra. Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-11A lot of progress with canvas rendering, still far from working.Juan Linietsky
2020-02-11Merge pull request #33731 from madmiraal/fix-c4996-warningRémi Verschelde
Fix Visual Studio throwing C4996 warning in ustring.cpp.
2020-02-03Fixed String::humanize_size crash.dankan1890
Close #35872
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-20Encodes property names properly in project.godotHaoyu Qiu
2019-12-18Fix build warning in ustring.cpp on Windows/MSVC platformYuri Roubinsky
2019-12-16Fixed issues with using a relative path in the export window.Catchawink
Before this fix, opening relative export paths inside of an EditorFileDialog was not possible. This was fixed by modifying String::path_to_file() to save relative paths in EditorExportPreset::set_export_path() more appropriately and changing EditorFileDialog::set_current_dir() to open relative paths.
2019-12-10Removed unused variables, add some constants numbersRafał Mikrut
2019-11-20Fix some overflows and unitialized variablesRafał Mikrut
2019-11-19Fix Visual Studio throwing C4996 warning in ustring.cpp.Marcel Admiraal
2019-11-08Fix MinGW/clang/LLD/UCRT build.bruvzg
2019-11-07Fix #24137 Different number of leading zeros on MINGW printf("%lg")Jamie Pate
Use _set_output_format() on MINGW platform to force _snprintf_s() to conform to the C99 standard and match the other platforms. Fixes #24137
2019-11-01Fix some crashes, overflows and using variables without valuesRafał Mikrut
2019-10-04Remove redundant condition in `String::_humanize_digits()`Hugo Locurcio
2019-10-04Bind the `String::humanize_size` methodAndrii Doroshenko (Xrayez)
The method signature is also changed to use `uint64_t` instead of `size_t` for it to be Variant-compatible.
2019-09-24Merge pull request #31883 from aole/create-string-function-repeatRémi Verschelde
Create a GDScript String function repeat
2019-09-23Merge pull request #32273 from Calinou/humanize-size-fix-i18nRémi Verschelde
Fix i18n in `String::humanize_size()`
2019-09-23Fix i18n in `String::humanize_size()`Hugo Locurcio
Calls to `RTR()` must be added to each string so the PO file generator can pick them up.
2019-09-22Changed some code found by Clang Tidy and Coverityqarmin
2019-09-05Improve the `String::humanize_size()` methodHugo Locurcio
- Use "B" insted of "Bytes" to be more compact - Use suffixes that denote a binary prefix - Make suffixes localizable This removes the need for the custom `EditorNetworkProfiler:_format_bandwidth()` method.
2019-09-03Create a GDScript String function repeatBhupendra Aole
Fixes #30610
2019-08-24Add forgotten pointer checkingqarmin
2019-08-23Merge pull request #31513 from qarmin/int_overflowRémi Verschelde
Prevent int overflow and underflow