Document wxWebResponse::GetContentLength()
Also change its return type from wxInt64 to wxFileOffset for consistency with all the other length/progress-related functions in wxWebRequest.
This commit is contained in:
@@ -24,7 +24,7 @@ class wxWebResponseWinHTTP : public wxWebResponseImpl
|
|||||||
public:
|
public:
|
||||||
wxWebResponseWinHTTP(wxWebRequestWinHTTP& request);
|
wxWebResponseWinHTTP(wxWebRequestWinHTTP& request);
|
||||||
|
|
||||||
wxInt64 GetContentLength() const wxOVERRIDE { return m_contentLength; }
|
wxFileOffset GetContentLength() const wxOVERRIDE { return m_contentLength; }
|
||||||
|
|
||||||
wxString GetURL() const wxOVERRIDE;
|
wxString GetURL() const wxOVERRIDE;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
HINTERNET m_requestHandle;
|
HINTERNET m_requestHandle;
|
||||||
wxInt64 m_contentLength;
|
wxFileOffset m_contentLength;
|
||||||
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxWebResponseWinHTTP);
|
wxDECLARE_NO_COPY_CLASS(wxWebResponseWinHTTP);
|
||||||
};
|
};
|
||||||
|
@@ -29,7 +29,7 @@ public:
|
|||||||
|
|
||||||
~wxWebResponseURLSession();
|
~wxWebResponseURLSession();
|
||||||
|
|
||||||
wxInt64 GetContentLength() const wxOVERRIDE;
|
wxFileOffset GetContentLength() const wxOVERRIDE;
|
||||||
|
|
||||||
wxString GetURL() const wxOVERRIDE;
|
wxString GetURL() const wxOVERRIDE;
|
||||||
|
|
||||||
|
@@ -133,7 +133,7 @@ class wxWebResponseImpl : public wxRefCounterMT
|
|||||||
public:
|
public:
|
||||||
virtual ~wxWebResponseImpl();
|
virtual ~wxWebResponseImpl();
|
||||||
|
|
||||||
virtual wxInt64 GetContentLength() const = 0;
|
virtual wxFileOffset GetContentLength() const = 0;
|
||||||
|
|
||||||
virtual wxString GetURL() const = 0;
|
virtual wxString GetURL() const = 0;
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ class wxWebResponseCURL : public wxWebResponseImpl
|
|||||||
public:
|
public:
|
||||||
explicit wxWebResponseCURL(wxWebRequestCURL& request);
|
explicit wxWebResponseCURL(wxWebRequestCURL& request);
|
||||||
|
|
||||||
wxInt64 GetContentLength() const wxOVERRIDE;
|
wxFileOffset GetContentLength() const wxOVERRIDE;
|
||||||
|
|
||||||
wxString GetURL() const wxOVERRIDE;
|
wxString GetURL() const wxOVERRIDE;
|
||||||
|
|
||||||
|
@@ -93,7 +93,7 @@ public:
|
|||||||
|
|
||||||
bool IsOk() const { return m_impl.get() != NULL; }
|
bool IsOk() const { return m_impl.get() != NULL; }
|
||||||
|
|
||||||
wxInt64 GetContentLength() const;
|
wxFileOffset GetContentLength() const;
|
||||||
|
|
||||||
wxString GetURL() const;
|
wxString GetURL() const;
|
||||||
|
|
||||||
|
@@ -394,6 +394,8 @@ public:
|
|||||||
|
|
||||||
This value is based on the @c Content-Length header, if none is found
|
This value is based on the @c Content-Length header, if none is found
|
||||||
it will return -1.
|
it will return -1.
|
||||||
|
|
||||||
|
@see wxWebResponse::GetContentLength()
|
||||||
*/
|
*/
|
||||||
wxFileOffset GetBytesExpectedToReceive() const;
|
wxFileOffset GetBytesExpectedToReceive() const;
|
||||||
///@}
|
///@}
|
||||||
@@ -515,6 +517,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxString GetHeader(const wxString& name) const;
|
wxString GetHeader(const wxString& name) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the length of returned data if available.
|
||||||
|
|
||||||
|
Returns the value specified in the @c Content-Length: response header
|
||||||
|
of @c -1 if not available.
|
||||||
|
*/
|
||||||
|
wxFileOffset GetContentLength() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the MIME type of the response (if available).
|
Returns the MIME type of the response (if available).
|
||||||
*/
|
*/
|
||||||
|
@@ -677,7 +677,7 @@ wxWebResponse::~wxWebResponse()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt64 wxWebResponse::GetContentLength() const
|
wxFileOffset wxWebResponse::GetContentLength() const
|
||||||
{
|
{
|
||||||
wxCHECK_IMPL( -1 );
|
wxCHECK_IMPL( -1 );
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ size_t wxWebResponseCURL::CURLOnHeader(const char * buffer, size_t size)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt64 wxWebResponseCURL::GetContentLength() const
|
wxFileOffset wxWebResponseCURL::GetContentLength() const
|
||||||
{
|
{
|
||||||
#if CURL_AT_LEAST_VERSION(7, 55, 0)
|
#if CURL_AT_LEAST_VERSION(7, 55, 0)
|
||||||
curl_off_t len = 0;
|
curl_off_t len = 0;
|
||||||
@@ -108,7 +108,7 @@ wxInt64 wxWebResponseCURL::GetContentLength() const
|
|||||||
#else
|
#else
|
||||||
double len = 0;
|
double len = 0;
|
||||||
curl_easy_getinfo(GetHandle(), CURLINFO_CONTENT_LENGTH_DOWNLOAD, &len);
|
curl_easy_getinfo(GetHandle(), CURLINFO_CONTENT_LENGTH_DOWNLOAD, &len);
|
||||||
return (wxInt64)len;
|
return (wxFileOffset)len;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -209,7 +209,7 @@ void wxWebResponseURLSession::HandleData(WX_NSData data)
|
|||||||
ReportDataReceived(data.length);
|
ReportDataReceived(data.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt64 wxWebResponseURLSession::GetContentLength() const
|
wxFileOffset wxWebResponseURLSession::GetContentLength() const
|
||||||
{
|
{
|
||||||
return m_task.response.expectedContentLength;
|
return m_task.response.expectedContentLength;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user