00001 // 00002 // The Austria library is copyright (c) Gianni Mariani 2004. 00003 // 00004 // Grant Of License. Grants to LICENSEE the non-exclusive right to use the Austria 00005 // library subject to the terms of the LGPL. 00006 // 00007 // A copy of the license is available in this directory or one may be found at this URL: 00008 // http://www.gnu.org/copyleft/lesser.txt 00009 // 00010 // 00011 // 00012 // at_url_parse.h 00013 // 00014 // 00015 00016 #ifndef x_at_url_parse_h_x 00017 #define x_at_url_parse_h_x 00018 00019 #include "at_exports.h" 00020 #include <string> 00021 00022 // Austria namespace 00023 namespace at 00024 { 00025 00026 // ======== UrlString ============================================== 00036 class AUSTRIA_EXPORT UrlString 00037 : public std::string 00038 { 00039 public: 00040 00041 bool m_is_set; 00042 00043 UrlString( const std::string & i_string ) 00044 : std::string( i_string ), 00045 m_is_set( true ) 00046 { 00047 } 00048 00049 UrlString() 00050 : m_is_set( false ) 00051 { 00052 } 00053 00054 UrlString & assign( UrlString::const_iterator i1, UrlString::const_iterator i2 ) 00055 { 00056 m_is_set = true; 00057 std::string::assign( i1, i2 ); 00058 00059 return * this; 00060 } 00061 00062 UrlString & operator=( const std::string & i_str ) 00063 { 00064 m_is_set = true; 00065 std::string::assign( i_str ); 00066 00067 return * this; 00068 } 00069 00076 void UrlDecode(); 00077 00078 UrlString & assign_encoded( const std::string & i_str ) 00079 { 00080 * this = i_str; 00081 UrlDecode(); 00082 return * this; 00083 } 00084 00085 UrlString & assign_encoded( UrlString::const_iterator i1, UrlString::const_iterator i2 ) 00086 { 00087 assign( i1, i2 ); 00088 UrlDecode(); 00089 return * this; 00090 } 00091 00092 }; 00093 00094 00095 // ======== UrlParser ============================================ 00103 class AUSTRIA_EXPORT UrlParser 00104 { 00105 public: 00106 00107 UrlParser(); 00108 00109 UrlParser( 00110 const UrlString & i_url, 00111 std::string * o_error_message = 0 00112 ); 00113 00114 UrlParser( 00115 const char * i_url, 00116 std::string * o_error_message = 0 00117 ); 00118 00126 bool Parse( 00127 const UrlString & i_url, 00128 std::string * o_error_message = 0 00129 ); 00130 00131 bool Parse( 00132 const char * url, 00133 std::string * o_error_message = 0 00134 ); 00135 00136 00146 void CombineHostURL( const UrlParser & hosturl ); 00147 00148 00156 std::string WriteURL(); 00157 00158 enum { 00159 InitialDefaultPortNo = 80 00160 }; 00161 00162 UrlString m_scheme; 00163 UrlString m_host; 00164 UrlString m_port; 00165 UrlString m_user; 00166 UrlString m_pass; 00167 UrlString m_path; 00168 00169 UrlString m_parse_error; 00170 00171 00172 }; 00173 00174 }; // namespace 00175 00176 #endif // x_at_url_parse_h_x
Generated for Austria by
and
MakeXS at Sun Oct 24 17:35:34 PDT 2004