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
Adding CCDataVisitor and CCPrettyPrinter #2406
Conversation
Thanks! I think it better to rename it to CCPrettyPrinter and create method getResult() which returns resulting string. Default visitor can be good example of usage, but there are no need in intermediate visitor since CCDataVisitor calls visitObject() for all unhandled classes. I.e. class that serializes cocos2d-x data structs to plist will override visit() method for CCDictionary, CCArray, CCString, CCFloat/CCBool/CCDouble/CCInteger and override visitObject() method to print error message in log (maybe with correct type name received from typeid(*obj).name. |
Make sense. So if i understand clearly, do you mean that we don't need to
Do you mean that
Agree, I'll do it like this. Thanks. |
Yes.
No, just mean that word 'default' in CCDefaultVisitor misleads user: s/he thinks that CCDefaultVisitor should be subclassed instead of subclassing CCDataVisitor directly. |
Got it, Thank you. I will update this Pull Request soon. |
Are there any troubles, or your are busy after release day ;) ? Actually change will show benefits only when extensions developers will start use it. Currently I see 2 candidates: CCDictionary::writeToFile() and 3rd-party extensions for JSON serialization; I will help to update them. P.S. JSON also can have own class CCNull, which complicates things a bit. |
I have told to @dumganhar about this PR. |
…nter, iOS port is ok.
…into iss2142-datavisitor
fixed #2142: Adding CCDataVisitor and Implementing CCPrettyPrinter.
@sergey-shambir |
OMG, you shouldn't add |
I agree. Maybe we should rename it to unsigned int m_uID; int m_nLuaID; need to be moved to |
Putting the Script data/methods in a new object is a good idea. Having a way to dump objects to string is also useful. |
Two quick questions: a) b) Thanks! |
What's the format of the string dumped from CCDictionary? If you just want to show the content of CCDictionary when debugging, CCPrettyPrinter could do that job. If that couldn't meet your requirement, you could implement a new subclass of CCDataVisitor, maybe CCJsonVisitor to dump CCDictionary to JSON format.
Alternatively, base type like CCInteger, CCBool should implement a virtual method like |
issue #2406: Override updateDisplayedColor and updateDisplayedOpacity method in Scale9Sprite class. Resolved issue: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions.
fixed cocos2d#2142: Adding CCDataVisitor and Implementing CCPrettyPrinter.
issue cocos2d#2406: Override updateDisplayedColor and updateDisplayedOpacity method in Scale9Sprite class. Resolved issue: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions.
fixed cocos2d#2142: Adding CCDataVisitor and Implementing CCPrettyPrinter.
issue cocos2d#2406: Override updateDisplayedColor and updateDisplayedOpacity method in Scale9Sprite class. Resolved issue: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions.
issue cocos2d#2406: Override updateDisplayedColor and updateDisplayedOpacity method in Scale9Sprite class. Resolved issue: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions.
issue cocos2d#2406: Override updateDisplayedColor and updateDisplayedOpacity method in Scale9Sprite class. Resolved issue: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions.
fixed #2142: Adding CCDataVisitor and Implementing CCPrettyPrinter.
The usage of CCPrettyPrinter is: