-
-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ptr()
/ ptrw()
to the arrays, add missing String
methods, add missing CharString
method implementations.
#695
Conversation
5c7a694
to
37a441b
Compare
@@ -246,7 +246,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl | |||
result.append(f"\tstatic constexpr size_t {snake_class_name}_SIZE = {size};") | |||
result.append(f"\tuint8_t opaque[{snake_class_name}_SIZE] = {{}};") | |||
result.append( | |||
f"\t_FORCE_INLINE_ GDNativeTypePtr ptr() const {{ return const_cast<uint8_t (*)[{snake_class_name}_SIZE]>(&opaque); }}" | |||
f"\t_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const {{ return const_cast<uint8_t (*)[{snake_class_name}_SIZE]>(&opaque); }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice that here it seems to be private
, while in all implementations it's public
, is that intended/a problem?
And if it needs to be public
, should it be renamed native_ptr()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has friend Variant
to use it, and AFAIK it's not intended to be used outside Variant
source. Moved it to the private
int the hand-made headers for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very knowledgeable about the godot-cpp implementations but these additions and fixes definitely make sense.
ef3c391
to
c9de291
Compare
Also, added move constructor / assignment operator to the CharString cs = text.utf8();
//do stuff with cs
cs = text2.utf8();
//do stuff with cs |
…dd missing `CharString` method implementations.
c9de291
to
bf8fc4c
Compare
Thanks! |
ptr()
/ptrw()
to the arrays, and renames existingptr
to_native_ptr
to avoid conflict.ptr()
/ptrw()
,parse_utf*
andutf*
methods to theString
.length()
andget_data()
methods ofChar*String
.