Commit graph

84 commits

Author SHA1 Message Date
IAmActuallyCthulhu
82b9557803
Remove redundant author doc comments 2019-08-12 04:26:38 -05:00
Chaosus
080c0bb7fe Added count method to String 2019-07-23 18:55:54 +03:00
Fabio Alessandrelli
6c512e21a9 Add sha1 functions to string (using new CryptoCore) 2019-07-03 18:42:46 +02:00
qarmin
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Rémi Verschelde
2b52cd3e5c
Merge pull request #28648 from KoBeWi/substr-1
Make second parameter of substr optional
2019-06-19 12:43:46 +02:00
Rémi Verschelde
e864237f1a i18n: Fix extract.py support for new TTRC
Also make compatible with Python 3.
2019-06-16 22:02:44 +02:00
Tomasz Chabora
0b8a785539 Make second parameter of substr optional 2019-05-03 19:46:56 +02:00
jude-lafitteIII
d3cc9c0bf1 Support for binary literals in GDScript. Added an error that shows if a point is written in a hex literal. Added highlighting for binary literals in GDScript 2019-04-25 13:44:27 +01:00
Ibrahn Sahir
9d0b3b300c fixed an access after free in OS_X11::set_context.
Added constructor and assignment operator for CharString
from const char* to simplify memory management when working with
utf8/ascii strings for APIs taking char*.
Reworked OS_X11::set_context to use CharString and avoid some manual
memory management.
2019-04-22 13:34:17 +01:00
Juan Linietsky
a20235aeb0 Add ability to edit editor feature profiles
Allows enabling/disabling parts of the editor and storing/loading profiles for that.
2019-04-08 19:18:51 -03:00
marxin
6be77da7eb Fix new GCC 9 warnings: -Wdeprecated-copy. 2019-03-02 14:37:02 +01:00
marxin
c11e7ffd0e Fix warnings seen with -Wignored-qualifiers. 2019-02-21 20:24:29 +01:00
Ibrahn Sahir
cbb396c006 Repair String lstrip and rstrip.
Background: lstrip and rstrip were broken by changes to String in:
0e29f7974b
which removed it's access to Vector::find(CharType).

Moved Vector's find up into CowData so it can be shared by Vector and String.
Added String::find_char using CowData::find.
Implemented rstrip and lstrip using find_char.
Added a few tests for String rstrip and lstrip.
2019-01-07 17:34:44 +00:00
Hein-Pieter van Braam
ac99ed3cda String[size()] should return a default constructed CharType
As per the C++ standard 21.3.4.1 for std::string:
Returns: If pos < size(), returns data()[pos]. Otherwise, if pos ==
size(), the const version returns charT(). Otherwise, the behavior is
undefined.

Since the behavior is undefined Godot now does the same thing for const
and non-const versions of operator[].

This fixes #21242 and fixes #22221.
2019-01-04 17:48:03 +00:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Hein-Pieter van Braam
4e25e5066b Reduce String CoW
By introducing an intermediate proxy class for the array subscript
operator for String and CharString we can control better when CowData
will actually CoW.

