ParseURL();
}
-wxURL::wxURL(const wxURI& url) : wxURI(url)
+wxURL::wxURL(const wxURI& uri) : wxURI(uri)
{
- Init(url.BuildURI());
+ Init(uri.BuildURI());
+ ParseURL();
+}
+
+wxURL::wxURL(const wxURL& url) : wxURI(url)
+{
+ Init(url.GetURL());
ParseURL();
}
// Assignment
// --------------------------------------------------------------
-wxURL& wxURL::operator = (const wxURI& url)
+wxURL& wxURL::operator = (const wxString& url)
{
wxURI::operator = (url);
- Init(url.BuildURI());
+ Free();
+ Init(url);
ParseURL();
+
return *this;
}
-wxURL& wxURL::operator = (const wxString& url)
+
+wxURL& wxURL::operator = (const wxURI& uri)
{
- wxURI::operator = (url);
- Init(url);
- ParseURL();
+ if (&uri != this)
+ {
+ wxURI::operator = (uri);
+ Free();
+ Init(uri.BuildURI());
+ ParseURL();
+ }
+
+ return *this;
+}
+
+wxURL& wxURL::operator = (const wxURL& url)
+{
+ if (&url != this)
+ {
+ wxURI::operator = (url);
+ Free();
+ Init(url.GetURL());
+ ParseURL();
+ }
+
return *this;
}
}
}
-wxURL::~wxURL()
+void wxURL::Free()
{
CleanData();
#if wxUSE_PROTOCOL_HTTP
#endif
}
+wxURL::~wxURL()
+{
+ Free();
+}
+
// --------------------------------------------------------------
// FetchProtocol
// --------------------------------------------------------------
{
if (m_scheme == info->m_protoname)
{
- if (m_port.IsNull())
+ if ( m_port.empty() )
m_port = info->m_servname;
m_protoinfo = info;
m_protocol = (wxProtocol *)m_protoinfo->m_cinfo->CreateObject();
if ( ms_proxyDefault )
{
ms_proxyDefault->Close();
- delete ms_proxyDefault;
- ms_proxyDefault = NULL;
+ wxDELETE(ms_proxyDefault);
}
}
else
void wxURLModule::OnExit()
{
#if wxUSE_PROTOCOL_HTTP
- delete wxURL::ms_proxyDefault;
- wxURL::ms_proxyDefault = NULL;
+ wxDELETE(wxURL::ms_proxyDefault);
#endif // wxUSE_PROTOCOL_HTTP
}