libmoost
|
00001 /* vim:set ts=3 sw=3 sts=3 et: */ 00037 #ifndef FM_LAST_MOOST_MURCL_URI_HPP__ 00038 #define FM_LAST_MOOST_MURCL_URI_HPP__ 00039 00040 #include <string> 00041 #include <sstream> 00042 00043 #include <curl/curl.h> 00044 00045 #include <boost/lexical_cast.hpp> 00046 00047 #include "uri_elements.hpp" 00048 00049 namespace moost { namespace murcl { 00050 00054 class uri 00055 { 00056 public: 00057 00064 uri(uri_elements const & elements) 00065 { 00066 std::ostringstream oss; 00067 oss 00068 << elements.get_scheme() 00069 << elements.get_host() 00070 << ':' << elements.get_port() 00071 << '/' << elements.get_path(); 00072 00073 if(!elements.get_params().empty()) 00074 { 00075 oss << "?" << elements.get_params(); 00076 } 00077 00078 uri_ = oss.str(); 00079 } 00080 00087 std::string const & get() const 00088 { 00089 return uri_; 00090 } 00091 00098 operator std::string const & () const 00099 { 00100 return get(); 00101 } 00102 00103 private: 00104 std::string uri_; 00105 }; 00106 00107 }} 00108 00109 00110 #endif // FM_LAST_MOOST_MURCL_URI_HPP__