.. _program_listing_file_liberate_net_url.h: Program Listing for File url.h ============================== |exhale_lsh| :ref:`Return to documentation for file ` (``liberate/net/url.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * This file is part of liberate. * * Author(s): Jens Finkhaeuser * * Copyright (c) 2018-2021 Jens Finkhaeuser. * Copyright (c) 2022 Interpeer gUG (haftungsbeschränkt) * * SPDX-License-Identifier: GPL-3.0-only * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LIBERATE_NET_URL_H #define LIBERATE_NET_URL_H #ifndef __cplusplus #error You are trying to include a C++ only header file #endif #include #include #include #include namespace liberate::net { struct LIBERATE_API url : public ::liberate::cpp::comparison_operators { public: // Data members std::string scheme; std::string authority; std::string path; std::map query; std::string fragment; static url parse(char const * url_string); static url parse(std::string const & url_string); std::string str() const; void swap(url & other); size_t hash() const; private: friend struct liberate::cpp::comparison_operators; bool is_less_than(url const & other) const; bool is_equal_to(url const & other) const; friend LIBERATE_API_FRIEND std::ostream & operator<<(std::ostream & os, url const & data); }; LIBERATE_API std::ostream & operator<<(std::ostream & os, url const & data); inline void swap(url & first, url & second) { return first.swap(second); } } // namespace liberate::net /******************************************************************************* * std namespace specializations **/ namespace std { template <> struct LIBERATE_API hash<::liberate::net::url> { size_t operator()(::liberate::net::url const & x) const { return x.hash(); } }; } // namespace std #endif // guard