Created
November 30, 2019 04:03
-
-
Save vinniefalco/4b50b61d4110df84481fce94bf6fb272 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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