forked from arc/libarc-uri
123 lines
2.3 KiB
C++
123 lines
2.3 KiB
C++
#ifndef arc__uri__uri_hxx_
|
|
#define arc__uri__uri_hxx_
|
|
|
|
#include <arc/uri/export.hxx>
|
|
#include <arc/uri/grammar.hxx>
|
|
|
|
#include <optional>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
namespace arc::uri
|
|
{
|
|
|
|
class LIBARC_URI_SYMEXPORT uri_t
|
|
{
|
|
public:
|
|
uri_t();
|
|
|
|
uri_t(std::string, std::string, std::string);
|
|
|
|
uri_t(std::string, std::string, std::string, std::string);
|
|
|
|
uri_t(std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string);
|
|
|
|
uri_t(std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string);
|
|
|
|
uri_t(std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string,
|
|
std::string);
|
|
|
|
uri_t(std::optional<std::string>,
|
|
std::optional<std::string>,
|
|
std::optional<std::string>,
|
|
std::optional<std::string>,
|
|
std::string,
|
|
std::optional<std::string>,
|
|
std::optional<std::string>);
|
|
|
|
std::optional<std::string> const&
|
|
scheme() const;
|
|
|
|
std::string
|
|
scheme_str() const;
|
|
|
|
std::optional<std::string> const&
|
|
userinfo() const;
|
|
|
|
std::string
|
|
userinfo_str() const;
|
|
|
|
std::optional<std::string> const&
|
|
host() const;
|
|
|
|
std::string
|
|
host_str() const;
|
|
|
|
std::optional<std::string> const&
|
|
port() const;
|
|
|
|
std::string
|
|
port_str() const;
|
|
|
|
std::string
|
|
path_str() const;
|
|
|
|
std::optional<std::string> const&
|
|
query() const;
|
|
|
|
std::string
|
|
query_str() const;
|
|
|
|
std::optional<std::string> const&
|
|
fragment() const;
|
|
|
|
std::string
|
|
fragment_str() const;
|
|
|
|
private:
|
|
std::optional<std::string> scheme_;
|
|
std::optional<std::string> userinfo_;
|
|
std::optional<std::string> host_;
|
|
std::optional<std::string> port_;
|
|
std::string path_;
|
|
std::optional<std::string> query_;
|
|
std::optional<std::string> fragment_;
|
|
|
|
};
|
|
|
|
LIBARC_URI_SYMEXPORT
|
|
std::string
|
|
to_string(uri_t const&);
|
|
|
|
LIBARC_URI_SYMEXPORT
|
|
uri_t
|
|
normalize_path(uri_t const&);
|
|
|
|
template<typename Iterator>
|
|
std::optional<uri_t>
|
|
try_parse(Iterator first, Iterator last);
|
|
|
|
LIBARC_URI_SYMEXPORT
|
|
std::optional<uri_t>
|
|
try_parse(std::string const&);
|
|
|
|
} // namespace arc::uri
|
|
|
|
#include <arc/uri/uri.txx>
|
|
|
|
#endif
|