]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/uri.h
a2a16b242182b50c782e5dfda9001d9b8b369a5b
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxURI - Class for parsing URIs
9 /////////////////////////////////////////////////////////////////////////////
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "uri.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
22 // Host Type that the server component can be
25 wxURI_REGNAME
, // Host is a normal register name (www.mysite.com etc.)
26 wxURI_IPV4ADDRESS
, // Host is a version 4 ip address (192.168.1.100)
27 wxURI_IPV6ADDRESS
, // Host is a version 6 ip address [aa:aa:aa:aa::aa:aa]:5050
28 wxURI_IPVFUTURE
// Host is a future ip address (wxURI is unsure what kind)
43 // Miscellaneous other flags
50 // Generic class for parsing URIs.
52 // Originally based off of RFC 2396 - then
53 // extended to meet the newer RFC 2396.bis
55 class WXDLLIMPEXP_BASE wxURI
: public wxObject
59 wxURI(const wxString
& uri
);
60 wxURI(const wxURI
& uri
);
64 const wxChar
* Create(const wxString
& uri
);
66 bool HasScheme() const { return (m_fields
& wxURI_SCHEME
) == wxURI_SCHEME
; }
67 bool HasUserInfo() const { return (m_fields
& wxURI_USERINFO
) == wxURI_USERINFO
; }
68 bool HasServer() const { return (m_fields
& wxURI_SERVER
) == wxURI_SERVER
; }
69 bool HasPort() const { return (m_fields
& wxURI_PORT
) == wxURI_PORT
; }
70 bool HasPath() const { return (m_fields
& wxURI_PATH
) == wxURI_PATH
; }
71 bool HasQuery() const { return (m_fields
& wxURI_QUERY
) == wxURI_QUERY
; }
72 bool HasFragment() const { return (m_fields
& wxURI_FRAGMENT
) == wxURI_FRAGMENT
; }
74 const wxString
& GetScheme() const { return m_scheme
; }
75 const wxString
& GetPath() const { return m_path
; }
76 const wxString
& GetQuery() const { return m_query
; }
77 const wxString
& GetFragment() const { return m_fragment
; }
78 const wxString
& GetPort() const { return m_port
; }
79 const wxString
& GetUserInfo() const { return m_userinfo
; }
80 const wxString
& GetServer() const { return m_server
; }
81 const wxURIHostType
& GetHostType() const { return m_hostType
; }
83 //Note that the following two get functions are explicitly depreciated by RFC 2396
84 wxString
GetUser() const;
85 wxString
GetPassword() const;
87 wxString
BuildURI() const;
88 wxString
BuildUnescapedURI() const;
90 void Resolve(const wxURI
& base
, int flags
= wxURI_STRICT
);
91 bool IsReference() const;
93 wxURI
& operator = (const wxURI
& uri
);
94 wxURI
& operator = (const wxString
& string
);
95 bool operator == (const wxURI
& uri
) const;
97 static wxString
Unescape (const wxString
& szEscapedURI
);
100 wxURI
& Assign(const wxURI
& uri
);
104 const wxChar
* Parse (const wxChar
* uri
);
105 const wxChar
* ParseAuthority (const wxChar
* uri
);
106 const wxChar
* ParseScheme (const wxChar
* uri
);
107 const wxChar
* ParseUserInfo (const wxChar
* uri
);
108 const wxChar
* ParseServer (const wxChar
* uri
);
109 const wxChar
* ParsePort (const wxChar
* uri
);
110 const wxChar
* ParsePath (const wxChar
* uri
,
111 bool bReference
= false,
112 bool bNormalize
= true);
113 const wxChar
* ParseQuery (const wxChar
* uri
);
114 const wxChar
* ParseFragment (const wxChar
* uri
);
117 static bool ParseH16(const wxChar
*& uri
);
118 static bool ParseIPv4address(const wxChar
*& uri
);
119 static bool ParseIPv6address(const wxChar
*& uri
);
120 static bool ParseIPvFuture(const wxChar
*& uri
);
122 static void Normalize(wxChar
* uri
, bool bIgnoreLeads
= false);
123 static void UpTree(const wxChar
* uristart
, const wxChar
*& uri
);
125 static wxChar
TranslateEscape(const wxChar
* s
);
126 static void Escape (wxString
& s
, const wxChar
& c
);
127 static bool IsEscape(const wxChar
*& uri
);
129 static wxChar
CharToHex(const wxChar
& c
);
131 static bool IsUnreserved (const wxChar
& c
);
132 static bool IsReserved (const wxChar
& c
);
133 static bool IsGenDelim (const wxChar
& c
);
134 static bool IsSubDelim (const wxChar
& c
);
135 static bool IsHex(const wxChar
& c
);
136 static bool IsAlpha(const wxChar
& c
);
137 static bool IsDigit(const wxChar
& c
);
148 wxURIHostType m_hostType
;
152 DECLARE_DYNAMIC_CLASS(wxURI
)