123456789101112131415161718192021222324252627282930313233343536373839 |
- #pragma once
- #include <string>
- class BBS2chProxyURL {
- private:
- std::string _scheme;
- std::string _host;
- std::string _auth;
- std::string _pathAndOthers;
- int _port;
- bool _dirty;
- std::string _absoluteURLString;
- public:
- BBS2chProxyURL() : _port(0), _dirty(true) {};
- BBS2chProxyURL(const char *url);
- BBS2chProxyURL(const char *scheme, const char *host);
- BBS2chProxyURL(const char *scheme, const char *host, int port, const char *path);
- BBS2chProxyURL(const BBS2chProxyURL &baseURL, const char *path);
- const std::string& absoluteString();
- const std::string& getScheme() const;
- const std::string& getHost() const;
- const std::string& getPathAndOthers() const;
- std::string getPath() const;
- std::map<std::string, std::string> getQuery() const;
- int getPort() const;
- void setScheme(const std::string &scheme);
- void setPort(int port);
- bool isHttp() const;
- bool isValid() const;
- bool equalsTo(const BBS2chProxyURL &url, bool ignoreHttpOrHttps = false) const;
- bool isKindOfHost(const std::string &hostSuffix) const;
- bool replaceHost(const std::string &fromHost, const std::string &toHost);
- bool isFamilyOf5chNet() const;
- bool pathStartsWith(const std::string &prefix) const;
- bool pathEndsWith(const std::string &suffix) const;
- bool hostStartsWith(const std::string &prefix) const;
- int numberOfPathComponents() const;
- };
|