Now possible to compile with wxURL disabled

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-10-27 17:33:32 +00:00
parent cf49c9551b
commit 34e0d9f874
4 changed files with 19 additions and 2 deletions

View File

@@ -84,13 +84,14 @@ static wxString StripProtocolAnchor(const wxString& location)
bool wxInternetFSHandler::CanOpen(const wxString& location)
{
#if wxUSE_URL
wxString p = GetProtocol(location);
if ((p == wxT("http")) || (p == wxT("ftp")))
{
wxURL url(p + wxT(":") + StripProtocolAnchor(location));
return (url.GetError() == wxURL_NOERR);
}
#endif
return false;
}
@@ -98,6 +99,9 @@ bool wxInternetFSHandler::CanOpen(const wxString& location)
wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
const wxString& location)
{
#if !wxUSE_URL
return NULL;
#else
wxString right =
GetProtocol(location) + wxT(":") + StripProtocolAnchor(location);
@@ -130,6 +134,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
}
return (wxFSFile*) NULL; // incorrect URL
#endif
}

View File

@@ -760,6 +760,9 @@ bool wxFTP::Abort()
wxInputStream *wxFTP::GetInputStream(const wxString& path)
{
#if !wxUSE_URL
return NULL;
#else
if ( ( m_currentTransfermode == NONE ) && !SetTransferMode(BINARY) )
return NULL;
@@ -786,6 +789,7 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path)
wxInputFTPStream *in_stream = new wxInputFTPStream(this, sock);
return in_stream;
#endif
}
wxOutputStream *wxFTP::GetOutputStream(const wxString& path)

View File

@@ -45,8 +45,12 @@ wxProtoInfo::wxProtoInfo(const wxChar *name, const wxChar *serv,
{
m_cinfo = info;
m_needhost = need_host1;
#if wxUSE_URL
next = wxURL::ms_protocols;
wxURL::ms_protocols = this;
#else
next = NULL;
#endif
}
/////////////////////////////////////////////////////////////////

View File

@@ -43,13 +43,17 @@ wxFileProto::~wxFileProto()
wxInputStream *wxFileProto::GetInputStream(const wxString& path)
{
wxFileInputStream* retval = new wxFileInputStream(wxURL::ConvertFromURI(path));
#if !wxUSE_URL
return NULL;
#else
wxFileInputStream* retval = new wxFileInputStream(wxURL::ConvertFromURI(path));
if (retval->Ok()) {
return retval;
} else {
delete retval;
return 0;
}
#endif
}
#endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE