diff --git a/alib2data/src/sax/FromXMLParserHelper.cpp b/alib2data/src/sax/FromXMLParserHelper.cpp index 0c6f33cdc5e141d6fbdade20a90a0e113be635bf..9622f077af300550e663ba222f3a0ff32ca592b9 100644 --- a/alib2data/src/sax/FromXMLParserHelper.cpp +++ b/alib2data/src/sax/FromXMLParserHelper.cpp @@ -28,7 +28,7 @@ void FromXMLParserHelper::popToken(std::deque<Token>& input, Token::TokenType ty std::string FromXMLParserHelper::popTokenData(std::deque<Token>& input, Token::TokenType type) { if(isTokenType(input, type)) { - std::string result = std::move(input.front().getData()); + std::string result = std::move(input.front()).getDataMove(); input.pop_front(); return std::move(result); } else { diff --git a/alib2data/src/sax/Token.cpp b/alib2data/src/sax/Token.cpp index b3c3aefc853df48b35869a13d851e51a78333f65..438783d986ae4ce584d49124da821c9b642164d9 100644 --- a/alib2data/src/sax/Token.cpp +++ b/alib2data/src/sax/Token.cpp @@ -7,6 +7,7 @@ #include "Token.h" #include <sstream> +#include <iostream> namespace sax { @@ -16,7 +17,7 @@ Token::Token(const std::string& data, const Token::TokenType type) : } Token::Token(std::string&& data, const Token::TokenType type) : - data(data), type(type) { + data(std::move(data)), type(type) { } @@ -24,6 +25,10 @@ const std::string& Token::getData() const { return data; } +std::string&& Token::getDataMove() && { + return std::move(data); +} + Token::TokenType Token::getType() const { return type; } diff --git a/alib2data/src/sax/Token.h b/alib2data/src/sax/Token.h index dba8b50f7e3b991e179c29651400678b192d203d..d6f455ebac04630e27812414f05d85bbea0f5d98 100644 --- a/alib2data/src/sax/Token.h +++ b/alib2data/src/sax/Token.h @@ -37,6 +37,11 @@ public: */ const std::string& getData() const; + /** + * @return name of the tag or characters read + */ + std::string&& getDataMove() &&; //TODO should be named getData only + /** * @return type of the token - star of the tag, end of the tag, attribute * of the tag or characters