Skip to content

Instantly share code, notes, and snippets.

@vinniefalco
Created November 30, 2019 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinniefalco/069e51b256829850eea54fa82522b2be to your computer and use it in GitHub Desktop.
Save vinniefalco/069e51b256829850eea54fa82522b2be to your computer and use it in GitHub Desktop.
//
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/vinniefalco/url
//
#ifndef BOOST_URL_STRING_HPP
#define BOOST_URL_STRING_HPP
#include <boost/url/config.hpp>
namespace boost {
namespace url {
class encoded
{
string_view str_;
public:
explicit
encoded(string_view s)
: str_(s)
{
}
string_view
get() const noexcept
{
return str_;
}
};
class decoded
{
string_view str_;
public:
explicit
decoded(string_view s)
: str_(s)
{
}
string_view
get() const noexcept
{
return str_;
}
};
class string_param
{
string_view str_;
bool encoded_;
public:
string_param(
string_view s)
: str_(s)
, encoded_(false)
{
}
string_param(
decoded s)
: string_param(s.get())
{
}
string_param(
encoded s)
: str_(s.get())
, encoded_(true)
{
}
bool
is_encoded() const noexcept
{
return encoded_;
}
string_view
get() const noexcept
{
return str_;
}
};
} // url
} // boost
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment