1
0

hurl.h 970 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. bool parse(const std::string& url);
  15. const std::string& dump();
  16. void reset() {
  17. url.clear();
  18. scheme.clear();
  19. username.clear();
  20. password.clear();
  21. host.clear();
  22. port = 0;
  23. path.clear();
  24. query.clear();
  25. fragment.clear();
  26. }
  27. std::string url;
  28. std::string scheme;
  29. std::string username;
  30. std::string password;
  31. std::string host;
  32. int port;
  33. std::string path;
  34. std::string query;
  35. std::string fragment;
  36. };
  37. #endif // HV_URL_H_