wsd: MessagePayload -> Message

Change-Id: Ie65f7c707785dbbf85a2f98abf082fbc3ee7a64b
Reviewed-on: https://gerrit.libreoffice.org/33428
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian
2017-01-21 19:51:02 -05:00
committed by Ashod Nakashian
parent 6b17f96318
commit f1de0d0481
8 changed files with 47 additions and 45 deletions

View File

@ -14,8 +14,10 @@
#include <string>
#include <vector>
#include "Protocol.hpp"
/// The payload type used to send/receive data.
class MessagePayload
class Message
{
public:
@ -24,9 +26,9 @@ public:
/// Construct a text message.
/// message must include the full first-line.
MessagePayload(const std::string& message,
const enum Dir dir,
const enum Type type = Type::Text) :
Message(const std::string& message,
const enum Dir dir,
const enum Type type = Type::Text) :
_data(message.data(), message.data() + message.size()),
_tokens(LOOLProtocol::tokenize(_data.data(), _data.size())),
_id(makeId(dir)),
@ -39,10 +41,10 @@ public:
/// Construct a message from a string with type and
/// reserve extra space (total, including message).
/// message must include the full first-line.
MessagePayload(const std::string& message,
const enum Dir dir,
const enum Type type,
const size_t reserve) :
Message(const std::string& message,
const enum Dir dir,
const enum Type type,
const size_t reserve) :
_data(std::max(reserve, message.size())),
_tokens(LOOLProtocol::tokenize(message)),
_id(makeId(dir)),
@ -55,11 +57,11 @@ public:
}
/// Construct a message from a character array with type.
/// data must be include the full first-line.
MessagePayload(const char* p,
const size_t len,
const enum Dir dir,
const enum Type type) :
/// Note: p must include the full first-line.
Message(const char* p,
const size_t len,
const enum Dir dir,
const enum Type type) :
_data(p, p + len),
_tokens(LOOLProtocol::tokenize(_data.data(), _data.size())),
_id(makeId(dir)),