00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef EDGReplicaManager_URI_H
00012 #define EDGReplicaManager_URI_H 1
00013
00014
00015
00016
00017
00018
00019 #include <string>
00020 #include <deque>
00021
00022 #include "EdgReplicaManager/ReplicaManagerExceptions.h"
00023
00024 namespace EdgReplicaManager {
00025
00027 class URI {
00028 public:
00029
00033 URI(const std::string &uri) throw(URIException);
00034
00038 URI(const std::string &scheme,
00039 const std::string &ssp) throw(URIException);
00040
00044 URI(const std::string &scheme,
00045 const std::string &host,
00046 const std::string &path) throw(URIException);
00047
00051 URI(const std::string &scheme,
00052 const std::string &host,
00053 int port,
00054 const std::string &path) throw(URIException);
00055
00058 virtual ~URI() {}
00059
00064 std::string getHost() throw(URIException);
00065
00070 std::string getScheme();
00071
00076 std::string getSchemeSpecificPart();
00077
00082 std::string getPath() throw(URIException);
00083
00088 std::string toString();
00089
00090
00095 int getPort();
00096
00097 protected:
00098
00099 std::string m_scheme;
00100 std::string m_host;
00101 std::string m_path;
00102 std::string m_ssp;
00103 int m_port;
00104 std::string m_str;
00105
00106 bool m_haveHost;
00107 bool m_havePath;
00108
00109 private:
00110
00111
00112 URI();
00113
00114
00115 void validateScheme() throw(URIException);
00116 void validateSSP() throw(URIException);
00117 void validateHost() throw(URIException);
00118 void validatePath() throw(URIException);
00119
00120
00121 int getPort(std::string &port) throw(URIException);
00122 std::string hostPort();
00123 void checkForIllegalCharactersLazy(const std::string &str) throw(URIException);
00124 void checkForIllegalCharactersStrict(const std::string &str) throw(URIException);
00125 void normalizeHostPath(const std::string &path) throw(URIException);
00126 void doNormalize(std::deque<std::string> &dirs);
00127 std::string getPath(std::deque<std::string> &dirs);
00128 std::string normalizePath();
00129 void split(char c, const std::string &str, std::deque<std::string> &list);
00130
00131
00132 };
00133
00134 };
00135
00136 #endif