wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp which has grown to contain all sorts of unrelated helpers, we move StringVector helpers into the StringVector.{c,h}pp files. This makes the code better organized. Change-Id: I152f341606807ae66253415b951bc9f89b09df57 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>pull/4596/head
parent
264bdec250
commit
480fb7b931
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "Authorization.hpp"
|
||||
#include "Log.hpp"
|
||||
#include "Util.hpp"
|
||||
#include "StringVector.hpp"
|
||||
|
||||
#include <Poco/Net/HTTPRequest.h>
|
||||
#include <Poco/URI.h>
|
||||
|
@ -50,7 +50,7 @@ void Authorization::authorizeRequest(Poco::Net::HTTPRequest& request) const
|
|||
// X-Something-Custom: Huh
|
||||
// Split based on \n's or \r's and trim, to avoid nonsense in the
|
||||
// headers
|
||||
StringVector tokens(Util::tokenizeAnyOf(_data, "\n\r"));
|
||||
StringVector tokens(StringVector::tokenizeAnyOf(_data, "\n\r"));
|
||||
for (auto it = tokens.begin(); it != tokens.end(); ++it)
|
||||
{
|
||||
std::string token = tokens.getParam(*it);
|
||||
|
|
|
@ -30,7 +30,7 @@ void LockManager::generateLockedCommandList()
|
|||
|
||||
LockedCommandListString = config::getString("feature_lock.locked_commands", "");
|
||||
Util::trim(LockedCommandListString);
|
||||
StringVector commandList = Util::tokenize(LockedCommandListString);
|
||||
StringVector commandList = StringVector::tokenize(LockedCommandListString);
|
||||
|
||||
std::string command;
|
||||
for (std::size_t i = 0; i < commandList.size(); i++)
|
||||
|
@ -127,7 +127,7 @@ void RestrictionManager::generateRestrictedCommandList()
|
|||
#ifdef ENABLE_FEATURE_RESTRICTION
|
||||
RestrictedCommandListString = config::getString("restricted_commands", "");
|
||||
Util::trim(RestrictedCommandListString);
|
||||
StringVector commandList = Util::tokenize(RestrictedCommandListString);
|
||||
StringVector commandList = StringVector::tokenize(RestrictedCommandListString);
|
||||
|
||||
std::string command;
|
||||
for (std::size_t i = 0; i < commandList.size(); i++)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <functional>
|
||||
|
||||
#include "Protocol.hpp"
|
||||
#include "StringVector.hpp"
|
||||
#include "Log.hpp"
|
||||
|
||||
/// The payload type used to send/receive data.
|
||||
|
@ -29,7 +30,7 @@ public:
|
|||
const enum Dir dir) :
|
||||
_forwardToken(getForwardToken(message.data(), message.size())),
|
||||
_data(copyDataAfterOffset(message.data(), message.size(), _forwardToken.size())),
|
||||
_tokens(Util::tokenize(_data.data(), _data.size())),
|
||||
_tokens(StringVector::tokenize(_data.data(), _data.size())),
|
||||
_id(makeId(dir)),
|
||||
_type(detectType())
|
||||
{
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
const size_t reserve) :
|
||||
_forwardToken(getForwardToken(message.data(), message.size())),
|
||||
_data(copyDataAfterOffset(message.data(), message.size(), _forwardToken.size())),
|
||||
_tokens(Util::tokenize(message.data() + _forwardToken.size(), message.size() - _forwardToken.size())),
|
||||
_tokens(StringVector::tokenize(message.data() + _forwardToken.size(), message.size() - _forwardToken.size())),
|
||||
_id(makeId(dir)),
|
||||
_type(detectType())
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
const enum Dir dir) :
|
||||
_forwardToken(getForwardToken(p, len)),
|
||||
_data(copyDataAfterOffset(p, len, _forwardToken.size())),
|
||||
_tokens(Util::tokenize(_data.data(), _data.size())),
|
||||
_tokens(StringVector::tokenize(_data.data(), _data.size())),
|
||||
_id(makeId(dir)),
|
||||
_type(detectType())
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ void TileQueue::put_impl(const Payload& value)
|
|||
<< "]. Before canceltiles have " << getQueue().size()
|
||||
<< " in queue.");
|
||||
const std::string seqs = msg.substr(12);
|
||||
StringVector tokens(Util::tokenize(seqs, ','));
|
||||
StringVector tokens(StringVector::tokenize(seqs, ','));
|
||||
getQueue().erase(std::remove_if(getQueue().begin(), getQueue().end(),
|
||||
[&tokens](const Payload& v)
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
|
|||
{
|
||||
assert(COOLProtocol::matchPrefix("callback", callbackMsg, /*ignoreWhitespace*/ true));
|
||||
|
||||
StringVector tokens = Util::tokenize(callbackMsg);
|
||||
StringVector tokens = StringVector::tokenize(callbackMsg);
|
||||
|
||||
if (tokens.size() < 3)
|
||||
return std::string();
|
||||
|
@ -217,7 +217,7 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
|
|||
{
|
||||
auto& it = getQueue()[i];
|
||||
|
||||
StringVector queuedTokens = Util::tokenize(it.data(), it.size());
|
||||
StringVector queuedTokens = StringVector::tokenize(it.data(), it.size());
|
||||
if (queuedTokens.size() < 3)
|
||||
{
|
||||
++i;
|
||||
|
@ -336,7 +336,7 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
|
|||
{
|
||||
auto& it = getQueue()[i];
|
||||
|
||||
StringVector queuedTokens = Util::tokenize(it.data(), it.size());
|
||||
StringVector queuedTokens = StringVector::tokenize(it.data(), it.size());
|
||||
if (queuedTokens.size() < 4)
|
||||
continue;
|
||||
|
||||
|
@ -386,7 +386,7 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
|
|||
if (!COOLProtocol::matchPrefix("callback", it))
|
||||
continue;
|
||||
|
||||
StringVector queuedTokens = Util::tokenize(it.data(), it.size());
|
||||
StringVector queuedTokens = StringVector::tokenize(it.data(), it.size());
|
||||
if (queuedTokens.size() < 3)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
protected:
|
||||
virtual void put_impl(const Payload& value)
|
||||
{
|
||||
StringVector tokens = Util::tokenize(value.data(), value.size());
|
||||
StringVector tokens = StringVector::tokenize(value.data(), value.size());
|
||||
if (tokens.equals(1, "textinput"))
|
||||
{
|
||||
const std::string newMsg = combineTextInput(tokens);
|
||||
|
@ -144,7 +144,7 @@ protected:
|
|||
auto& it = getQueue()[i];
|
||||
|
||||
const std::string queuedMessage(it.data(), it.size());
|
||||
StringVector queuedTokens = Util::tokenize(it.data(), it.size());
|
||||
StringVector queuedTokens = StringVector::tokenize(it.data(), it.size());
|
||||
|
||||
// If any messages of these types are present before the current ("textinput") message,
|
||||
// no combination is possible.
|
||||
|
@ -203,7 +203,7 @@ protected:
|
|||
auto& it = getQueue()[i];
|
||||
|
||||
const std::string queuedMessage(it.data(), it.size());
|
||||
StringVector queuedTokens = Util::tokenize(it.data(), it.size());
|
||||
StringVector queuedTokens = StringVector::tokenize(it.data(), it.size());
|
||||
|
||||
// If any messages of these types are present before the current (removetextcontext)
|
||||
// message, no combination is possible.
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace COOLProtocol
|
|||
int minor = -1;
|
||||
std::string patch;
|
||||
|
||||
StringVector firstTokens(Util::tokenize(version, '.'));
|
||||
StringVector firstTokens(StringVector::tokenize(version, '.'));
|
||||
if (firstTokens.size() > 0)
|
||||
{
|
||||
major = std::stoi(firstTokens[0]);
|
||||
|
@ -33,7 +33,7 @@ namespace COOLProtocol
|
|||
StringVector secondTokens;
|
||||
if (firstTokens.size() > 1)
|
||||
{
|
||||
secondTokens = Util::tokenize(firstTokens[1], '-');
|
||||
secondTokens = StringVector::tokenize(firstTokens[1], '-');
|
||||
}
|
||||
if (secondTokens.size() > 0)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ namespace COOLProtocol
|
|||
|
||||
bool getTokenKeywordFromMessage(const std::string& message, const std::string& name, const std::map<std::string, int>& map, int& value)
|
||||
{
|
||||
return getTokenKeyword(Util::tokenize(message), name, map, value);
|
||||
return getTokenKeyword(StringVector::tokenize(message), name, map, value);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <StringVector.hpp>
|
||||
#include <Util.hpp>
|
||||
|
||||
#define LOK_USE_UNSTABLE_API
|
||||
|
@ -162,7 +163,7 @@ namespace COOLProtocol
|
|||
|
||||
inline bool getTokenIntegerFromMessage(const std::string& message, const std::string& name, int& value)
|
||||
{
|
||||
return getTokenInteger(Util::tokenize(message), name, value);
|
||||
return getTokenInteger(StringVector::tokenize(message), name, value);
|
||||
}
|
||||
|
||||
/// Returns the first token of a message.
|
||||
|
|
|
@ -79,4 +79,50 @@ bool StringVector::getNameIntegerPair(std::size_t index, std::string& name, int&
|
|||
return value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
StringVector StringVector::tokenizeAnyOf(const std::string& s, const char* delimiters,
|
||||
const std::size_t delimitersLength)
|
||||
{
|
||||
// trim from the end so that we do not have to check this exact case
|
||||
// later
|
||||
std::size_t length = s.length();
|
||||
while (length > 0 && s[length - 1] == ' ')
|
||||
--length;
|
||||
|
||||
if (length == 0 || delimiters == nullptr || delimitersLength == 0)
|
||||
return StringVector();
|
||||
|
||||
std::size_t start = 0;
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokens.reserve(16);
|
||||
|
||||
while (start < length)
|
||||
{
|
||||
// ignore the leading whitespace
|
||||
while (start < length && s[start] == ' ')
|
||||
++start;
|
||||
|
||||
// anything left?
|
||||
if (start == length)
|
||||
break;
|
||||
|
||||
std::size_t end = s.find_first_of(delimiters, start, delimitersLength);
|
||||
if (end == std::string::npos)
|
||||
end = length;
|
||||
|
||||
// trim the trailing whitespace
|
||||
std::size_t trimEnd = end;
|
||||
while (start < trimEnd && s[trimEnd - 1] == ' ')
|
||||
--trimEnd;
|
||||
|
||||
// add only non-empty tokens
|
||||
if (start < trimEnd)
|
||||
tokens.emplace_back(start, trimEnd - start);
|
||||
|
||||
start = end + 1;
|
||||
}
|
||||
|
||||
return StringVector(s, std::move(tokens));
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -47,6 +48,115 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
/// Tokenize delimited values until we hit new-line or the end.
|
||||
static void tokenize(const char* data, const std::size_t size, const char delimiter,
|
||||
std::vector<StringToken>& tokens)
|
||||
{
|
||||
if (size == 0 || data == nullptr || *data == '\0')
|
||||
return;
|
||||
|
||||
tokens.reserve(16);
|
||||
|
||||
const char* start = data;
|
||||
const char* end = data;
|
||||
for (std::size_t i = 0; i < size && data[i] != '\n'; ++i, ++end)
|
||||
{
|
||||
if (data[i] == delimiter)
|
||||
{
|
||||
if (start != end && *start != delimiter)
|
||||
tokens.emplace_back(start - data, end - start);
|
||||
|
||||
start = end;
|
||||
}
|
||||
else if (*start == delimiter)
|
||||
++start;
|
||||
}
|
||||
|
||||
if (start != end && *start != delimiter && *start != '\n')
|
||||
tokens.emplace_back(start - data, end - start);
|
||||
}
|
||||
|
||||
/// Tokenize single-char delimited values until we hit new-line or the end.
|
||||
static StringVector tokenize(const char* data, const std::size_t size,
|
||||
const char delimiter = ' ')
|
||||
{
|
||||
if (size == 0 || data == nullptr || *data == '\0')
|
||||
return StringVector();
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokenize(data, size, delimiter, tokens);
|
||||
return StringVector(std::string(data, size), std::move(tokens));
|
||||
}
|
||||
|
||||
/// Tokenize single-char delimited values until we hit new-line or the end.
|
||||
static StringVector tokenize(const std::string& s, const char delimiter = ' ')
|
||||
{
|
||||
if (s.empty())
|
||||
return StringVector();
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokenize(s.data(), s.size(), delimiter, tokens);
|
||||
return StringVector(s, std::move(tokens));
|
||||
}
|
||||
|
||||
/// Tokenize by the delimiter string.
|
||||
static StringVector tokenize(const std::string& s, const char* delimiter, int len = -1)
|
||||
{
|
||||
if (s.empty() || len == 0 || delimiter == nullptr || *delimiter == '\0')
|
||||
return StringVector();
|
||||
|
||||
if (len < 0)
|
||||
len = std::strlen(delimiter);
|
||||
|
||||
std::size_t start = 0;
|
||||
std::size_t end = s.find(delimiter, start);
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokens.reserve(16);
|
||||
|
||||
tokens.emplace_back(start, end - start);
|
||||
start = end + len;
|
||||
|
||||
while (end != std::string::npos)
|
||||
{
|
||||
end = s.find(delimiter, start);
|
||||
tokens.emplace_back(start, end - start);
|
||||
start = end + len;
|
||||
}
|
||||
|
||||
return StringVector(s, std::move(tokens));
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
static StringVector tokenize(const std::string& s, const char (&delimiter)[N])
|
||||
{
|
||||
return tokenize(s, delimiter, N - 1);
|
||||
}
|
||||
|
||||
static StringVector tokenize(const std::string& s, const std::string& delimiter)
|
||||
{
|
||||
return tokenize(s, delimiter.data(), delimiter.size());
|
||||
}
|
||||
|
||||
/** Tokenize based on any of the characters in 'delimiters'.
|
||||
|
||||
Ie. when there is '\n\r' in there, any of them means a delimiter.
|
||||
In addition, trim the values so there are no leadiding or trailing spaces.
|
||||
*/
|
||||
static StringVector tokenizeAnyOf(const std::string& s, const char* delimiters,
|
||||
const std::size_t delimitersLength);
|
||||
|
||||
template <std::size_t N>
|
||||
static StringVector tokenizeAnyOf(const std::string& s, const char (&delimiters)[N])
|
||||
{
|
||||
return tokenizeAnyOf(s, delimiters, N - 1); // Exclude the null terminator.
|
||||
}
|
||||
|
||||
static StringVector tokenizeAnyOf(const std::string& s, const char* delimiters)
|
||||
{
|
||||
return tokenizeAnyOf(s, delimiters, std::strlen(delimiters));
|
||||
}
|
||||
|
||||
/// Unlike std::vector, gives an empty string if index is unexpected.
|
||||
std::string operator[](std::size_t index) const
|
||||
{
|
||||
|
@ -158,7 +268,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
const auto len = N - 1; // we don't want to compare the '\0'
|
||||
constexpr auto len = N - 1; // we don't want to compare the '\0'
|
||||
return token._length >= len && _string.compare(token._index, len, string) == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1036,52 +1036,6 @@ namespace Util
|
|||
}
|
||||
#endif
|
||||
|
||||
StringVector tokenizeAnyOf(const std::string& s, const char* delimiters)
|
||||
{
|
||||
// trim from the end so that we do not have to check this exact case
|
||||
// later
|
||||
std::size_t length = s.length();
|
||||
while (length > 0 && s[length - 1] == ' ')
|
||||
--length;
|
||||
|
||||
if (length == 0)
|
||||
return StringVector();
|
||||
|
||||
std::size_t delimitersLength = std::strlen(delimiters);
|
||||
std::size_t start = 0;
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokens.reserve(16);
|
||||
|
||||
while (start < length)
|
||||
{
|
||||
// ignore the leading whitespace
|
||||
while (start < length && s[start] == ' ')
|
||||
++start;
|
||||
|
||||
// anything left?
|
||||
if (start == length)
|
||||
break;
|
||||
|
||||
std::size_t end = s.find_first_of(delimiters, start, delimitersLength);
|
||||
if (end == std::string::npos)
|
||||
end = length;
|
||||
|
||||
// trim the trailing whitespace
|
||||
std::size_t trimEnd = end;
|
||||
while (start < trimEnd && s[trimEnd - 1] == ' ')
|
||||
--trimEnd;
|
||||
|
||||
// add only non-empty tokens
|
||||
if (start < trimEnd)
|
||||
tokens.emplace_back(start, trimEnd - start);
|
||||
|
||||
start = end + 1;
|
||||
}
|
||||
|
||||
return StringVector(s, std::move(tokens));
|
||||
}
|
||||
|
||||
int safe_atoi(const char* p, int len)
|
||||
{
|
||||
long ret{};
|
||||
|
|
|
@ -579,97 +579,6 @@ namespace Util
|
|||
return equal(t.rbegin(), t.rend(), s.rbegin());
|
||||
}
|
||||
|
||||
/// Tokenize delimited values until we hit new-line or the end.
|
||||
inline void tokenize(const char* data, const std::size_t size, const char delimiter,
|
||||
std::vector<StringToken>& tokens)
|
||||
{
|
||||
if (size == 0 || data == nullptr || *data == '\0')
|
||||
return;
|
||||
|
||||
tokens.reserve(16);
|
||||
|
||||
const char* start = data;
|
||||
const char* end = data;
|
||||
for (std::size_t i = 0; i < size && data[i] != '\n'; ++i, ++end)
|
||||
{
|
||||
if (data[i] == delimiter)
|
||||
{
|
||||
if (start != end && *start != delimiter)
|
||||
tokens.emplace_back(start - data, end - start);
|
||||
|
||||
start = end;
|
||||
}
|
||||
else if (*start == delimiter)
|
||||
++start;
|
||||
}
|
||||
|
||||
if (start != end && *start != delimiter && *start != '\n')
|
||||
tokens.emplace_back(start - data, end - start);
|
||||
}
|
||||
|
||||
/// Tokenize single-char delimited values until we hit new-line or the end.
|
||||
inline StringVector tokenize(const char* data, const std::size_t size,
|
||||
const char delimiter = ' ')
|
||||
{
|
||||
if (size == 0 || data == nullptr || *data == '\0')
|
||||
return StringVector();
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokenize(data, size, delimiter, tokens);
|
||||
return StringVector(std::string(data, size), std::move(tokens));
|
||||
}
|
||||
|
||||
/// Tokenize single-char delimited values until we hit new-line or the end.
|
||||
inline StringVector tokenize(const std::string& s, const char delimiter = ' ')
|
||||
{
|
||||
if (s.empty())
|
||||
return StringVector();
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokenize(s.data(), s.size(), delimiter, tokens);
|
||||
return StringVector(s, std::move(tokens));
|
||||
}
|
||||
|
||||
/// Tokenize by the delimiter string.
|
||||
inline StringVector tokenize(const std::string& s, const char* delimiter, int len = -1)
|
||||
{
|
||||
if (s.empty() || len == 0 || delimiter == nullptr || *delimiter == '\0')
|
||||
return StringVector();
|
||||
|
||||
if (len < 0)
|
||||
len = std::strlen(delimiter);
|
||||
|
||||
std::size_t start = 0;
|
||||
std::size_t end = s.find(delimiter, start);
|
||||
|
||||
std::vector<StringToken> tokens;
|
||||
tokens.reserve(16);
|
||||
|
||||
tokens.emplace_back(start, end - start);
|
||||
start = end + len;
|
||||
|
||||
while (end != std::string::npos)
|
||||
{
|
||||
end = s.find(delimiter, start);
|
||||
tokens.emplace_back(start, end - start);
|
||||
start = end + len;
|
||||
}
|
||||
|
||||
return StringVector(s, std::move(tokens));
|
||||
}
|
||||
|
||||
inline StringVector tokenize(const std::string& s, const std::string& delimiter)
|
||||
{
|
||||
return tokenize(s, delimiter.data(), delimiter.size());
|
||||
}
|
||||
|
||||
/** Tokenize based on any of the characters in 'delimiters'.
|
||||
|
||||
Ie. when there is '\n\r' in there, any of them means a delimiter.
|
||||
In addition, trim the values so there are no leadiding or trailing spaces.
|
||||
*/
|
||||
StringVector tokenizeAnyOf(const std::string& s, const char* delimiters);
|
||||
|
||||
#ifdef IOS
|
||||
|
||||
inline void *memrchr(const void *s, int c, size_t n)
|
||||
|
@ -1311,6 +1220,7 @@ int main(int argc, char**argv)
|
|||
* Splits string into vector<string>. Does not accept referenced variables for easy
|
||||
* usage like (splitString("test", ..)) or (splitString(getStringOnTheFly(), ..))
|
||||
*/
|
||||
//FIXME: merge with StringVector.
|
||||
inline std::vector<std::string> splitStringToVector(const std::string& str, const char delim)
|
||||
{
|
||||
size_t start;
|
||||
|
|
|
@ -143,7 +143,7 @@ bool ChildSession::_handleInput(const char *buffer, int length)
|
|||
{
|
||||
LOG_TRC(getName() << ": handling [" << getAbbreviatedMessage(buffer, length) << "].");
|
||||
const std::string firstLine = getFirstLine(buffer, length);
|
||||
const StringVector tokens = Util::tokenize(firstLine.data(), firstLine.size());
|
||||
const StringVector tokens = StringVector::tokenize(firstLine.data(), firstLine.size());
|
||||
|
||||
if (COOLProtocol::tokenIndicatesUserInteraction(tokens[0]))
|
||||
{
|
||||
|
@ -1796,7 +1796,7 @@ bool ChildSession::renderWindow(const StringVector& tokens)
|
|||
&& paintRectangle != "undefined")
|
||||
{
|
||||
const StringVector rectParts
|
||||
= Util::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
|
||||
= StringVector::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
|
||||
if (rectParts.size() == 4)
|
||||
{
|
||||
startX = std::atoi(rectParts[0].c_str());
|
||||
|
@ -2720,7 +2720,7 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
|
|||
{
|
||||
case LOK_CALLBACK_INVALIDATE_TILES:
|
||||
{
|
||||
StringVector tokens(Util::tokenize(payload, ','));
|
||||
StringVector tokens(StringVector::tokenize(payload, ','));
|
||||
if (tokens.size() == 5)
|
||||
{
|
||||
int part, x, y, width, height;
|
||||
|
|
|
@ -125,7 +125,7 @@ protected:
|
|||
if (UnitKit::get().filterKitMessage(this, message))
|
||||
return;
|
||||
#endif
|
||||
StringVector tokens = Util::tokenize(message);
|
||||
StringVector tokens = StringVector::tokenize(message);
|
||||
Log::StreamLogger logger = Log::debug();
|
||||
if (logger.enabled())
|
||||
{
|
||||
|
@ -610,7 +610,7 @@ int main(int argc, char** argv)
|
|||
{
|
||||
eq = std::strchr(cmd, '=');
|
||||
const std::string rlimits = std::string(eq+1);
|
||||
StringVector tokens = Util::tokenize(rlimits, ';');
|
||||
StringVector tokens = StringVector::tokenize(rlimits, ';');
|
||||
for (const auto& cmdLimit : tokens)
|
||||
{
|
||||
const std::pair<std::string, std::string> pair = Util::split(tokens.getParam(cmdLimit), ':');
|
||||
|
|
10
kit/Kit.cpp
10
kit/Kit.cpp
|
@ -935,7 +935,7 @@ public:
|
|||
|
||||
if (type == LOK_CALLBACK_CELL_CURSOR)
|
||||
{
|
||||
StringVector tokens(Util::tokenize(payload, ','));
|
||||
StringVector tokens(StringVector::tokenize(payload, ','));
|
||||
// Payload may be 'EMPTY'.
|
||||
if (tokens.size() == 4)
|
||||
{
|
||||
|
@ -953,7 +953,7 @@ public:
|
|||
const Poco::Dynamic::Var result = parser.parse(payload);
|
||||
const auto& command = result.extract<Poco::JSON::Object::Ptr>();
|
||||
std::string rectangle = command->get("rectangle").toString();
|
||||
StringVector tokens(Util::tokenize(rectangle, ','));
|
||||
StringVector tokens(StringVector::tokenize(rectangle, ','));
|
||||
// Payload may be 'EMPTY'.
|
||||
if (tokens.size() == 4)
|
||||
{
|
||||
|
@ -974,7 +974,7 @@ public:
|
|||
targetViewId = command->get("viewId").toString();
|
||||
std::string part = command->get("part").toString();
|
||||
std::string text = command->get("rectangle").toString();
|
||||
StringVector tokens(Util::tokenize(text, ','));
|
||||
StringVector tokens(StringVector::tokenize(text, ','));
|
||||
// Payload may be 'EMPTY'.
|
||||
if (tokens.size() == 4)
|
||||
{
|
||||
|
@ -1588,7 +1588,7 @@ public:
|
|||
|
||||
LOG_TRC("Kit handling queue message: " << COOLProtocol::getAbbreviatedMessage(input));
|
||||
|
||||
const StringVector tokens = Util::tokenize(input.data(), input.size());
|
||||
const StringVector tokens = StringVector::tokenize(input.data(), input.size());
|
||||
|
||||
if (tokens.equals(0, "eof"))
|
||||
{
|
||||
|
@ -2188,7 +2188,7 @@ protected:
|
|||
if (UnitKit::get().filterKitMessage(this, message))
|
||||
return;
|
||||
#endif
|
||||
StringVector tokens = Util::tokenize(message);
|
||||
StringVector tokens = StringVector::tokenize(message);
|
||||
Log::StreamLogger logger = Log::debug();
|
||||
if (logger.enabled())
|
||||
{
|
||||
|
|
|
@ -189,7 +189,7 @@ public:
|
|||
|
||||
bool TileCacheTests::getPartFromInvalidateMessage(const std::string& message, int& part)
|
||||
{
|
||||
StringVector tokens = Util::tokenize(message);
|
||||
StringVector tokens = StringVector::tokenize(message);
|
||||
if (tokens.size() == 2 && tokens.equals(1, "EMPTY"))
|
||||
{
|
||||
part = -1;
|
||||
|
@ -1308,7 +1308,7 @@ void TileCacheTests::checkTiles(std::shared_ptr<http::WebSocketSession>& socket,
|
|||
std::istringstream istr(response.substr(8));
|
||||
std::getline(istr, line);
|
||||
|
||||
StringVector tokens(Util::tokenize(line, ' '));
|
||||
StringVector tokens(StringVector::tokenize(line, ' '));
|
||||
#if defined CPPUNIT_ASSERT_GREATEREQUAL
|
||||
if (docType == "presentation")
|
||||
CPPUNIT_ASSERT_GREATEREQUAL(static_cast<size_t>(7),
|
||||
|
@ -1425,7 +1425,7 @@ void TileCacheTests::requestTiles(std::shared_ptr<http::WebSocketSession>& socke
|
|||
sendTextFrame(socket, text, testname);
|
||||
tile = assertResponseString(socket, "tile:", testname);
|
||||
// expected tile: part= width= height= tileposx= tileposy= tilewidth= tileheight=
|
||||
StringVector tokens(Util::tokenize(tile, ' '));
|
||||
StringVector tokens(StringVector::tokenize(tile, ' '));
|
||||
LOK_ASSERT_EQUAL(std::string("tile:"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(0, std::stoi(tokens[1].substr(std::string("nviewid=").size())));
|
||||
LOK_ASSERT_EQUAL(part, std::stoi(tokens[2].substr(std::string("part=").size())));
|
||||
|
@ -1467,7 +1467,7 @@ void TileCacheTests::checkTiles(std::shared_ptr<COOLWebSocket>& socket, const st
|
|||
std::istringstream istr(response.substr(8));
|
||||
std::getline(istr, line);
|
||||
|
||||
StringVector tokens(Util::tokenize(line, ' '));
|
||||
StringVector tokens(StringVector::tokenize(line, ' '));
|
||||
#if defined CPPUNIT_ASSERT_GREATEREQUAL
|
||||
if (docType == "presentation")
|
||||
CPPUNIT_ASSERT_GREATEREQUAL(static_cast<size_t>(7), tokens.size()); // We have an extra field.
|
||||
|
@ -1578,7 +1578,7 @@ void TileCacheTests::requestTiles(std::shared_ptr<COOLWebSocket>& socket,
|
|||
sendTextFrame(socket, text, testname);
|
||||
tile = assertResponseString(socket, "tile:", testname);
|
||||
// expected tile: part= width= height= tileposx= tileposy= tilewidth= tileheight=
|
||||
StringVector tokens(Util::tokenize(tile, ' '));
|
||||
StringVector tokens(StringVector::tokenize(tile, ' '));
|
||||
LOK_ASSERT_EQUAL(std::string("tile:"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(0, std::stoi(tokens[1].substr(std::string("nviewid=").size())));
|
||||
LOK_ASSERT_EQUAL(part, std::stoi(tokens[2].substr(std::string("part=").size())));
|
||||
|
@ -1747,7 +1747,7 @@ void TileCacheTests::testTileProcessed()
|
|||
++arrivedTile;
|
||||
|
||||
// Store tileID, so we can send it back
|
||||
StringVector tokens(Util::tokenize(tile, ' '));
|
||||
StringVector tokens(StringVector::tokenize(tile, ' '));
|
||||
std::string tileID = tokens[2].substr(std::string("part=").size()) + ':' +
|
||||
tokens[5].substr(std::string("tileposx=").size()) + ':' +
|
||||
tokens[6].substr(std::string("tileposy=").size()) + ':' +
|
||||
|
@ -1803,7 +1803,7 @@ void TileCacheTests::testTileInvalidatedOutside()
|
|||
// First wsd forwards the invalidation
|
||||
const std::string sInvalidate = assertResponseString(socket, "invalidatetiles:", testname);
|
||||
LOK_ASSERT_MESSAGE("Expected invalidatetiles message.", !sInvalidate.empty());
|
||||
StringVector tokens(Util::tokenize(sInvalidate, ' '));
|
||||
StringVector tokens(StringVector::tokenize(sInvalidate, ' '));
|
||||
LOK_ASSERT_MESSAGE("Expected at least 6 tokens.", tokens.size() >= 6);
|
||||
const int y = std::stoi(tokens[3].substr(std::string("y=").size()));
|
||||
const int height = std::stoi(tokens[5].substr(std::string("height=").size()));
|
||||
|
|
|
@ -140,7 +140,7 @@ private:
|
|||
}
|
||||
lock.unlock();
|
||||
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 1 ||
|
||||
tokens[0] != "NotAuthenticated")
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ private:
|
|||
}
|
||||
lock.unlock();
|
||||
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 1 ||
|
||||
tokens[0] != "InvalidAuthToken")
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ private:
|
|||
lock.unlock();
|
||||
|
||||
{
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 5 ||
|
||||
tokens[0] != "adddoc" ||
|
||||
tokens[2] != documentPath1.substr(documentPath1.find_last_of('/') + 1) )
|
||||
|
@ -251,7 +251,7 @@ private:
|
|||
lock.unlock();
|
||||
|
||||
{
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 5 ||
|
||||
tokens[0] != "adddoc" ||
|
||||
tokens[2] != documentPath1.substr(documentPath1.find_last_of('/') + 1) )
|
||||
|
@ -286,7 +286,7 @@ private:
|
|||
lock.unlock();
|
||||
|
||||
{
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 5 ||
|
||||
tokens[0] != "adddoc" ||
|
||||
tokens[2] != documentPath2.substr(documentPath2.find_last_of('/') + 1) )
|
||||
|
@ -319,7 +319,7 @@ private:
|
|||
}
|
||||
lock.unlock();
|
||||
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 2 ||
|
||||
tokens[0] != "active_users_count")
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ private:
|
|||
}
|
||||
lock.unlock();
|
||||
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 2 ||
|
||||
tokens[0] != "active_docs_count" ||
|
||||
std::stoi(tokens[1]) != _docsCount)
|
||||
|
@ -388,7 +388,7 @@ private:
|
|||
}
|
||||
lock.unlock();
|
||||
|
||||
StringVector tokens(Util::tokenize(_messageReceived, ' '));
|
||||
StringVector tokens(StringVector::tokenize(_messageReceived, ' '));
|
||||
if (tokens.size() != 3 ||
|
||||
tokens[0] != "rmdoc" ||
|
||||
stoi(tokens[1]) != _docPid1)
|
||||
|
|
|
@ -61,7 +61,7 @@ UnitBase::TestResult UnitBadDocLoad::testBadDocLoadFail()
|
|||
helpers::sendTextFrame(socket, "load url=" + documentURL, testname);
|
||||
|
||||
const auto response = helpers::getResponseString(socket, "error:", testname);
|
||||
StringVector tokens(Util::tokenize(response, ' '));
|
||||
StringVector tokens(StringVector::tokenize(response, ' '));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(3), tokens.size());
|
||||
|
||||
std::string errorCommand;
|
||||
|
|
|
@ -191,7 +191,7 @@ UnitBase::TestResult UnitClose::testAlertAllUsers()
|
|||
{
|
||||
const std::string response
|
||||
= helpers::assertResponseString(socket[i], "error:", testname);
|
||||
StringVector tokens(Util::tokenize(response.substr(6), ' '));
|
||||
StringVector tokens(StringVector::tokenize(response.substr(6), ' '));
|
||||
std::string cmd;
|
||||
COOLProtocol::getTokenString(tokens, "cmd", cmd);
|
||||
LOK_ASSERT_EQUAL(std::string("internal"), cmd);
|
||||
|
|
|
@ -34,7 +34,7 @@ void getCursor(const std::string& message, int& cursorX, int& cursorY, int& curs
|
|||
LOK_ASSERT_EQUAL(std::string(".uno:CellCursor"), text);
|
||||
text = command->get("commandValues").toString();
|
||||
LOK_ASSERT(!text.empty());
|
||||
StringVector position(Util::tokenize(text, ','));
|
||||
StringVector position(StringVector::tokenize(text, ','));
|
||||
cursorX = std::stoi(position[0]);
|
||||
cursorY = std::stoi(position[1]);
|
||||
cursorWidth = std::stoi(position[2]);
|
||||
|
|
|
@ -36,7 +36,7 @@ void getPartHashCodes(const std::string& testname, const std::string& response,
|
|||
TST_LOG("Reading parts from [" << response << "].");
|
||||
|
||||
// Expected format is something like 'type= parts= current= width= height= viewid= [hiddenparts=]'.
|
||||
StringVector tokens(Util::tokenize(line, ' '));
|
||||
StringVector tokens(StringVector::tokenize(line, ' '));
|
||||
#if defined CPPUNIT_ASSERT_GREATEREQUAL
|
||||
CPPUNIT_ASSERT_GREATEREQUAL(static_cast<size_t>(7), tokens.size());
|
||||
#else
|
||||
|
@ -288,7 +288,7 @@ UnitBase::TestResult UnitInsertDelete::testCursorPosition()
|
|||
LOK_ASSERT_MESSAGE("missing property rectangle", command0->has("rectangle"));
|
||||
|
||||
StringVector cursorTokens(
|
||||
Util::tokenize(command0->get("rectangle").toString(), ','));
|
||||
StringVector::tokenize(command0->get("rectangle").toString(), ','));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(4), cursorTokens.size());
|
||||
|
||||
// Create second view
|
||||
|
@ -304,7 +304,7 @@ UnitBase::TestResult UnitInsertDelete::testCursorPosition()
|
|||
LOK_ASSERT_MESSAGE("missing property rectangle", command->has("rectangle"));
|
||||
|
||||
StringVector viewTokens(
|
||||
Util::tokenize(command->get("rectangle").toString(), ','));
|
||||
StringVector::tokenize(command->get("rectangle").toString(), ','));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(4), viewTokens.size());
|
||||
|
||||
// check both cursor should be equal
|
||||
|
|
|
@ -172,7 +172,7 @@ UnitBase::TestResult UnitLoad::testExcelLoad()
|
|||
const auto status = helpers::assertResponseString(socket, "status:", testname);
|
||||
|
||||
// Expected format is something like 'status: type=text parts=2 current=0 width=12808 height=1142 viewid=0\n...'.
|
||||
StringVector tokens(Util::tokenize(status, ' '));
|
||||
StringVector tokens(StringVector::tokenize(status, ' '));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(7), tokens.size());
|
||||
}
|
||||
catch (const Poco::Exception& exc)
|
||||
|
|
|
@ -55,7 +55,7 @@ UnitBase::TestResult UnitPasswordProtected::testPasswordProtectedDocumentWithout
|
|||
helpers::sendTextFrame(socket, "load url=" + documentURL);
|
||||
|
||||
auto response = helpers::getResponseString(socket, "error:", testname);
|
||||
StringVector tokens(Util::tokenize(response, ' '));
|
||||
StringVector tokens(StringVector::tokenize(response, ' '));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(3), tokens.size());
|
||||
|
||||
std::string errorCommand;
|
||||
|
@ -94,7 +94,7 @@ UnitBase::TestResult UnitPasswordProtected::testPasswordProtectedDocumentWithWro
|
|||
helpers::sendTextFrame(socket, "load url=" + documentURL + " password=2");
|
||||
|
||||
const auto response = helpers::getResponseString(socket, "error:", testname);
|
||||
StringVector tokens(Util::tokenize(response, ' '));
|
||||
StringVector tokens(StringVector::tokenize(response, ' '));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(3), tokens.size());
|
||||
|
||||
std::string errorCommand;
|
||||
|
|
|
@ -54,7 +54,7 @@ void UnitRenderingOptions::invokeWSDTest()
|
|||
|
||||
// Expected format is something like 'status: type=text parts=2 current=0 width=12808 height=1142'.
|
||||
|
||||
StringVector tokens(Util::tokenize(status, ' '));
|
||||
StringVector tokens(StringVector::tokenize(status, ' '));
|
||||
LOK_ASSERT_EQUAL(static_cast<size_t>(8), tokens.size());
|
||||
|
||||
const std::string token = tokens[5];
|
||||
|
|
|
@ -172,7 +172,7 @@ UnitBase::TestResult UnitSession::testSlideShow()
|
|||
LOK_ASSERT_MESSAGE("did not receive a downloadas: message as expected",
|
||||
!response.empty());
|
||||
|
||||
StringVector tokens(Util::tokenize(response.substr(11), ' '));
|
||||
StringVector tokens(StringVector::tokenize(response.substr(11), ' '));
|
||||
// "downloadas: downloadId= port= id=slideshow"
|
||||
const std::string downloadId = tokens[0].substr(std::string("downloadId=").size());
|
||||
const int port = std::stoi(tokens[1].substr(std::string("port=").size()));
|
||||
|
|
|
@ -335,7 +335,7 @@ public:
|
|||
{
|
||||
// 1544818858022 INCOMING: tile: nviewid=0 part=0 width=256 height=256 tileposx=15360 tileposy=38400 tilewidth=3840 tileheight=3840 oldwid=0 wid=232 ver=913 imgsize=1002
|
||||
// Socket.js:123 1544818858027 OUTGOING: tileprocessed tile=0:15360:38400:3840:3840
|
||||
TileDesc desc = TileDesc::parse(Util::tokenize(tile.data(), tile.size()));
|
||||
TileDesc desc = TileDesc::parse(StringVector::tokenize(tile.data(), tile.size()));
|
||||
sendTextFrame(sock, "tileprocessed tile=" + desc.generateID(), testname);
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
|
||||
if(!tile.empty())
|
||||
{
|
||||
StringVector tokens(Util::tokenize(tile, ' '));
|
||||
StringVector tokens(StringVector::tokenize(tile, ' '));
|
||||
std::string nviewid = tokens[1].substr(std::string("nviewid=").size());
|
||||
if (!nviewid.empty() && nviewid != "0")
|
||||
{
|
||||
|
|
|
@ -125,7 +125,7 @@ void WhiteBoxTests::testCOOLProtocolFunctions()
|
|||
LOK_ASSERT_EQUAL(2, mumble);
|
||||
|
||||
std::string message("hello x=1 y=2 foo=42 bar=hello-sailor mumble='goodbye' zip zap");
|
||||
StringVector tokens(Util::tokenize(message));
|
||||
StringVector tokens(StringVector::tokenize(message));
|
||||
|
||||
LOK_ASSERT(COOLProtocol::getTokenInteger(tokens, "foo", foo));
|
||||
LOK_ASSERT_EQUAL(42, foo);
|
||||
|
@ -376,51 +376,52 @@ void WhiteBoxTests::testTokenizer()
|
|||
|
||||
StringVector tokens;
|
||||
|
||||
tokens = Util::tokenize("");
|
||||
tokens = StringVector::tokenize("");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenize(" ");
|
||||
tokens = StringVector::tokenize(" ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenize("A");
|
||||
tokens = StringVector::tokenize("A");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenize(" A");
|
||||
tokens = StringVector::tokenize(" A");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenize("A ");
|
||||
tokens = StringVector::tokenize("A ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenize(" A ");
|
||||
tokens = StringVector::tokenize(" A ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenize(" A Z ");
|
||||
tokens = StringVector::tokenize(" A Z ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(2), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("Z"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenize("\n");
|
||||
tokens = StringVector::tokenize("\n");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenize(" A \nZ ");
|
||||
tokens = StringVector::tokenize(" A \nZ ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenize(" A Z\n ");
|
||||
tokens = StringVector::tokenize(" A Z\n ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(2), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("Z"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenize(" A Z \n ");
|
||||
tokens = StringVector::tokenize(" A Z \n ");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(2), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("Z"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenize("tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 ver=-1");
|
||||
tokens = StringVector::tokenize("tile nviewid=0 part=0 width=256 height=256 tileposx=0 "
|
||||
"tileposy=0 tilewidth=3840 tileheight=3840 ver=-1");
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(10), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("tile"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("nviewid=0"), tokens[1]);
|
||||
|
@ -434,11 +435,11 @@ void WhiteBoxTests::testTokenizer()
|
|||
LOK_ASSERT_EQUAL(std::string("ver=-1"), tokens[9]);
|
||||
|
||||
// With custom delimiters
|
||||
tokens = Util::tokenize(std::string("ABC:DEF"), ':');
|
||||
tokens = StringVector::tokenize(std::string("ABC:DEF"), ':');
|
||||
LOK_ASSERT_EQUAL(std::string("ABC"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("DEF"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenize(std::string("ABC,DEF,XYZ"), ',');
|
||||
tokens = StringVector::tokenize(std::string("ABC,DEF,XYZ"), ',');
|
||||
LOK_ASSERT_EQUAL(std::string("ABC"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("DEF"), tokens[1]);
|
||||
LOK_ASSERT_EQUAL(std::string("XYZ"), tokens[2]);
|
||||
|
@ -455,7 +456,7 @@ void WhiteBoxTests::testTokenizer()
|
|||
"ws?WOPISrc=http%3A%2F%2Flocalhost%2Fnextcloud%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%"
|
||||
"2Ffiles%2F593_ocqiesh0cngs&compat=/ws/b26112ab1b6f2ed98ce1329f0f344791/close/31";
|
||||
|
||||
tokens = Util::tokenize(URI, '/');
|
||||
tokens = StringVector::tokenize(URI, '/');
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(7), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("31"), tokens[6]);
|
||||
|
||||
|
@ -487,63 +488,63 @@ void WhiteBoxTests::testTokenizerTokenizeAnyOf()
|
|||
StringVector tokens;
|
||||
const char delimiters[] = "\n\r"; // any of these delimits; and we trim whitespace
|
||||
|
||||
tokens = Util::tokenizeAnyOf("", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf("", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenizeAnyOf("A", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf("A", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf("A ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf("A ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A Z ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A Z ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A Z"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf("\n", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf("\n", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenizeAnyOf("\n\r\r\n", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf("\n\r\r\n", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(0), tokens.size());
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A \nZ ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A \nZ ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(2), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("Z"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A Z\n ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A Z\n ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A Z"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A Z \n\r\r\n ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A Z \n\r\r\n ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(1), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A Z"), tokens[0]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" A \n\r\r\n \r \n Z \n ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" A \n\r\r\n \r \n Z \n ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(2), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("Z"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(" \r A \n \r \n Z \n ", delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(" \r A \n \r \n Z \n ", delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(2), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("Z"), tokens[1]);
|
||||
|
||||
tokens = Util::tokenizeAnyOf(std::string("A\rB\nC\n\rD\r\nE\r\rF\n\nG\r\r\n\nH"),
|
||||
delimiters);
|
||||
tokens = StringVector::tokenizeAnyOf(std::string("A\rB\nC\n\rD\r\nE\r\rF\n\nG\r\r\n\nH"),
|
||||
delimiters);
|
||||
LOK_ASSERT_EQUAL(static_cast<std::size_t>(8), tokens.size());
|
||||
LOK_ASSERT_EQUAL(std::string("A"), tokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("B"), tokens[1]);
|
||||
|
|
|
@ -816,7 +816,7 @@ void parseDocSize(const std::string& message, const std::string& type,
|
|||
int& part, int& parts, int& width, int& height, int& viewid,
|
||||
const std::string& testname)
|
||||
{
|
||||
StringVector tokens(Util::tokenize(message, ' '));
|
||||
StringVector tokens(StringVector::tokenize(message, ' '));
|
||||
|
||||
// Expected format is something like 'type= parts= current= width= height='.
|
||||
const std::string text = tokens[0].substr(std::string("type=").size());
|
||||
|
@ -851,7 +851,7 @@ std::vector<char> assertTileMessage(COOLWebSocket& ws, const std::string& testna
|
|||
const std::vector<char> response = getTileMessage(ws, testname);
|
||||
|
||||
const std::string firstLine = COOLProtocol::getFirstLine(response);
|
||||
StringVector tileTokens(Util::tokenize(firstLine, ' '));
|
||||
StringVector tileTokens(StringVector::tokenize(firstLine, ' '));
|
||||
LOK_ASSERT_EQUAL(std::string("tile:"), tileTokens[0]);
|
||||
LOK_ASSERT_EQUAL(std::string("part="), tileTokens[1].substr(0, std::string("part=").size()));
|
||||
LOK_ASSERT_EQUAL(std::string("width="), tileTokens[2].substr(0, std::string("width=").size()));
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
}
|
||||
|
||||
std::string firstLine = getFirstLine(buffer, n);
|
||||
StringVector tokens(Util::tokenize(firstLine, ' '));
|
||||
StringVector tokens(StringVector::tokenize(firstLine, ' '));
|
||||
|
||||
if (std::getenv("DISPLAY") != nullptr && tokens.equals(0, "tile:"))
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ protected:
|
|||
std::string line;
|
||||
std::getline(std::cin, line);
|
||||
|
||||
StringVector tokens(Util::tokenize(line, ' '));
|
||||
StringVector tokens(StringVector::tokenize(line, ' '));
|
||||
|
||||
if (tokens.size() == 0)
|
||||
continue;
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
std::string rewriteMessage(const std::string &msg)
|
||||
{
|
||||
const std::string firstLine = COOLProtocol::getFirstLine(msg);
|
||||
StringVector tokens = Util::tokenize(firstLine);
|
||||
StringVector tokens = StringVector::tokenize(firstLine);
|
||||
|
||||
std::string out = msg;
|
||||
|
||||
|
@ -276,7 +276,7 @@ public:
|
|||
_stats->_bytesRecvd += data.size();
|
||||
|
||||
const std::string firstLine = COOLProtocol::getFirstLine(data.data(), data.size());
|
||||
StringVector tokens = Util::tokenize(firstLine);
|
||||
StringVector tokens = StringVector::tokenize(firstLine);
|
||||
std::cerr << _logPre << "Got msg: " << firstLine << "\n";
|
||||
|
||||
if (tokens.equals(0, "tile:")) {
|
||||
|
|
|
@ -142,7 +142,7 @@ private:
|
|||
LOG_INF("Incoming websocket request: " << request.getURI());
|
||||
|
||||
const std::string& requestURI = request.getURI();
|
||||
StringVector pathTokens(Util::tokenize(requestURI, '/'));
|
||||
StringVector pathTokens(StringVector::tokenize(requestURI, '/'));
|
||||
if (request.find("Upgrade") != request.end()
|
||||
&& Util::iequal(request["Upgrade"], "websocket"))
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <Protocol.hpp>
|
||||
#include "Storage.hpp"
|
||||
#include "TileCache.hpp"
|
||||
#include <StringVector.hpp>
|
||||
#include <Unit.hpp>
|
||||
#include <Util.hpp>
|
||||
|
||||
|
@ -51,7 +52,7 @@ void AdminSocketHandler::handleMessage(const std::vector<char> &payload)
|
|||
{
|
||||
// FIXME: check fin, code etc.
|
||||
const std::string firstLine = getFirstLine(payload.data(), payload.size());
|
||||
StringVector tokens(Util::tokenize(firstLine, ' '));
|
||||
StringVector tokens(StringVector::tokenize(firstLine, ' '));
|
||||
LOG_TRC("Recv: " << firstLine << " tokens " << tokens.size());
|
||||
|
||||
if (tokens.empty())
|
||||
|
@ -217,7 +218,7 @@ void AdminSocketHandler::handleMessage(const std::vector<char> &payload)
|
|||
{
|
||||
for (size_t i = 1; i < tokens.size(); i++)
|
||||
{
|
||||
StringVector setting(Util::tokenize(tokens[i], '='));
|
||||
StringVector setting(StringVector::tokenize(tokens[i], '='));
|
||||
int settingVal = 0;
|
||||
try
|
||||
{
|
||||
|
@ -285,7 +286,7 @@ void AdminSocketHandler::handleMessage(const std::vector<char> &payload)
|
|||
else if (tokens.equals(0, "update-log-levels") && tokens.size() > 1) {
|
||||
for (size_t i = 1; i < tokens.size(); i++)
|
||||
{
|
||||
StringVector _channel(Util::tokenize(tokens[i], '='));
|
||||
StringVector _channel(StringVector::tokenize(tokens[i], '='));
|
||||
if (_channel.size() == 2)
|
||||
{
|
||||
_admin->setChannelLogLevel((_channel[0] != "?" ? _channel[0]: ""), _channel[1]);
|
||||
|
@ -360,7 +361,7 @@ bool AdminSocketHandler::handleInitialRequest(
|
|||
}
|
||||
|
||||
const std::string& requestURI = request.getURI();
|
||||
StringVector pathTokens(Util::tokenize(requestURI, '/'));
|
||||
StringVector pathTokens(StringVector::tokenize(requestURI, '/'));
|
||||
|
||||
if (request.has("Upgrade") && Util::iequal(request["Upgrade"], "websocket"))
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ const std::string JWTAuth::getAccessToken()
|
|||
|
||||
bool JWTAuth::verify(const std::string& accessToken)
|
||||
{
|
||||
StringVector tokens(Util::tokenize(accessToken, '.'));
|
||||
StringVector tokens(StringVector::tokenize(accessToken, '.'));
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -982,7 +982,7 @@ void ForKitProcWSHandler::handleMessage(const std::vector<char> &data)
|
|||
{
|
||||
LOG_TRC("ForKitProcWSHandler: handling incoming [" << COOLProtocol::getAbbreviatedMessage(&data[0], data.size()) << "].");
|
||||
const std::string firstLine = COOLProtocol::getFirstLine(&data[0], data.size());
|
||||
const StringVector tokens = Util::tokenize(firstLine.data(), firstLine.size());
|
||||
const StringVector tokens = StringVector::tokenize(firstLine.data(), firstLine.size());
|
||||
|
||||
if (tokens.equals(0, "segfaultcount"))
|
||||
{
|
||||
|
@ -2992,7 +2992,7 @@ public:
|
|||
if(request.has("X-Forwarded-For"))
|
||||
{
|
||||
const std::string fowardedData = request.get("X-Forwarded-For");
|
||||
StringVector tokens = Util::tokenize(fowardedData, ',');
|
||||
StringVector tokens = StringVector::tokenize(fowardedData, ',');
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
std::string param = tokens.getParam(token);
|
||||
|
|
|
@ -318,7 +318,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
|
|||
{
|
||||
LOG_TRC(getName() << ": handling incoming [" << getAbbreviatedMessage(buffer, length) << "].");
|
||||
const std::string firstLine = getFirstLine(buffer, length);
|
||||
const StringVector tokens = Util::tokenize(firstLine.data(), firstLine.size());
|
||||
const StringVector tokens = StringVector::tokenize(firstLine.data(), firstLine.size());
|
||||
|
||||
std::shared_ptr<DocumentBroker> docBroker = getDocumentBroker();
|
||||
if (!docBroker || docBroker->isMarkedToDestroy())
|
||||
|
@ -1207,7 +1207,7 @@ bool ClientSession::forwardToChild(const std::string& message,
|
|||
bool ClientSession::filterMessage(const std::string& message) const
|
||||
{
|
||||
bool allowed = true;
|
||||
StringVector tokens(Util::tokenize(message, ' '));
|
||||
StringVector tokens(StringVector::tokenize(message, ' '));
|
||||
|
||||
// Set allowed flag to false depending on if particular WOPI properties are set
|
||||
if (tokens.equals(0, "downloadas"))
|
||||
|
@ -1630,7 +1630,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
|
|||
#endif
|
||||
else if (tokens.size() == 2 && tokens.equals(0, "statechanged:"))
|
||||
{
|
||||
StringVector stateTokens(Util::tokenize(tokens[1], '='));
|
||||
StringVector stateTokens(StringVector::tokenize(tokens[1], '='));
|
||||
if (stateTokens.size() == 2 && stateTokens.equals(0, ".uno:ModifiedStatus"))
|
||||
{
|
||||
// Always update the modified flag in the DocBroker faithfully.
|
||||
|
@ -1847,7 +1847,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
|
|||
const Poco::Dynamic::Var result = parser.parse(stringJSON);
|
||||
const auto& object = result.extract<Poco::JSON::Object::Ptr>();
|
||||
const std::string rectangle = object->get("rectangle").toString();
|
||||
StringVector rectangleTokens(Util::tokenize(rectangle, ','));
|
||||
StringVector rectangleTokens(StringVector::tokenize(rectangle, ','));
|
||||
int x = 0, y = 0, w = 0, h = 0;
|
||||
if (rectangleTokens.size() > 2 &&
|
||||
stringToInteger(rectangleTokens[0], x) &&
|
||||
|
|
|
@ -959,7 +959,7 @@ bool DocumentBroker::download(const std::shared_ptr<ClientSession>& session, con
|
|||
++outputs;
|
||||
}
|
||||
|
||||
StringVector args(Util::tokenize(commandLine, ' '));
|
||||
StringVector args(StringVector::tokenize(commandLine, ' '));
|
||||
std::string command(args[0]);
|
||||
args.erase(args.begin()); // strip the command
|
||||
|
||||
|
@ -3038,7 +3038,7 @@ bool DocumentBroker::forwardToChild(const std::string& viewId, const std::string
|
|||
{
|
||||
assert(!_uriJailed.empty());
|
||||
|
||||
StringVector tokens = Util::tokenize(msg);
|
||||
StringVector tokens = StringVector::tokenize(msg);
|
||||
if (tokens.size() > 1 && tokens.equals(1, "load"))
|
||||
{
|
||||
// The json options must come last.
|
||||
|
|
|
@ -149,7 +149,7 @@ bool isConfigAuthOk(const std::string& userProvidedUsr, const std::string& userP
|
|||
#if HAVE_PKCS5_PBKDF2_HMAC
|
||||
// Extract the salt from the config
|
||||
std::vector<unsigned char> saltData;
|
||||
StringVector tokens = Util::tokenize(securePass, '.');
|
||||
StringVector tokens = StringVector::tokenize(securePass, '.');
|
||||
if (tokens.size() != 5 ||
|
||||
!tokens.equals(0, "pbkdf2") ||
|
||||
!tokens.equals(1, "sha512") ||
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#include <Poco/JSON/Object.h>
|
||||
|
||||
#include "FileServer.hpp"
|
||||
#include "StringVector.hpp"
|
||||
#include "Util.hpp"
|
||||
|
||||
#include <Poco/JSON/Object.h>
|
||||
|
||||
std::string FileServerRequestHandler::uiDefaultsToJSON(const std::string& uiDefaults, std::string& uiMode)
|
||||
{
|
||||
|
@ -31,10 +33,10 @@ std::string FileServerRequestHandler::uiDefaultsToJSON(const std::string& uiDefa
|
|||
Poco::JSON::Object drawingDefs;
|
||||
|
||||
uiMode = "";
|
||||
StringVector tokens(Util::tokenize(uiDefaults, ';'));
|
||||
StringVector tokens(StringVector::tokenize(uiDefaults, ';'));
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
StringVector keyValue(Util::tokenize(tokens.getParam(token), '='));
|
||||
StringVector keyValue(StringVector::tokenize(tokens.getParam(token), '='));
|
||||
Poco::JSON::Object* currentDef = nullptr;
|
||||
std::string key;
|
||||
|
||||
|
@ -142,10 +144,10 @@ std::string FileServerRequestHandler::cssVarsToStyle(const std::string& cssVars)
|
|||
|
||||
std::ostringstream styleOSS;
|
||||
styleOSS << "<style>:root {";
|
||||
StringVector tokens(Util::tokenize(cssVars, ';'));
|
||||
StringVector tokens(StringVector::tokenize(cssVars, ';'));
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
StringVector keyValue(Util::tokenize(tokens.getParam(token), '='));
|
||||
StringVector keyValue(StringVector::tokenize(tokens.getParam(token), '='));
|
||||
if (keyValue.size() < 2)
|
||||
{
|
||||
LOG_ERR("Skipping the token [" << tokens.getParam(token) << "] since it does not have '='");
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Quarantine
|
|||
for (const auto& file : files)
|
||||
{
|
||||
|
||||
Util::tokenize(file.c_str(), file.size(), '_', tokens);
|
||||
StringVector::tokenize(file.c_str(), file.size(), '_', tokens);
|
||||
Poco::URI::decode(file.substr(tokens[2]._index), decoded);
|
||||
COOLWSD::QuarantineMap[decoded].emplace_back(COOLWSD::QuarantinePath + file);
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ void RequestDetails::processURI()
|
|||
if (posLastWS != std::string::npos)
|
||||
{
|
||||
std::string lastWS = uriRes.substr(posLastWS);
|
||||
const auto proxyTokens = Util::tokenize(lastWS, '/');
|
||||
const auto proxyTokens = StringVector::tokenize(lastWS, '/');
|
||||
if (proxyTokens.size() > 1)
|
||||
{
|
||||
_fields[Field::SessionId] = proxyTokens[1];
|
||||
|
|
|
@ -491,7 +491,7 @@ static void addStorageDebugCookie(Poco::Net::HTTPRequest& request)
|
|||
if (std::getenv("COOL_STORAGE_COOKIE"))
|
||||
{
|
||||
Poco::Net::NameValueCollection nvcCookies;
|
||||
StringVector cookieTokens = Util::tokenize(std::string(std::getenv("COOL_STORAGE_COOKIE")), ':');
|
||||
StringVector cookieTokens = StringVector::tokenize(std::string(std::getenv("COOL_STORAGE_COOKIE")), ':');
|
||||
if (cookieTokens.size() == 2)
|
||||
{
|
||||
nvcCookies.add(cookieTokens[0], cookieTokens[1]);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "ClientSession.hpp"
|
||||
#include <Common.hpp>
|
||||
#include <Protocol.hpp>
|
||||
#include <StringVector.hpp>
|
||||
#include <Unit.hpp>
|
||||
#include <Util.hpp>
|
||||
#include <common/FileUtil.hpp>
|
||||
|
@ -327,7 +328,7 @@ void TileCache::invalidateTiles(const std::string& tiles, int normalizedViewId)
|
|||
|
||||
std::pair<int, Util::Rectangle> TileCache::parseInvalidateMsg(const std::string& tiles)
|
||||
{
|
||||
StringVector tokens = Util::tokenize(tiles);
|
||||
StringVector tokens = StringVector::tokenize(tiles);
|
||||
|
||||
assert(!tokens.empty() && tokens.equals(0, "invalidatetiles:"));
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "Exceptions.hpp"
|
||||
#include <Protocol.hpp>
|
||||
#include <StringVector.hpp>
|
||||
|
||||
#define TILE_WIRE_ID
|
||||
using TileWireId = uint32_t;
|
||||
|
@ -248,7 +249,7 @@ public:
|
|||
/// Deserialize a TileDesc from a string format.
|
||||
static TileDesc parse(const std::string& message)
|
||||
{
|
||||
return parse(Util::tokenize(message.data(), message.size()));
|
||||
return parse(StringVector::tokenize(message.data(), message.size()));
|
||||
}
|
||||
|
||||
std::string generateID() const
|
||||
|
@ -304,12 +305,12 @@ private:
|
|||
throw BadArgumentException("Invalid tilecombine descriptor.");
|
||||
}
|
||||
|
||||
StringVector positionXtokens(Util::tokenize(tilePositionsX, ','));
|
||||
StringVector positionYtokens(Util::tokenize(tilePositionsY, ','));
|
||||
StringVector imgSizeTokens(Util::tokenize(imgSizes, ','));
|
||||
StringVector verTokens(Util::tokenize(vers, ','));
|
||||
StringVector oldWireIdTokens(Util::tokenize(oldWireIds, ','));
|
||||
StringVector wireIdTokens(Util::tokenize(wireIds, ','));
|
||||
StringVector positionXtokens(StringVector::tokenize(tilePositionsX, ','));
|
||||
StringVector positionYtokens(StringVector::tokenize(tilePositionsY, ','));
|
||||
StringVector imgSizeTokens(StringVector::tokenize(imgSizes, ','));
|
||||
StringVector verTokens(StringVector::tokenize(vers, ','));
|
||||
StringVector oldWireIdTokens(StringVector::tokenize(oldWireIds, ','));
|
||||
StringVector wireIdTokens(StringVector::tokenize(wireIds, ','));
|
||||
|
||||
const std::size_t numberOfPositions = positionXtokens.size();
|
||||
|
||||
|
@ -522,7 +523,7 @@ public:
|
|||
/// Deserialize a TileDesc from a string format.
|
||||
static TileCombined parse(const std::string& message)
|
||||
{
|
||||
return parse(Util::tokenize(message.data(), message.size()));
|
||||
return parse(StringVector::tokenize(message.data(), message.size()));
|
||||
}
|
||||
|
||||
static TileCombined create(const std::vector<TileDesc>& tiles)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "Protocol.hpp"
|
||||
#include "Log.hpp"
|
||||
#include "Util.hpp"
|
||||
#include "StringVector.hpp"
|
||||
#include "FileUtil.hpp"
|
||||
|
||||
/// Dumps commands and notification trace.
|
||||
|
@ -197,7 +198,7 @@ public:
|
|||
// Remap the URL to the snapshot.
|
||||
if (COOLProtocol::matchPrefix("load", data))
|
||||
{
|
||||
StringVector tokens = Util::tokenize(data);
|
||||
StringVector tokens = StringVector::tokenize(data);
|
||||
if (tokens.size() >= 2)
|
||||
{
|
||||
std::string url;
|
||||
|
|
Loading…
Reference in New Issue