Inherit wxURL from wxURI, providing assignment, copy construction, comparison, and less duplication of code. Change wxURI a bit to meet some of Vadim's reccommendations - move accessors into header, and finish some of his other reccom. Change assignment to use const wxString& instead of const wxChar*. Change wxURI docs to reflect that it inherits from wxObject. Made preliminary docs for the wxURL transition. Add some unit tests for the transition.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2004-10-28 06:49:46 +00:00
parent 68ca6f5252
commit b60b2ec8ac
8 changed files with 167 additions and 228 deletions

View File

@@ -8,6 +8,11 @@
// Licence: wxWindows
/////////////////////////////////////////////////////////////////////////////
//
//TODO: RN: I had some massive doxygen docs, I need to move these
//in a presentable form in these sources
//
// ===========================================================================
// declarations
// ===========================================================================
@@ -64,7 +69,7 @@ wxURI::wxURI(const wxString& uri) : m_hostType(wxURI_REGNAME), m_fields(0)
wxURI::wxURI(const wxURI& uri) : m_hostType(wxURI_REGNAME), m_fields(0)
{
*this = uri;
Assign(uri);
}
// ---------------------------------------------------------------------------
@@ -136,61 +141,12 @@ bool wxURI::IsEscape(const wxChar*& uri)
}
// ---------------------------------------------------------------------------
// HasXXX
// ---------------------------------------------------------------------------
bool wxURI::HasScheme() const
{ return (m_fields & wxURI_SCHEME) == wxURI_SCHEME; }
bool wxURI::HasUser() const
{ return (m_fields & wxURI_USER) == wxURI_USER; }
bool wxURI::HasServer() const
{ return (m_fields & wxURI_SERVER) == wxURI_SERVER; }
bool wxURI::HasPort() const
{ return (m_fields & wxURI_PORT) == wxURI_PORT; }
bool wxURI::HasPath() const
{ return (m_fields & wxURI_PATH) == wxURI_PATH; }
bool wxURI::HasQuery() const
{ return (m_fields & wxURI_QUERY) == wxURI_QUERY; }
bool wxURI::HasFragment() const
{ return (m_fields & wxURI_FRAGMENT) == wxURI_FRAGMENT; }
// ---------------------------------------------------------------------------
// GetXXX
// Get
//
// The normal Get() actually builds the entire URI into a useable
// Get() actually builds the entire URI into a useable
// representation, including proper identification characters such as slashes
// ---------------------------------------------------------------------------
const wxString& wxURI::GetScheme() const
{ return m_scheme; }
const wxString& wxURI::GetPath() const
{ return m_path; }
const wxString& wxURI::GetQuery() const
{ return m_query; }
const wxString& wxURI::GetFragment() const
{ return m_fragment; }
const wxString& wxURI::GetPort() const
{ return m_port; }
const wxString& wxURI::GetUser() const
{ return m_user; }
const wxString& wxURI::GetServer() const
{ return m_server; }
const wxURIHostType& wxURI::GetHostType() const
{ return m_hostType; }
wxString wxURI::Get() const
{
wxString ret;
@@ -228,36 +184,28 @@ wxString wxURI::Get() const
wxURI& wxURI::operator = (const wxURI& uri)
{
if (HasScheme())
m_scheme = uri.m_scheme;
return Assign(uri);
}
wxURI& wxURI::Assign(const wxURI& uri)
{
//assign fields
m_fields = uri.m_fields;
if (HasServer())
{
if (HasUser())
m_user = uri.m_user;
m_server = uri.m_server;
m_hostType = uri.m_hostType;
if (HasPort())
m_port = uri.m_port;
}
if (HasPath())
m_path = uri.m_path;
if (HasQuery())
m_query = uri.m_query;
if (HasFragment())
m_fragment = uri.m_fragment;
//ref over components
m_scheme = uri.m_scheme;
m_user = uri.m_user;
m_server = uri.m_server;
m_hostType = uri.m_hostType;
m_port = uri.m_port;
m_path = uri.m_path;
m_query = uri.m_query;
m_fragment = uri.m_fragment;
return *this;
}
wxURI& wxURI::operator = (const wxChar* string)
wxURI& wxURI::operator = (const wxString& string)
{
Create(string);
return *this;