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 #if !defined(XMLURI_HPP)
00082 #define XMLURI_HPP
00083
00084 #include <xercesc/util/XercesDefs.hpp>
00085 #include <xercesc/util/XMLException.hpp>
00086 #include <xercesc/util/XMLUniDefs.hpp>
00087 #include <xercesc/util/XMLString.hpp>
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 class XMLUri
00099 {
00100 public:
00101
00102
00103
00104
00105
00131 XMLUri(const XMLCh* const uriSpec);
00132
00145 XMLUri(const XMLUri* const baseURI
00146 , const XMLCh* const uriSpec);
00147
00148 virtual ~XMLUri();
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00164 const XMLCh* getScheme() const;
00165
00171 const XMLCh* getUserInfo() const;
00172
00173
00179 const XMLCh* getHost() const;
00180
00186 int getPort() const;
00187
00194 const XMLCh* getPath() const;
00195
00203 const XMLCh* getQueryString() const;
00204
00212 const XMLCh* getFragment() const;
00213
00214
00215
00216
00217
00225 void setScheme(const XMLCh* const newScheme);
00226
00234 void setUserInfo(const XMLCh* const newUserInfo);
00235
00243 void setHost(const XMLCh* const newHost);
00244
00254 void setPort(int newPort);
00255
00276 void setPath(const XMLCh* const newPath);
00277
00286 void setQueryString(const XMLCh* const newQueryString);
00287
00296 void setFragment(const XMLCh* const newFragment);
00297
00298
00299
00300
00301
00302 private:
00303
00304 static const XMLCh RESERVED_CHARACTERS[];
00305 static const XMLCh MARK_CHARACTERS[];
00306 static const XMLCh SCHEME_CHARACTERS[];
00307 static const XMLCh USERINFO_CHARACTERS[];
00308
00312 XMLUri(const XMLUri& toCopy);
00313 XMLUri& operator=(const XMLUri& toAssign);
00314
00315
00316
00317
00318
00324 static bool isReservedCharacter(const XMLCh theChar);
00325
00331 static bool isUnreservedCharacter(const XMLCh theChar);
00332
00340 static bool isConformantSchemeName(const XMLCh* const scheme);
00341
00347 static void isConformantUserInfo(const XMLCh* const userInfo);
00348
00356 static bool isURIString(const XMLCh* const uric);
00357
00372 static bool isWellFormedAddress(const XMLCh* const addr);
00373
00381 bool isGenericURI();
00382
00383
00384
00385
00386
00392 void initialize(const XMLUri& toCopy);
00393
00408 void initialize(const XMLUri* const baseURI
00409 , const XMLCh* const uriSpec);
00410
00417 void initializeScheme(const XMLCh* const uriSpec);
00418
00426 void initializeAuthority(const XMLCh* const uriSpec);
00427
00434 void initializePath(const XMLCh* const uriSpec);
00435
00440 void cleanUp();
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451 XMLCh* fScheme;
00452 XMLCh* fUserInfo;
00453 XMLCh* fHost;
00454 int fPort;
00455 XMLCh* fPath;
00456 XMLCh* fQueryString;
00457 XMLCh* fFragment;
00458
00459 };
00460
00461
00462
00463
00464 inline const XMLCh* XMLUri::getScheme() const
00465 {
00466 return fScheme;
00467 }
00468
00469 inline const XMLCh* XMLUri::getUserInfo() const
00470 {
00471 return fUserInfo;
00472 }
00473
00474 inline const XMLCh* XMLUri::getHost() const
00475 {
00476 return fHost;
00477 }
00478
00479 inline int XMLUri::getPort() const
00480 {
00481 return fPort;
00482 }
00483
00484 inline const XMLCh* XMLUri::getPath() const
00485 {
00486 return fPath;
00487 }
00488
00489 inline const XMLCh* XMLUri::getQueryString() const
00490 {
00491 return fQueryString;
00492 }
00493
00494 inline const XMLCh* XMLUri::getFragment() const
00495 {
00496 return fFragment;
00497 }
00498
00499
00500
00501
00502 inline bool XMLUri::isReservedCharacter(const XMLCh theChar)
00503 {
00504 return (XMLString::indexOf(RESERVED_CHARACTERS, theChar) != -1);
00505 }
00506
00507 inline bool XMLUri::isUnreservedCharacter(const XMLCh theChar)
00508 {
00509 return (XMLString::isAlphaNum(theChar) ||
00510 XMLString::indexOf(MARK_CHARACTERS, theChar) != -1);
00511 }
00512
00513 #endif