This should improve performance of String usage for most cases.
2018-12-16 16:51:38 +01:00
Ibrahn Sahir
a758653199 const char* operator on CharString now const. 2018-12-03 20:25:23 +00:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Marcin Zawiejski
f3b2689aa6 fix out of buffer read when copying non-null terminated strings 2018-08-06 23:51:07 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Ibrahn Sahir
e0df1221bf removed redundant strlen calculation from String::substr 2018-07-24 16:08:45 +01:00
Max Hilbrunner
acf6c326fb
Merge pull request #14715 from Krakean/string_add_rsplit2
Added rsplit() method to String class
2018-05-23 17:19:35 +02:00
George Marques
ca25f1e6ea
Merge pull request #18176 from nikibobi/string-trim
Add string trim_prefix, trim_suffix, lstrip and rstrip methods
2018-04-22 12:29:44 -03:00
bosak
79ecdee496
add string trim_prefix trim_suffix lstrip and rstrip methods 2018-04-17 14:15:43 +03:00
Pedro J. Estébanez
00e98458ba Revert "Unify http- and percent- encode/decode"
This reverts commit b76ee30917.
2018-04-12 21:12:34 +02:00
Pedro J. Estébanez
b76ee30917 Unify http- and percent- encode/decode
There was a percent-prefixed version, which was exposed, and a http-prefixed version which was not (only to GDNative).
This commit keeps the percent-prefixed versions, but with the http-prefixed implementations.
2018-03-27 19:18:30 +02:00
Ignacio Etcheverry
f37090ccf4 Mono: Better versioning and gracefully unloading of Godot API assemblies 2018-02-25 20:56:27 +01:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Noshyaar
a6328011d8
Merge pull request #14973 from poke1024/docs-word-selection
Double-click word selection for RichTextLabel (i.e. docs)
2018-01-01 18:51:35 +07:00
Bernhard Liebl
b80bc553dd Double-click word selection for RichTextLabel (i.e. docs) 2017-12-28 17:44:22 +01:00
Juan Linietsky
a663dbfdd8
Merge pull request #14744 from poke1024/stringname-compare
Avoid string allocations in AlphCompare
2017-12-27 15:44:45 -03:00
Bernhard Liebl
b47ce5e5d6 Avoid string allocations in AlphCompare 2017-12-17 12:16:08 +01:00
Rémi Verschelde
6b7bed98f4
Merge pull request #14576 from poke1024/strings
Some performance tweaking of string handling
2017-12-16 13:10:30 +01:00
Dmitry Koteroff
6fe415ca7f Added rsplit() for String class
Docs updated
2017-12-15 22:23:58 +03:00
Dmitry Koteroff
5302fd125b Added third argument for String.split() function (see issue #14349)
Remove negative limit, leave only positive and make it reflect behaviour like in Python
Also limit renamed to maxsplit to match Python one.
Also docs updated.

Fix indent
2017-12-15 21:51:13 +03:00
poke1024
040d4dba6b Some performance tweaking of string handling 2017-12-15 17:25:57 +01:00
Ruslan Mustakov
8f0f327f02 Allow configuring iOS export
- EditorExportPlugin's _export_begin accepts all the arguments related
   to the current export (is_debug, path, flags).

 - EditorExportPlugin API is extended with methods allowing to configure
   iOS export: add_ios_framework, add_ios_plist_content,
   add_ios_linker_flags, add_ios_bundle_file.

 - iOS export template now contains Godot as a static library so that
   it can be linked with third-party Frameworks and GDNative static
   libraries.

 - Adds method to DirAccess for recursive copying of a directory.

 - Fixes iOS export to work with Xcode 9 (released recently).
2017-11-21 01:16:49 +07:00
Zher Huei Lee
0804dd5336 Added String::dedent() to remove text indentation
This functions similarly to Python's textwrap.dedent()

It's also been applied to doc_data.cpp to remove extra whitespace while
parsing the XML.
2017-11-01 07:20:20 +08:00
Unknown
7683ff3e42 Fix get_node() and $ autocompletion when using single quotes 2017-10-30 21:58:32 +01:00
Rémi Verschelde
bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
TwistedTwigleg
00f6c85928 Synchronize parameter names in definition and declaration
Fixes #10244.
2017-08-16 17:22:23 +02:00
Damian Day
f2564ca97f Fix natural sorting order in EditorFileDialog, FileDialog and EditorFileSystemDirectory
Make EditorFileDialog, FileDialog and EditorFileSystemDirectory alphanumerical sorting more natural

Added a new method 'naturalnocasecmp_to' and comparator 'NaturalNoCaseComparator' to String.

Fixes #8712.
2017-05-12 13:02:25 +01:00
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde
5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Juan Linietsky
de0045cf1b -renamed globals.h to global_config.cpp (this seems to have caused a few modified files)
-.pck and .zip exporting redone, seems to be working..
2017-02-21 00:06:30 -03:00
Juan Linietsky
4c28f35b2c Merge pull request #7002 from RandomShaper/vcs-friendliness
Greater VCS friendliness
2017-01-25 14:52:40 -03:00
Pedro J. Estébanez
7dbb1c0571 Improve .tscn VCS
Serialize dictionaries adding newlines between key-value pairs
Serialize group lists also with newlines in between
Serialize string properties escaping only " and \ (needed for a good diff experience with built-in scripts and shaders)

Bonus:
Make AnimationPlayer serialize its blend times always sorted so their order is predictable in the .tscn file.

This PR is back-compat; won't break the load of existing files.
2017-01-16 18:03:51 +01:00
Juan Linietsky
7c4167de64 Merge pull request #7010 from AlexHolly/format-string2
advanced string format
2017-01-14 11:56:24 -03:00
Juan Linietsky
d9d77291bc rename String.extension() -> String.get_extension() / String.basename() -> String.get_basename() 2017-01-14 00:51:09 -03:00