Skip to content

Instantly share code, notes, and snippets.

@vinniefalco
Created November 30, 2019 04:03
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/4b50b61d4110df84481fce94bf6fb272 to your computer and use it in GitHub Desktop.
Save vinniefalco/4b50b61d4110df84481fce94bf6fb272 to your computer and use it in GitHub Desktop.
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_;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment