00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #if !defined(XMLURL_HPP)
00062 #define XMLURL_HPP
00063
00064 #include <xercesc/util/XercesDefs.hpp>
00065 #include <xercesc/util/XMLException.hpp>
00066
00067 XERCES_CPP_NAMESPACE_BEGIN
00068
00069 class BinInputStream;
00070
00071
00072
00073
00074
00075 class XMLURL
00076 {
00077 public:
00078
00079
00080
00081
00082
00083
00084 enum Protocols
00085 {
00086 File
00087 , HTTP
00088 , FTP
00089
00090 , Protocols_Count
00091 , Unknown
00092 };
00093
00094
00095
00096
00097
00098 static Protocols lookupByName(const XMLCh* const protoName);
00099
00100
00101
00102
00103
00104 XMLURL();
00105 XMLURL
00106 (
00107 const XMLCh* const baseURL
00108 , const XMLCh* const relativeURL
00109 );
00110 XMLURL
00111 (
00112 const XMLCh* const baseURL
00113 , const char* const relativeURL
00114 );
00115 XMLURL
00116 (
00117 const XMLURL& baseURL
00118 , const XMLCh* const relativeURL
00119 );
00120 XMLURL
00121 (
00122 const XMLURL& baseURL
00123 , const char* const relativeURL
00124 );
00125 XMLURL
00126 (
00127 const XMLCh* const urlText
00128 );
00129 XMLURL
00130 (
00131 const char* const urlText
00132 );
00133 XMLURL(const XMLURL& toCopy);
00134 virtual ~XMLURL();
00135
00136
00137
00138
00139
00140 XMLURL& operator=(const XMLURL& toAssign);
00141 bool operator==(const XMLURL& toCompare) const;
00142 bool operator!=(const XMLURL& toCompare) const;
00143
00144
00145
00146
00147
00148 const XMLCh* getFragment() const;
00149 const XMLCh* getHost() const;
00150 const XMLCh* getPassword() const;
00151 const XMLCh* getPath() const;
00152 unsigned int getPortNum() const;
00153 Protocols getProtocol() const;
00154 const XMLCh* getProtocolName() const;
00155 const XMLCh* getQuery() const;
00156 const XMLCh* getURLText() const;
00157 const XMLCh* getUser() const;
00158
00159
00160
00161
00162
00163 void setURL(const XMLCh* const urlText);
00164 void setURL
00165 (
00166 const XMLCh* const baseURL
00167 , const XMLCh* const relativeURL
00168 );
00169 void setURL
00170 (
00171 const XMLURL& baseURL
00172 , const XMLCh* const relativeURL
00173 );
00174
00175
00176
00177
00178
00179 bool isRelative() const;
00180 bool hasInvalidChar() const;
00181 BinInputStream* makeNewStream() const;
00182 void makeRelativeTo(const XMLCh* const baseURLText);
00183 void makeRelativeTo(const XMLURL& baseURL);
00184
00185
00186 private:
00187
00188
00189
00190 void buildFullText();
00191 void cleanup();
00192 bool conglomerateWithBase(const XMLURL& baseURL, bool useExceptions=true);
00193 void parse
00194 (
00195 const XMLCh* const urlText
00196 );
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239 XMLCh* fFragment;
00240 XMLCh* fHost;
00241 XMLCh* fPassword;
00242 XMLCh* fPath;
00243 unsigned int fPortNum;
00244 Protocols fProtocol;
00245 XMLCh* fQuery;
00246 XMLCh* fUser;
00247 XMLCh* fURLText;
00248 bool fHasInvalidChar;
00249 };
00250
00251
00252
00253
00254
00255 inline bool XMLURL::operator!=(const XMLURL& toCompare) const
00256 {
00257 return !operator==(toCompare);
00258 }
00259
00260
00261
00262
00263
00264 inline const XMLCh* XMLURL::getFragment() const
00265 {
00266 return fFragment;
00267 }
00268
00269 inline const XMLCh* XMLURL::getHost() const
00270 {
00271 return fHost;
00272 }
00273
00274 inline const XMLCh* XMLURL::getPassword() const
00275 {
00276 return fPassword;
00277 }
00278
00279 inline const XMLCh* XMLURL::getPath() const
00280 {
00281 return fPath;
00282 }
00283
00284 inline XMLURL::Protocols XMLURL::getProtocol() const
00285 {
00286 return fProtocol;
00287 }
00288
00289 inline const XMLCh* XMLURL::getQuery() const
00290 {
00291 return fQuery;
00292 }
00293
00294 inline const XMLCh* XMLURL::getUser() const
00295 {
00296 return fUser;
00297 }
00298
00299 inline const XMLCh* XMLURL::getURLText() const
00300 {
00301
00302
00303
00304
00305
00306 if (!fURLText)
00307 ((XMLURL*)this)->buildFullText();
00308
00309 return fURLText;
00310 }
00311
00312 MakeXMLException(MalformedURLException, )
00313
00314 XERCES_CPP_NAMESPACE_END
00315
00316
00317 #endif