add MessageData copy constructor for current message
This commit is contained in:
@@ -45,22 +45,22 @@ static int defaultColor = 6;
|
|||||||
static std::vector<uint8_t> ParseMessageToData(string str);
|
static std::vector<uint8_t> ParseMessageToData(string str);
|
||||||
static string AddNewLinesToCommands(string str);
|
static string AddNewLinesToCommands(string str);
|
||||||
static string ReplaceAllDictionaryWords(string str);
|
static string ReplaceAllDictionaryWords(string str);
|
||||||
|
const std::string CHEESE = "\uBEBE"; // Inserted into commands to protect
|
||||||
|
// them from dictionary replacements.
|
||||||
|
|
||||||
struct MessageData {
|
struct MessageData {
|
||||||
const std::string CHEESE = "\uBEBE"; // Inserted into commands to protect
|
int ID;
|
||||||
// them from dictionary replacements.
|
int Address;
|
||||||
|
|
||||||
std::string RawString;
|
std::string RawString;
|
||||||
std::string ContentsParsed;
|
std::string ContentsParsed;
|
||||||
int ID;
|
|
||||||
std::vector<uint8_t> Data;
|
std::vector<uint8_t> Data;
|
||||||
std::vector<uint8_t> DataParsed;
|
std::vector<uint8_t> DataParsed;
|
||||||
int Address;
|
|
||||||
|
|
||||||
MessageData() = default;
|
MessageData() = default;
|
||||||
MessageData(int id, int address, std::string rawString,
|
MessageData(int id, int address, const std::string& rawString,
|
||||||
std::vector<uint8_t> rawData, std::string parsedString,
|
const std::vector<uint8_t>& rawData,
|
||||||
std::vector<uint8_t> parsedData)
|
const std::string& parsedString,
|
||||||
|
const std::vector<uint8_t>& parsedData)
|
||||||
: ID(id),
|
: ID(id),
|
||||||
Address(address),
|
Address(address),
|
||||||
RawString(rawString),
|
RawString(rawString),
|
||||||
@@ -68,6 +68,16 @@ struct MessageData {
|
|||||||
DataParsed(parsedData),
|
DataParsed(parsedData),
|
||||||
ContentsParsed(parsedString) {}
|
ContentsParsed(parsedString) {}
|
||||||
|
|
||||||
|
// Copy constructor
|
||||||
|
MessageData(const MessageData& other) {
|
||||||
|
ID = other.ID;
|
||||||
|
Address = other.Address;
|
||||||
|
RawString = other.RawString;
|
||||||
|
Data = other.Data;
|
||||||
|
DataParsed = other.DataParsed;
|
||||||
|
ContentsParsed = other.ContentsParsed;
|
||||||
|
}
|
||||||
|
|
||||||
void SetMessage(std::string messageString) {
|
void SetMessage(std::string messageString) {
|
||||||
ContentsParsed = messageString;
|
ContentsParsed = messageString;
|
||||||
RawString = OptimizeMessageForDictionary(messageString);
|
RawString = OptimizeMessageForDictionary(messageString);
|
||||||
|
|||||||
Reference in New Issue
Block a user