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 #if !defined(XMLURI_HPP)
00073 #define XMLURI_HPP
00074
00075 #include <util/XercesDefs.hpp>
00076 #include <util/XMLException.hpp>
00077 #include <util/XMLUniDefs.hpp>
00078 #include <util/XMLString.hpp>
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 class XMLUri
00090 {
00091 public:
00092
00093
00094
00095
00096
00122 XMLUri(const XMLCh* const uriSpec);
00123
00136 XMLUri(const XMLUri* const baseURI
00137 , const XMLCh* const uriSpec);
00138
00139 virtual ~XMLUri();
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00155 const XMLCh* getScheme() const;
00156
00162 const XMLCh* getUserInfo() const;
00163
00164
00170 const XMLCh* getHost() const;
00171
00177 int getPort() const;
00178
00185 const XMLCh* getPath() const;
00186
00194 const XMLCh* getQueryString() const;
00195
00203 const XMLCh* getFragment() const;
00204
00205
00206
00207
00208
00216 void setScheme(const XMLCh* const newScheme);
00217
00225 void setUserInfo(const XMLCh* const newUserInfo);
00226
00234 void setHost(const XMLCh* const newHost);
00235
00245 void setPort(int newPort);
00246
00267 void setPath(const XMLCh* const newPath);
00268
00277 void setQueryString(const XMLCh* const newQueryString);
00278
00287 void setFragment(const XMLCh* const newFragment);
00288
00289
00290
00291
00292
00293 private:
00294
00295 static const XMLCh RESERVED_CHARACTERS[];
00296 static const XMLCh MARK_CHARACTERS[];
00297 static const XMLCh SCHEME_CHARACTERS[];
00298 static const XMLCh USERINFO_CHARACTERS[];
00299
00303 XMLUri(const XMLUri& toCopy);
00304 XMLUri& operator=(const XMLUri& toAssign);
00305
00306
00307
00308
00309
00315 static bool isReservedCharacter(const XMLCh theChar);
00316
00322 static bool isUnreservedCharacter(const XMLCh theChar);
00323
00331 static bool isConformantSchemeName(const XMLCh* const scheme);
00332
00338 static void isConformantUserInfo(const XMLCh* const userInfo);
00339
00347 static bool isURIString(const XMLCh* const uric);
00348
00363 static bool isWellFormedAddress(const XMLCh* const addr);
00364
00372 bool isGenericURI();
00373
00374
00375
00376
00377
00383 void initialize(const XMLUri& toCopy);
00384
00399 void initialize(const XMLUri* const baseURI
00400 , const XMLCh* const uriSpec);
00401
00408 void initializeScheme(const XMLCh* const uriSpec);
00409
00417 void initializeAuthority(const XMLCh* const uriSpec);
00418
00425 void initializePath(const XMLCh* const uriSpec);
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436 XMLCh* fScheme;
00437 XMLCh* fUserInfo;
00438 XMLCh* fHost;
00439 int fPort;
00440 XMLCh* fPath;
00441 XMLCh* fQueryString;
00442 XMLCh* fFragment;
00443
00444 };
00445
00446
00447
00448
00449
00450
00451 inline XMLUri::XMLUri(const XMLCh* const uriSpec)
00452 :fScheme(0)
00453 ,fUserInfo(0)
00454 ,fHost(0)
00455 ,fPort(-1)
00456 ,fPath(0)
00457 ,fQueryString(0)
00458 ,fFragment(0)
00459 {
00460 initialize((XMLUri *)0, uriSpec);
00461 }
00462
00463
00464 inline XMLUri::XMLUri(const XMLUri* const baseURI
00465 , const XMLCh* const uriSpec)
00466 :fScheme(0)
00467 ,fUserInfo(0)
00468 ,fHost(0)
00469 ,fPort(-1)
00470 ,fPath(0)
00471 ,fQueryString(0)
00472 ,fFragment(0)
00473 {
00474 initialize(baseURI, uriSpec);
00475 }
00476
00477
00478
00479
00480 inline const XMLCh* XMLUri::getScheme() const
00481 {
00482 return fScheme;
00483 }
00484
00485 inline const XMLCh* XMLUri::getUserInfo() const
00486 {
00487 return fUserInfo;
00488 }
00489
00490 inline const XMLCh* XMLUri::getHost() const
00491 {
00492 return fHost;
00493 }
00494
00495 inline int XMLUri::getPort() const
00496 {
00497 return fPort;
00498 }
00499
00500 inline const XMLCh* XMLUri::getPath() const
00501 {
00502 return fPath;
00503 }
00504
00505 inline const XMLCh* XMLUri::getQueryString() const
00506 {
00507 return fQueryString;
00508 }
00509
00510 inline const XMLCh* XMLUri::getFragment() const
00511 {
00512 return fFragment;
00513 }
00514
00515
00516
00517
00518 inline bool XMLUri::isReservedCharacter(const XMLCh theChar)
00519 {
00520 return (XMLString::indexOf(RESERVED_CHARACTERS, theChar) != -1);
00521 }
00522
00523 inline bool XMLUri::isUnreservedCharacter(const XMLCh theChar)
00524 {
00525 return (XMLString::isAlphaNum(theChar) ||
00526 XMLString::indexOf(MARK_CHARACTERS, theChar) != -1);
00527 }
00528
00529 #endif