mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
added move ctor and assignment
This commit is contained in:
parent
b55db12286
commit
aee64d6e17
@ -61,12 +61,18 @@ public:
|
||||
Token(const Token& token);
|
||||
/// Creates a JSON Web Token by copying another one.
|
||||
|
||||
Token(Token&& token) noexcept;
|
||||
/// Creates a JSON Web Token by moving another one.
|
||||
|
||||
~Token();
|
||||
/// Destroys the Token.
|
||||
|
||||
Token& operator = (const Token& token);
|
||||
/// Assignment operator.
|
||||
|
||||
Token& operator = (Token&& token) noexcept;
|
||||
/// Move assignment operator.
|
||||
|
||||
Token& operator = (const std::string& token);
|
||||
/// Parses and assigns serialized JWT.
|
||||
|
||||
|
@ -59,6 +59,14 @@ Token::Token(const Token& token):
|
||||
}
|
||||
|
||||
|
||||
Token::Token(Token&& token) noexcept:
|
||||
_pHeader(std::move(token._pHeader)),
|
||||
_pPayload(std::move(token._pPayload)),
|
||||
_signature(std::move(token._signature))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Token::Token(const std::string& header, const std::string& payload, const std::string& signature)
|
||||
{
|
||||
assign(header, payload, signature);
|
||||
@ -86,6 +94,16 @@ Token& Token::operator = (const Token& token)
|
||||
}
|
||||
|
||||
|
||||
Token& Token::operator = (Token&& token) noexcept
|
||||
{
|
||||
_pHeader = std::move(token._pHeader);
|
||||
_pPayload = std::move(token._pPayload);
|
||||
_signature = std::move(token._signature);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Token& Token::operator = (const std::string& token)
|
||||
{
|
||||
std::vector<std::string> parts = Serializer::split(token);
|
||||
|
Loading…
Reference in New Issue
Block a user