BBS2chProxyURL.h 1.1 KB

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