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
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #if !defined(XMLURI_HPP)
00079 #define XMLURI_HPP
00080
00081 #include <xercesc/util/XercesDefs.hpp>
00082 #include <xercesc/util/XMLException.hpp>
00083 #include <xercesc/util/XMLUniDefs.hpp>
00084 #include <xercesc/util/XMLString.hpp>
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 class XMLUri
00096 {
00097 public:
00098
00099
00100
00101
00102
00128 XMLUri(const XMLCh* const uriSpec);
00129
00142 XMLUri(const XMLUri* const baseURI
00143 , const XMLCh* const uriSpec);
00144
00145 virtual ~XMLUri();
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00161 const XMLCh* getScheme() const;
00162
00168 const XMLCh* getUserInfo() const;
00169
00170
00176 const XMLCh* getHost() const;
00177
00183 int getPort() const;
00184
00191 const XMLCh* getPath() const;
00192
00200 const XMLCh* getQueryString() const;
00201
00209 const XMLCh* getFragment() const;
00210
00211
00212
00213
00214
00222 void setScheme(const XMLCh* const newScheme);
00223
00231 void setUserInfo(const XMLCh* const newUserInfo);
00232
00240 void setHost(const XMLCh* const newHost);
00241
00251 void setPort(int newPort);
00252
00273 void setPath(const XMLCh* const newPath);
00274
00283 void setQueryString(const XMLCh* const newQueryString);
00284
00293 void setFragment(const XMLCh* const newFragment);
00294
00295
00296
00297
00298
00299 private:
00300
00301 static const XMLCh RESERVED_CHARACTERS[];
00302 static const XMLCh MARK_CHARACTERS[];
00303 static const XMLCh SCHEME_CHARACTERS[];
00304 static const XMLCh USERINFO_CHARACTERS[];
00305
00309 XMLUri(const XMLUri& toCopy);
00310 XMLUri& operator=(const XMLUri& toAssign);
00311
00312
00313
00314
00315
00321 static bool isReservedCharacter(const XMLCh theChar);
00322
00328 static bool isUnreservedCharacter(const XMLCh theChar);
00329
00337 static bool isConformantSchemeName(const XMLCh* const scheme);
00338
00344 static void isConformantUserInfo(const XMLCh* const userInfo);
00345
00353 static bool isURIString(const XMLCh* const uric);
00354
00369 static bool isWellFormedAddress(const XMLCh* const addr);
00370
00378 bool isGenericURI();
00379
00380
00381
00382
00383
00389 void initialize(const XMLUri& toCopy);
00390
00405 void initialize(const XMLUri* const baseURI
00406 , const XMLCh* const uriSpec);
00407
00414 void initializeScheme(const XMLCh* const uriSpec);
00415
00423 void initializeAuthority(const XMLCh* const uriSpec);
00424
00431 void initializePath(const XMLCh* const uriSpec);
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442 XMLCh* fScheme;
00443 XMLCh* fUserInfo;
00444 XMLCh* fHost;
00445 int fPort;
00446 XMLCh* fPath;
00447 XMLCh* fQueryString;
00448 XMLCh* fFragment;
00449
00450 };
00451
00452
00453
00454
00455
00456
00457 inline XMLUri::XMLUri(const XMLCh* const uriSpec)
00458 :fScheme(0)
00459 ,fUserInfo(0)
00460 ,fHost(0)
00461 ,fPort(-1)
00462 ,fPath(0)
00463 ,fQueryString(0)
00464 ,fFragment(0)
00465 {
00466 initialize((XMLUri *)0, uriSpec);
00467 }
00468
00469
00470 inline XMLUri::XMLUri(const XMLUri* const baseURI
00471 , const XMLCh* const uriSpec)
00472 :fScheme(0)
00473 ,fUserInfo(0)
00474 ,fHost(0)
00475 ,fPort(-1)
00476 ,fPath(0)
00477 ,fQueryString(0)
00478 ,fFragment(0)
00479 {
00480 initialize(baseURI, uriSpec);
00481 }
00482
00483
00484
00485
00486 inline const XMLCh* XMLUri::getScheme() const
00487 {
00488 return fScheme;
00489 }
00490
00491 inline const XMLCh* XMLUri::getUserInfo() const
00492 {
00493 return fUserInfo;
00494 }
00495
00496 inline const XMLCh* XMLUri::getHost() const
00497 {
00498 return fHost;
00499 }
00500
00501 inline int XMLUri::getPort() const
00502 {
00503 return fPort;
00504 }
00505
00506 inline const XMLCh* XMLUri::getPath() const
00507 {
00508 return fPath;
00509 }
00510
00511 inline const XMLCh* XMLUri::getQueryString() const
00512 {
00513 return fQueryString;
00514 }
00515
00516 inline const XMLCh* XMLUri::getFragment() const
00517 {
00518 return fFragment;
00519 }
00520
00521
00522
00523
00524 inline bool XMLUri::isReservedCharacter(const XMLCh theChar)
00525 {
00526 return (XMLString::indexOf(RESERVED_CHARACTERS, theChar) != -1);
00527 }
00528
00529 inline bool XMLUri::isUnreservedCharacter(const XMLCh theChar)
00530 {
00531 return (XMLString::isAlphaNum(theChar) ||
00532 XMLString::indexOf(MARK_CHARACTERS, theChar) != -1);
00533 }
00534
00535 #endif