/* */ #ifndef D_URI_H #define D_URI_H #include "common.h" #include #include "uri_split.h" namespace aria2 { namespace uri { struct UriStruct { std::string protocol; std::string host; uint16_t port; std::string dir; std::string file; std::string query; std::string username; std::string password; bool hasPassword; bool ipv6LiteralAddress; UriStruct(); UriStruct(const UriStruct& c); ~UriStruct(); UriStruct& operator=(const UriStruct& c); void swap(UriStruct& other); }; void swap(UriStruct& lhs, UriStruct& rhs); // Splits URI uri into components and stores them into result. On // success returns true. Otherwise returns false and result is // undefined. bool parse(UriStruct& result, const std::string& uri); // Returns string specified by field in res. The base pointer in res // is given as base. If the given field is not stored in res, returns // empty string. std::string getFieldString(const uri_split_result& res, int field, const char* base); std::string construct(const UriStruct& us); std::string joinUri(const std::string& baseUri, const std::string& uri); } // namespace uri } // namespace aria2 #endif // D_URI_H