BBS2chProxyURL.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <string>
  3. class BBS2chProxyURL {
  4. private:
  5. std::string _scheme;
  6. std::string _host;
  7. std::string _auth;
  8. std::string _pathAndOthers;
  9. int _port;
  10. bool _dirty;
  11. std::string _absoluteURLString;
  12. public:
  13. BBS2chProxyURL() : _port(0), _dirty(true) {};
  14. BBS2chProxyURL(const char *url);
  15. BBS2chProxyURL(const char *scheme, const char *host);
  16. BBS2chProxyURL(const char *scheme, const char *host, int port, const char *path);
  17. BBS2chProxyURL(const BBS2chProxyURL &baseURL, const char *path);
  18. const std::string& absoluteString();
  19. const std::string& getScheme() const;
  20. const std::string& getHost() const;
  21. const std::string& getPathAndOthers() const;
  22. void setScheme(const std::string &scheme);
  23. void setPort(int port);
  24. bool isHttp() const;
  25. bool isValid() const;
  26. bool equals(const BBS2chProxyURL &url, bool ignoreHttpOrHttps = false) const;
  27. bool isKindOfHost(const std::string &hostSuffix) const;
  28. bool replaceHost(const std::string &fromHost, const std::string &toHost);
  29. bool isFamilyOf5chNet() const;
  30. bool pathStartsWith(const std::string &prefix) const;
  31. bool hostStartsWith(const std::string &prefix) const;
  32. };