hurl.h 756 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef HV_URL_H_
  2. #define HV_URL_H_
  3. #include <string> // import std::string
  4. #include "hexport.h"
  5. class HV_EXPORT HUrl {
  6. public:
  7. static std::string escape(const std::string& str, const char* unescaped_chars = "");
  8. static std::string unescape(const std::string& str);
  9. static inline std::string escapeUrl(const std::string& url) {
  10. return escape(url, ":/@?=&#+");
  11. }
  12. HUrl() : port(0) {}
  13. ~HUrl() {}
  14. void reset();
  15. bool parse(const std::string& url);
  16. const std::string& dump();
  17. std::string url;
  18. std::string scheme;
  19. std::string username;
  20. std::string password;
  21. std::string host;
  22. int port;
  23. std::string path;
  24. std::string query;
  25. std::string fragment;
  26. };
  27. #endif // HV_URL_H_