[Libreoffice-commits] online.git: wsd/SenderQueue.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Dec 19 05:58:23 UTC 2016
wsd/SenderQueue.hpp | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
New commits:
commit df79138bc3738ad9e744ed69395d6c89db0d5066
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Dec 18 13:29:45 2016 -0500
wsd: use Message members where possible
Change-Id: I7bcaa1306600b3e15bef7e7aff02a8a6cd64abf9
Reviewed-on: https://gerrit.libreoffice.org/32160
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/SenderQueue.hpp b/wsd/SenderQueue.hpp
index 912d66a..2864dae 100644
--- a/wsd/SenderQueue.hpp
+++ b/wsd/SenderQueue.hpp
@@ -33,6 +33,8 @@ public:
MessagePayload(const std::string& message) :
_data(message.data(), message.data() + message.size()),
_tokens(LOOLProtocol::tokenize(_data.data(), _data.size())),
+ _firstLine(LOOLProtocol::getFirstLine(_data.data(), _data.size())),
+ _abbreviation(LOOLProtocol::getAbbreviatedMessage(_data.data(), _data.size())),
_type(Type::Text)
{
}
@@ -45,6 +47,8 @@ public:
const size_t reserve = 0) :
_data(reserve),
_tokens(LOOLProtocol::tokenize(_data.data(), _data.size())),
+ _firstLine(LOOLProtocol::getFirstLine(_data.data(), _data.size())),
+ _abbreviation(LOOLProtocol::getAbbreviatedMessage(_data.data(), _data.size())),
_type(type)
{
_data.resize(message.size());
@@ -58,6 +62,8 @@ public:
const enum Type type) :
_data(data, data + size),
_tokens(LOOLProtocol::tokenize(_data.data(), _data.size())),
+ _firstLine(LOOLProtocol::getFirstLine(_data.data(), _data.size())),
+ _abbreviation(LOOLProtocol::getAbbreviatedMessage(_data.data(), _data.size())),
_type(type)
{
}
@@ -67,6 +73,8 @@ public:
const std::vector<std::string>& tokens() const { return _tokens; }
const std::string& firstToken() const { return _tokens[0]; }
+ const std::string& firstLine() const { return _firstLine; }
+ const std::string& abbreviation() const { return _abbreviation; }
/// Append more data to the message.
void append(const char* data, const size_t size)
@@ -82,6 +90,8 @@ public:
private:
std::vector<char> _data;
const std::vector<std::string> _tokens;
+ const std::string _firstLine;
+ const std::string _abbreviation;
const Type _type;
};
@@ -165,19 +175,17 @@ private:
/// enqueued, otherwise false.
bool deduplicate(const Item& item)
{
- const std::string line = LOOLProtocol::getFirstLine(item->data());
- const std::string command = LOOLProtocol::getFirstToken(line);
+ const std::string command = item->firstToken();
if (command == "tile:")
{
- TileDesc newTile = TileDesc::parse(line);
+ TileDesc newTile = TileDesc::parse(item->firstLine());
auto begin = std::remove_if(_queue.begin(), _queue.end(),
[&newTile](const queue_item_t& cur)
{
- const std::string curLine = LOOLProtocol::getFirstLine(cur->data());
- const std::string curCommand = LOOLProtocol::getFirstToken(curLine);
+ const std::string curCommand = cur->firstToken();
if (curCommand == "tile:")
{
- return (newTile == TileDesc::parse(curLine));
+ return (newTile == TileDesc::parse(cur->firstLine()));
}
return false;
More information about the Libreoffice-commits
mailing list