Skip to content
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

GUIReader::registerTypeAndCallBack for std::function and add CustomGUIReader for lua #7744

Merged
merged 17 commits into from
Sep 4, 2014

Conversation

litefeel
Copy link

No description provided.

@litefeel litefeel changed the title fix: copy map when getParseCallBackMap() and getParseObjectMap() GUIReader::registerTypeAndCallBack for std::function Aug 12, 2014
fix compile error
@litefeel
Copy link
Author

[ci rebuild]

2 similar comments
@darkdukey
Copy link
Contributor

[ci rebuild]

@litefeel
Copy link
Author

[ci rebuild]

@litefeel
Copy link
Author

i can build success. why not there?

@minggo
Copy link
Contributor

minggo commented Aug 14, 2014

It seems the error exist in lua-binding.

@litefeel
Copy link
Author

@minggo ?

@litefeel
Copy link
Author

@minggo i don't know.

@minggo
Copy link
Contributor

minggo commented Aug 15, 2014

The error log is http://115.28.134.83:8000/job/cocos-2dx-pull-request-build/4682/node=android_mac/console.
I will ask somebody to check it.

@minggo
Copy link
Contributor

minggo commented Aug 18, 2014

I have asked @samuele3hu to take a look.

@samuele3hu
Copy link
Contributor

It's a bug of bindings-generator,it didn't consider the value of r in 245 line of tools/bindings-generator/generatory.py.I suggest that skipping the lua bindings for this functions by setting the 'tools/tolua/cocos2dx_studio.ini'.

@minggo
Copy link
Contributor

minggo commented Aug 18, 2014

What did you mean the value of r? Will you please modify tools/tolua/cocos2dx_studio.ini?

@samuele3hu
Copy link
Contributor

En,I will check out this branch and modify it.

@minggo
Copy link
Contributor

minggo commented Aug 19, 2014

@lite3
@samuele3hu fixed lua-binding issue in #7817.

@@ -85,8 +90,8 @@ class CC_STUDIO_DLL GUIReader : public cocos2d::Ref
ParseObjectMap _mapObject;

public:
ParseCallBackMap getParseCallBackMap() { return _mapParseSelector; };
ParseObjectMap getParseObjectMap() { return _mapObject; };
ParseCallBackMap* getParseCallBackMap() { return &_mapParseSelector; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @lite3
Why should we change std::map from value to reference?
I think c++11 std::map has move semantic , it won't introduce extra copy performance penalty here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndyQue

auto map = reader->getParseCallBackMap();
  1. this map is copy, reader->_mapParseSelector. can not modify.
  2. move semantic used by temporary object. but the temporary map need malloc.

@litefeel litefeel changed the title GUIReader::registerTypeAndCallBack for std::function GUIReader::registerTypeAndCallBack for std::function and add CustomGUIReader for lua Aug 29, 2014
@litefeel
Copy link
Author

@minggo the same problem at build failed.
fix it at cocos2d/bindings-generator#131

@samuele3hu
Copy link
Contributor

@lite3 , I check out your branch,and use the latest bindings-generator for cocos2dx_studio.ini, the result is successful.Why did you modify the bindings-generator.

@litefeel
Copy link
Author

litefeel commented Sep 1, 2014

@samuele3hu

for bindings-generator, I write it at cocos2d/bindings-generator#131

now, i write it again.

old regex: function<(.+) .*\((.*)\)>
now regex: function<(.+) *\((.*)\)>

input string is function<Ref *(void)>
result about first group:
old: Ref
now: Ref *

@litefeel
Copy link
Author

litefeel commented Sep 3, 2014

@minggo please review

@minggo
Copy link
Contributor

minggo commented Sep 3, 2014

Ok, i have asked @samuele3hu to review lua-binding codes.
Thanks.

@samuele3hu
Copy link
Contributor

@lite3,you are right.If use function<(.+) .*\((.*)\)>,the parse error about ret_type was triggered,through it don't have effect now,thanks.
@minggo , for lua-binding codes,i think it is ok.

minggo added a commit that referenced this pull request Sep 4, 2014
GUIReader::registerTypeAndCallBack for std::function and add CustomGUIReader for lua
@minggo minggo merged commit 99f3b37 into cocos2d:v3 Sep 4, 2014
cocos-travis-mac pushed a commit to cocos-travis-mac/cocos2d-x that referenced this pull request Sep 4, 2014
GUIReader::registerTypeAndCallBack for std::function and add CustomGUIReader for lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants