mirror of https://github.com/axmolengine/axmol.git
Remove duplicated code by introduce a private doSetResponseCallback.
This commit is contained in:
parent
4bedfa4f14
commit
520aa9d351
|
@ -242,15 +242,7 @@ public:
|
|||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE inline void setResponseCallback(Ref* pTarget, SEL_CallFuncND pSelector)
|
||||
{
|
||||
// This function have duplicated body with setResponseCallback(Ref* , SEL_HttpResponse )
|
||||
// You must repeat youself in that function when modified.
|
||||
_pTarget = pTarget;
|
||||
_pSelector = (SEL_HttpResponse)pSelector;
|
||||
|
||||
if (_pTarget)
|
||||
{
|
||||
_pTarget->retain();
|
||||
}
|
||||
doSetResponseCallback(pTarget, (SEL_HttpResponse)pSelector);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,15 +254,7 @@ public:
|
|||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE inline void setResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
|
||||
{
|
||||
// This function have duplicated body with setResponseCallback(Ref* , SEL_CallFuncND )
|
||||
// You must repeat youself in that function.
|
||||
_pTarget = pTarget;
|
||||
_pSelector = pSelector;
|
||||
|
||||
if (_pTarget)
|
||||
{
|
||||
_pTarget->retain();
|
||||
}
|
||||
doSetResponseCallback(pTarget, pSelector);
|
||||
}
|
||||
/**
|
||||
* Set response callback function of HttpRequest object.
|
||||
|
@ -352,6 +336,18 @@ public:
|
|||
return _headers;
|
||||
}
|
||||
|
||||
private:
|
||||
inline void doSetResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
|
||||
{
|
||||
_pTarget = pTarget;
|
||||
_pSelector = pSelector;
|
||||
|
||||
if (_pTarget)
|
||||
{
|
||||
_pTarget->retain();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
// properties
|
||||
Type _requestType; /// kHttpRequestGet, kHttpRequestPost or other enums
|
||||
|
|
Loading…
Reference in New Issue