minor cleanup: don't use bool parameters, don't typedef the enums, don't abuse references
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30133 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -281,7 +281,7 @@ this URI equals {\tt uricomp}, otherwise it returns false.
|
|||||||
|
|
||||||
\membersection{wxURI::Resolve}\label{wxuriresolve}
|
\membersection{wxURI::Resolve}\label{wxuriresolve}
|
||||||
|
|
||||||
\func{void}{Resolve}{\param{const wxURI\& }{base}, \param{const bool\& }{bStrict = true}}
|
\func{void}{Resolve}{\param{const wxURI\& }{base}, \param{int }{flags = \texttt{wxURI\_STRICT}}}
|
||||||
|
|
||||||
Inherits this URI from a base URI - components that do not
|
Inherits this URI from a base URI - components that do not
|
||||||
exist in this URI are copied from the base, and if this URI's
|
exist in this URI are copied from the base, and if this URI's
|
||||||
@@ -296,6 +296,7 @@ of the base's is merged with this URI's path, resulting in the URI
|
|||||||
"http://mysite.com/john/mydir".
|
"http://mysite.com/john/mydir".
|
||||||
|
|
||||||
\docparam{base}{Base URI to inherit from. Must be a full URI and not a reference}
|
\docparam{base}{Base URI to inherit from. Must be a full URI and not a reference}
|
||||||
\docparam{bStrict}{If false, some compatability layers are enabled to allow
|
\docparam{flags}{Currently either \texttt{wxURI\_STRICT} or $0$, in non strict
|
||||||
loopholes from RFCs prior to 2396}
|
mode some compatability layers are enabled to allow loopholes from RFCs prior
|
||||||
|
to 2396}
|
||||||
|
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
// Licence: wxWindows
|
// Licence: wxWindows
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_URIH__
|
#ifndef _WX_URI_H_
|
||||||
#define _WX_URIH__
|
#define _WX_URI_H_
|
||||||
|
|
||||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||||
#pragma interface "uri.h"
|
#pragma interface "uri.h"
|
||||||
@@ -20,16 +20,16 @@
|
|||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
|
|
||||||
// Host Type that the server can be
|
// Host Type that the server can be
|
||||||
typedef enum
|
enum wxURIHostType
|
||||||
{
|
{
|
||||||
wxURI_REGNAME,
|
wxURI_REGNAME,
|
||||||
wxURI_IPV4ADDRESS,
|
wxURI_IPV4ADDRESS,
|
||||||
wxURI_IPV6ADDRESS,
|
wxURI_IPV6ADDRESS,
|
||||||
wxURI_IPVFUTURE
|
wxURI_IPVFUTURE
|
||||||
} wxURIHostType;
|
};
|
||||||
|
|
||||||
// Component Flags
|
// Component Flags
|
||||||
typedef enum
|
enum wxURIFieldType
|
||||||
{
|
{
|
||||||
wxURI_SCHEME = 1,
|
wxURI_SCHEME = 1,
|
||||||
wxURI_USER = 2,
|
wxURI_USER = 2,
|
||||||
@@ -38,7 +38,14 @@ typedef enum
|
|||||||
wxURI_PATH = 16,
|
wxURI_PATH = 16,
|
||||||
wxURI_QUERY = 32,
|
wxURI_QUERY = 32,
|
||||||
wxURI_FRAGMENT = 64
|
wxURI_FRAGMENT = 64
|
||||||
} wxURIFieldType;
|
};
|
||||||
|
|
||||||
|
// Miscellaneous other flags
|
||||||
|
enum wxURIFlags
|
||||||
|
{
|
||||||
|
wxURI_STRICT = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Generic class for parsing URIs.
|
// Generic class for parsing URIs.
|
||||||
//
|
//
|
||||||
@@ -52,7 +59,7 @@ public:
|
|||||||
wxURI(const wxString& uri);
|
wxURI(const wxString& uri);
|
||||||
wxURI(const wxURI& uri);
|
wxURI(const wxURI& uri);
|
||||||
|
|
||||||
~wxURI();
|
virtual ~wxURI();
|
||||||
|
|
||||||
void Create(const wxString& uri);
|
void Create(const wxString& uri);
|
||||||
|
|
||||||
@@ -75,7 +82,7 @@ public:
|
|||||||
|
|
||||||
wxString Get() const;
|
wxString Get() const;
|
||||||
|
|
||||||
void Resolve(const wxURI& base, const bool& bStrict = true);
|
void Resolve(const wxURI& base, int flags = wxURI_STRICT);
|
||||||
bool IsReference() const;
|
bool IsReference() const;
|
||||||
|
|
||||||
wxURI& operator = (const wxURI& uri);
|
wxURI& operator = (const wxURI& uri);
|
||||||
@@ -92,8 +99,9 @@ protected:
|
|||||||
const wxChar* ParseUser (const wxChar* uri);
|
const wxChar* ParseUser (const wxChar* uri);
|
||||||
const wxChar* ParseServer (const wxChar* uri);
|
const wxChar* ParseServer (const wxChar* uri);
|
||||||
const wxChar* ParsePort (const wxChar* uri);
|
const wxChar* ParsePort (const wxChar* uri);
|
||||||
const wxChar* ParsePath (const wxChar* uri, const bool& bReference = false,
|
const wxChar* ParsePath (const wxChar* uri,
|
||||||
const bool& bNormalize = true);
|
bool bReference = false,
|
||||||
|
bool bNormalize = true);
|
||||||
const wxChar* ParseQuery (const wxChar* uri);
|
const wxChar* ParseQuery (const wxChar* uri);
|
||||||
const wxChar* ParseFragment (const wxChar* uri);
|
const wxChar* ParseFragment (const wxChar* uri);
|
||||||
|
|
||||||
@@ -104,10 +112,10 @@ protected:
|
|||||||
static bool ParseIPvFuture(const wxChar*& uri);
|
static bool ParseIPvFuture(const wxChar*& uri);
|
||||||
|
|
||||||
|
|
||||||
static void Normalize(wxChar* uri, const bool& bIgnoreLeads = false);
|
static void Normalize(wxChar* uri, bool bIgnoreLeads = false);
|
||||||
static void UpTree(const wxChar* uristart, const wxChar*& uri);
|
static void UpTree(const wxChar* uristart, const wxChar*& uri);
|
||||||
|
|
||||||
static void Unescape(const wxChar*& s, wxChar& c);
|
static wxChar Unescape(const wxChar* s);
|
||||||
static void Escape (wxString& s, const wxChar& c);
|
static void Escape (wxString& s, const wxChar& c);
|
||||||
static bool IsEscape(const wxChar*& uri);
|
static bool IsEscape(const wxChar*& uri);
|
||||||
|
|
||||||
@@ -136,6 +144,7 @@ protected:
|
|||||||
size_t m_fields;
|
size_t m_fields;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxURI)
|
DECLARE_DYNAMIC_CLASS(wxURI)
|
||||||
};//end of wxURI
|
};
|
||||||
|
|
||||||
|
#endif // _WX_URI_H_
|
||||||
|
|
||||||
#endif //_WX_URIH__
|
|
||||||
|
@@ -109,10 +109,11 @@ void wxURI::Create(const wxString& uri)
|
|||||||
// if it does, then it moves the input string past the escape sequence
|
// if it does, then it moves the input string past the escape sequence
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxURI::Unescape(const wxChar*& s, wxChar& c)
|
wxChar wxURI::Unescape(const wxChar* s)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(IsHex(*s) && IsHex(*(s+1)), wxT("Invalid escape!"));
|
wxASSERT_MSG(IsHex(*s) && IsHex(*(s+1)), wxT("Invalid escape!"));
|
||||||
c = CharToHex(*s) * 0x10 + CharToHex(*++s);
|
|
||||||
|
return CharToHex(*s) * 0x10 + CharToHex(*++s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxURI::Escape(wxString& s, const wxChar& c)
|
void wxURI::Escape(wxString& s, const wxChar& c)
|
||||||
@@ -539,7 +540,7 @@ const wxChar* wxURI::ParsePort(const wxChar* uri)
|
|||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxChar* wxURI::ParsePath(const wxChar* uri, const bool& bReference, const bool& bNormalize)
|
const wxChar* wxURI::ParsePath(const wxChar* uri, bool bReference, bool bNormalize)
|
||||||
{
|
{
|
||||||
wxASSERT(uri != NULL);
|
wxASSERT(uri != NULL);
|
||||||
|
|
||||||
@@ -693,7 +694,7 @@ const wxChar* wxURI::ParseFragment(const wxChar* uri)
|
|||||||
// (it is shown in comments)
|
// (it is shown in comments)
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxURI::Resolve(const wxURI& base, const bool& bStrict)
|
void wxURI::Resolve(const wxURI& base, int flags)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(!base.IsReference(),
|
wxASSERT_MSG(!base.IsReference(),
|
||||||
wxT("wxURI to inherit from must not be a reference!"));
|
wxT("wxURI to inherit from must not be a reference!"));
|
||||||
@@ -702,9 +703,9 @@ void wxURI::Resolve(const wxURI& base, const bool& bStrict)
|
|||||||
// loophole that allows this uri to inherit other
|
// loophole that allows this uri to inherit other
|
||||||
// properties from the base uri - even if the scheme
|
// properties from the base uri - even if the scheme
|
||||||
// is defined
|
// is defined
|
||||||
if (!bStrict &&
|
if ( !(flags & wxURI_STRICT) &&
|
||||||
HasScheme() && base.HasScheme() &&
|
HasScheme() && base.HasScheme() &&
|
||||||
this->m_scheme == base.m_scheme )
|
m_scheme == base.m_scheme )
|
||||||
{
|
{
|
||||||
m_fields -= wxURI_SCHEME;
|
m_fields -= wxURI_SCHEME;
|
||||||
}
|
}
|
||||||
@@ -841,7 +842,7 @@ void wxURI::UpTree(const wxChar* uristart, const wxChar*& uri)
|
|||||||
//!!!//
|
//!!!//
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxURI::Normalize(wxChar* s, const bool& bIgnoreLeads)
|
void wxURI::Normalize(wxChar* s, bool bIgnoreLeads)
|
||||||
{
|
{
|
||||||
wxChar* cp = s;
|
wxChar* cp = s;
|
||||||
wxChar* bp = s;
|
wxChar* bp = s;
|
||||||
|
Reference in New Issue
Block a user