Commit 644d99cc authored by jan.koester's avatar jan.koester
Browse files

added compare

parent d3dc4e1e
Loading
Loading
Loading
Loading
+19 −0
Changes for src/http.cpp: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -109,6 +109,25 @@ bool libhttppp::HttpUrl::operator==(const HttpUrl& other) const {
                _path == other._path);
}

bool libhttppp::HttpUrl::operator<(const HttpUrl& other) const {
    if (_print.length() != other._print.length()) {
        return _print.length() < other._print.length();
    }

    if (_protocol != other._protocol) {
        return _protocol < other._protocol;
    }

    if (_host != other._host) {
        return _host < other._host;
    }

    if (_port != other._port) {
        return _port < other._port;
    }
    return _path < other._path;
}

const std::string & libhttppp::HttpUrl::print(){
  std::stringstream ss;
  if(_protocol==HTTP){
+1 −0
Changes for src/http.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ namespace libhttppp {
     ~HttpUrl();

     bool operator==(const HttpUrl& other) const;
     bool operator<(const HttpUrl& other) const;

     int getProtocol() const;
     const std::string &getHost() const;