00001
00002
00003
00004
00005
00006
00007 #include <string>
00008 #include <iosfwd>
00009
00010 #include <saga/saga/util.hpp>
00011 #include <saga/saga/base.hpp>
00012 #include <saga/saga/call.hpp>
00013
00014 #include <saga/saga/object.hpp>
00015 #include <saga/saga/session.hpp>
00016
00017 #if !defined(SAGA_SAGA_URL_HPP)
00018 #define SAGA_SAGA_URL_HPP
00019
00020
00021 #if defined(BOOST_MSVC)
00022 #pragma warning(push)
00023 #pragma warning(disable: 4251 4231 4275 4660)
00024 #endif
00025
00027 namespace saga
00028 {
00037 class SAGA_EXPORT url
00038 : public saga::object
00039 {
00040 private:
00041 friend class saga::impl::url;
00042 friend struct saga::impl::runtime;
00043
00044 SAGA_CALL_CONST_PRIV_1(translate, std::string)
00045 SAGA_CALL_CONST_PRIV_2(translate, saga::session, std::string)
00046
00047 protected:
00049
00050 TR1::shared_ptr <impl::url> get_impl() const;
00051
00052 url (impl::url *impl);
00053
00054
00055 url (std::string const & urlstr, adaptors::nocheck);
00057
00058 public:
00059 url();
00060 explicit url (saga::object rhs);
00061 url(saga::url const& rhs);
00062 url(std::string const& urlstr);
00063 url(char const * urlstr);
00064 ~url(void);
00065
00066 url& operator=(char const * urlstr);
00067 url& operator=(std::string const & urlstr);
00068 url& operator=(saga::url const& rhs);
00069 url& operator=(saga::object const& rhs);
00070
00075 saga::object clone() const;
00076
00082 std::string get_string(void) const;
00083
00088 void set_string(std::string const & url);
00089
00095 std::string get_scheme (void) const;
00096
00101 void set_scheme (std::string const & scheme);
00102
00108 std::string get_host (void) const;
00109
00114 void set_host (std::string const & host);
00115
00121 int get_port (void) const;
00122
00127 void set_port (int port);
00128
00134 std::string get_fragment (void) const;
00135
00140 void set_fragment (std::string const & fragment);
00141
00147 std::string get_path (void) const;
00148
00153 void set_path (std::string const & path);
00154
00160 std::string get_userinfo (void) const;
00161
00166 void set_userinfo (std::string const & userinfo);
00167
00172 saga::url translate(std::string scheme) const
00173 {
00174 saga::task t = translatepriv(scheme, saga::task_base::Sync());
00175 return t.get_result<saga::url>();
00176 }
00177 SAGA_CALL_CONST_PUB_1_DEF_0(translate, std::string)
00178
00179
00183 saga::url translate(saga::session s, std::string scheme) const
00184 {
00185 saga::task t = translatepriv(s, scheme, saga::task_base::Sync());
00186 return t.get_result<saga::url>();
00187 }
00188 SAGA_CALL_CONST_PUB_2_DEF_0(translate, saga::session, std::string)
00189
00190
00191
00192
00194
00195
00200 std::string get_url (void) const;
00201
00206 void set_url(std::string const & url);
00207
00212 std::string get_authority (void) const;
00213
00218 std::string get_query (void) const;
00219
00224 void set_query (std::string const & query);
00225
00230 void set_scheme_specific_part (std::string const & scheme_specific_part);
00231
00236 std::string get_username (void) const;
00237
00242 void set_username (std::string const & username);
00243
00248 std::string get_password (void) const;
00249
00254 void set_password (std::string const & passwd);
00255
00259 static std::string unescape(std::string const&in);
00260
00263 static std::string escape(std::string const&in);
00264
00265 };
00266
00268
00272 SAGA_EXPORT std::ostream& operator<< (std::ostream& os, url const& u);
00273
00278 SAGA_EXPORT std::istream& operator>> (std::istream& is, url& u);
00279
00284 SAGA_EXPORT bool operator== (saga::url const& lhs, saga::url const& rhs);
00285
00290 SAGA_EXPORT bool operator< (saga::url const& lhs, saga::url const& rhs);
00291
00293 }
00294
00295
00296 #if defined(BOOST_MSVC)
00297 #pragma warning(pop)
00298 #endif
00299
00300 #endif // SAGA_SAGA_URL_HPP
00301