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
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 #if !defined(XMLURI_HPP)
00094 #define XMLURI_HPP
00095
00096 #include <xercesc/util/XercesDefs.hpp>
00097 #include <xercesc/util/XMLException.hpp>
00098 #include <xercesc/util/XMLUniDefs.hpp>
00099 #include <xercesc/util/XMLString.hpp>
00100
00101 XERCES_CPP_NAMESPACE_BEGIN
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 class XMLUri
00113 {
00114 public:
00115
00116
00117
00118
00119
00145 XMLUri(const XMLCh* const uriSpec);
00146
00159 XMLUri(const XMLUri* const baseURI
00160 , const XMLCh* const uriSpec);
00161
00165 XMLUri(const XMLUri& toCopy);
00166 XMLUri& operator=(const XMLUri& toAssign);
00167
00168 virtual ~XMLUri();
00169
00170
00171
00172
00178 const XMLCh* getUriText() const;
00179
00185 const XMLCh* getScheme() const;
00186
00192 const XMLCh* getUserInfo() const;
00193
00194
00200 const XMLCh* getHost() const;
00201
00207 int getPort() const;
00208
00215 const XMLCh* getPath() const;
00216
00224 const XMLCh* getQueryString() const;
00225
00233 const XMLCh* getFragment() const;
00234
00235
00236
00237
00238
00246 void setScheme(const XMLCh* const newScheme);
00247
00255 void setUserInfo(const XMLCh* const newUserInfo);
00256
00264 void setHost(const XMLCh* const newHost);
00265
00275 void setPort(int newPort);
00276
00297 void setPath(const XMLCh* const newPath);
00298
00307 void setQueryString(const XMLCh* const newQueryString);
00308
00317 void setFragment(const XMLCh* const newFragment);
00318
00319
00320
00321
00322
00330 static bool isURIString(const XMLCh* const uric);
00331
00332
00333 private:
00334
00335 static const XMLCh RESERVED_CHARACTERS[];
00336 static const XMLCh MARK_CHARACTERS[];
00337 static const XMLCh SCHEME_CHARACTERS[];
00338 static const XMLCh USERINFO_CHARACTERS[];
00339
00340
00341 void buildFullText();
00342
00343
00344
00345
00346
00352 static bool isReservedCharacter(const XMLCh theChar);
00353
00359 static bool isUnreservedCharacter(const XMLCh theChar);
00360
00368 static bool isConformantSchemeName(const XMLCh* const scheme);
00369
00375 static void isConformantUserInfo(const XMLCh* const userInfo);
00390 static bool isWellFormedAddress(const XMLCh* const addr);
00391
00399 bool isGenericURI();
00400
00401
00402
00403
00404
00410 void initialize(const XMLUri& toCopy);
00411
00426 void initialize(const XMLUri* const baseURI
00427 , const XMLCh* const uriSpec);
00428
00435 void initializeScheme(const XMLCh* const uriSpec);
00436
00444 void initializeAuthority(const XMLCh* const uriSpec);
00445
00452 void initializePath(const XMLCh* const uriSpec);
00453
00458 void cleanUp();
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469 XMLCh* fScheme;
00470 XMLCh* fUserInfo;
00471 XMLCh* fHost;
00472 int fPort;
00473 XMLCh* fPath;
00474 XMLCh* fQueryString;
00475 XMLCh* fFragment;
00476 XMLCh* fURIText;
00477
00478 };
00479
00480
00481
00482
00483 inline const XMLCh* XMLUri::getScheme() const
00484 {
00485 return fScheme;
00486 }
00487
00488 inline const XMLCh* XMLUri::getUserInfo() const
00489 {
00490 return fUserInfo;
00491 }
00492
00493 inline const XMLCh* XMLUri::getHost() const
00494 {
00495 return fHost;
00496 }
00497
00498 inline int XMLUri::getPort() const
00499 {
00500 return fPort;
00501 }
00502
00503 inline const XMLCh* XMLUri::getPath() const
00504 {
00505 return fPath;
00506 }
00507
00508 inline const XMLCh* XMLUri::getQueryString() const
00509 {
00510 return fQueryString;
00511 }
00512
00513 inline const XMLCh* XMLUri::getFragment() const
00514 {
00515 return fFragment;
00516 }
00517
00518 inline const XMLCh* XMLUri::getUriText() const
00519 {
00520
00521
00522
00523
00524
00525 if (!fURIText)
00526 ((XMLUri*)this)->buildFullText();
00527
00528 return fURIText;
00529 }
00530
00531
00532
00533
00534 inline bool XMLUri::isReservedCharacter(const XMLCh theChar)
00535 {
00536 return (XMLString::indexOf(RESERVED_CHARACTERS, theChar) != -1);
00537 }
00538
00539 inline bool XMLUri::isUnreservedCharacter(const XMLCh theChar)
00540 {
00541 return (XMLString::isAlphaNum(theChar) ||
00542 XMLString::indexOf(MARK_CHARACTERS, theChar) != -1);
00543 }
00544
00545 XERCES_CPP_NAMESPACE_END
00546
00547 #endif