00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _SWORD_NETWORK_URL_
00020 #define _SWORD_NETWORK_URL_
00021
00022 namespace sword {
00023
00025
00036 class SWORDDECL URL {
00037 public:
00039 URL();
00040
00042 URL(const std::string &url);
00043
00045 URL(const URL &url);
00046
00047 ~URL();
00048
00050 URL &operator=(const URL &url);
00051
00053
00057 void parse(const std::string &url, bool needAbsolute = false);
00058
00060
00064 void navigate(const std::string &move);
00065
00066
00067 std::string toString() const;
00068
00069 enum Scheme {
00070 http,
00071 ftp,
00072 nntp,
00073
00074 invalid
00075 };
00076
00078 bool empty() const;
00079
00081 const std::string &server() const;
00082
00084 const int port() const;
00085
00087 const std::string &pathname() const;
00088
00090 std::string path() const;
00091
00093 std::string filename() const;
00094
00096 Scheme scheme() const;
00097
00099 bool hasCredentials() const;
00100
00102
00103 const std::string &login() const;
00104
00106
00107 const std::string &password() const;
00108
00109 private:
00110
00111 bool empty_;
00112
00113 Scheme scheme_;
00114 std::string login_;
00115 std::string password_;
00116 std::string server_;
00117 int port_;
00118
00119 std::string pathname_;
00120 };
00121
00122 class UrlInvalidException : public Exception {};
00123
00124 }
00125
00126 #include "sword.private/network.Url.inl"
00127
00128 #endif // _SWORD_NETWORK_URL_