Remove wxWebRequestImpl::IsActiveState()
Semantics of this function wasn't really clear and it was used only once, so just inline it at the point of use and define better what happens for various states there. Also use a switch rather than testing for individual states to make sure this code is updated if another state is added in the future. No real changes.
This commit is contained in:
@@ -122,8 +122,6 @@ protected:
|
||||
// for the response status.
|
||||
void SetFinalStateFromStatus();
|
||||
|
||||
static bool IsActiveState(wxWebRequest::State state);
|
||||
|
||||
private:
|
||||
// Called from public Cancel() at most once per object.
|
||||
virtual void DoCancel() = 0;
|
||||
|
@@ -106,11 +106,6 @@ void wxWebRequestImpl::SetFinalStateFromStatus()
|
||||
}
|
||||
}
|
||||
|
||||
bool wxWebRequestImpl::IsActiveState(wxWebRequest::State state)
|
||||
{
|
||||
return (state == wxWebRequest::State_Active || state == wxWebRequest::State_Unauthorized);
|
||||
}
|
||||
|
||||
void wxWebRequestImpl::SetData(const wxString& text, const wxString& contentType, const wxMBConv& conv)
|
||||
{
|
||||
m_dataText = text.mb_str(conv);
|
||||
@@ -304,8 +299,23 @@ SplitParameters(const wxString& s, wxWebRequestHeaderMap& parameters)
|
||||
|
||||
void wxWebRequestImpl::ProcessStateEvent(wxWebRequest::State state, const wxString& failMsg)
|
||||
{
|
||||
if ( !IsActiveState(state) && GetResponse() )
|
||||
GetResponse()->Finalize();
|
||||
switch ( state )
|
||||
{
|
||||
case wxWebRequest::State_Idle:
|
||||
wxFAIL_MSG("unexpected");
|
||||
break;
|
||||
|
||||
case wxWebRequest::State_Active:
|
||||
case wxWebRequest::State_Unauthorized:
|
||||
break;
|
||||
|
||||
case wxWebRequest::State_Completed:
|
||||
case wxWebRequest::State_Failed:
|
||||
case wxWebRequest::State_Cancelled:
|
||||
if ( GetResponse() )
|
||||
GetResponse()->Finalize();
|
||||
break;
|
||||
}
|
||||
|
||||
wxString dataFile;
|
||||
|
||||
|
Reference in New Issue
Block a user