Projects > cpp > Issues > Bug #4702

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Update HTTPClient/HTTPRequest to C++11 callbacks

Bug #4702 [Closed]
Mazyod 2014-04-06 21:33 . Updated over 2 years ago

Currently, HTTPClient uses old, clunky callbacks:

typedef void (cocos2d::Ref::*SEL_HttpResponse)(HttpClient* client, HttpResponse* response);

    inline void setResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
    {
        _pTarget = pTarget;
        _pSelector = pSelector;

        if (_pTarget)
        {
            _pTarget->retain();
        }
    }   

The desired results is to use the new C++11 callbacks, defined by the CC_CALLBACK_X macro:

typedef std::function ccHttpRequestCallback;

    inline void setResponseCallback(const ccHttpRequestCallback& callback)
    {
        _callback = callback;
    }   
dumganhar 2014-04-25 03:05
  • Status changed from New to Resolved
dumganhar 2014-04-25 03:05
  • Status changed from Resolved to Closed

Atom PDF

Status:Closed
Start date:2014-04-06
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:all
Target version:-
Estimated time:2.00 points

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.