diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-11-08 15:05:19 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-11-08 22:21:31 +0100 |
commit | efa293290cf7ab3520e4d72552aeecf68ffde2ce (patch) | |
tree | 451bf5d08782fba7d9f3a07909c471e1588539dd /kit | |
parent | d906c78198468d10d70de31a23b4166924dd7550 (diff) |
killpoco: Remove trivial StringTokenizer uses from some files.
Particularly those used on Android...
Change-Id: I47bf9692f5e99ba30140d698558472201168a198
Reviewed-on: https://gerrit.libreoffice.org/82302
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'kit')
-rw-r--r-- | kit/ChildSession.cpp | 8 | ||||
-rw-r--r-- | kit/Kit.cpp | 14 |
2 files changed, 9 insertions, 13 deletions
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index c2fc39a77..98101b6b1 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -20,7 +20,6 @@ #include <Poco/JSON/Object.h> #include <Poco/JSON/Parser.h> #include <Poco/Net/WebSocket.h> -#include <Poco/StringTokenizer.h> #include <Poco/StreamCopier.h> #include <Poco/URI.h> #include <Poco/BinaryReader.h> @@ -46,7 +45,6 @@ using Poco::JSON::Object; using Poco::JSON::Parser; -using Poco::StringTokenizer; using Poco::URI; using namespace LOOLProtocol; @@ -2270,8 +2268,8 @@ void ChildSession::loKitCallback(const int type, const std::string& payload) { case LOK_CALLBACK_INVALIDATE_TILES: { - StringTokenizer tokens(payload, ",", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); - if (tokens.count() == 5) + std::vector<std::string> tokens(LOOLProtocol::tokenize(payload, ',')); + if (tokens.size() == 5) { int part, x, y, width, height; try @@ -2300,7 +2298,7 @@ void ChildSession::loKitCallback(const int type, const std::string& payload) " width=" + std::to_string(width) + " height=" + std::to_string(height)); } - else if (tokens.count() == 2 && tokens[0] == "EMPTY") + else if (tokens.size() == 2 && tokens[0] == "EMPTY") { const std::string part = (_docType != "text" ? tokens[1].c_str() : "0"); // Writer renders everything as part 0. sendTextFrame("invalidatetiles: EMPTY, " + part); diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 4a152ef91..d04277bf8 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -50,7 +50,6 @@ #include <Poco/Net/Socket.h> #include <Poco/Process.h> #include <Poco/Runnable.h> -#include <Poco/StringTokenizer.h> #include <Poco/URI.h> #include "ChildSession.hpp" @@ -95,7 +94,6 @@ using Poco::File; using Poco::JSON::Array; using Poco::JSON::Object; using Poco::JSON::Parser; -using Poco::StringTokenizer; using Poco::URI; #ifndef BUILDING_TESTS @@ -1225,9 +1223,9 @@ public: if (type == LOK_CALLBACK_CELL_CURSOR) { - Poco::StringTokenizer tokens(payload, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); + std::vector<std::string> tokens(LOOLProtocol::tokenize(payload, ',')); // Payload may be 'EMPTY'. - if (tokens.count() == 4) + if (tokens.size() == 4) { int cursorX = std::stoi(tokens[0]); int cursorY = std::stoi(tokens[1]); @@ -1243,9 +1241,9 @@ 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(); - Poco::StringTokenizer tokens(rectangle, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); + std::vector<std::string> tokens(LOOLProtocol::tokenize(rectangle, ',')); // Payload may be 'EMPTY'. - if (tokens.count() == 4) + if (tokens.size() == 4) { int cursorX = std::stoi(tokens[0]); int cursorY = std::stoi(tokens[1]); @@ -1264,9 +1262,9 @@ public: targetViewId = command->get("viewId").toString(); std::string part = command->get("part").toString(); std::string text = command->get("rectangle").toString(); - Poco::StringTokenizer tokens(text, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); + std::vector<std::string> tokens(LOOLProtocol::tokenize(text, ',')); // Payload may be 'EMPTY'. - if (tokens.count() == 4) + if (tokens.size() == 4) { int cursorX = std::stoi(tokens[0]); int cursorY = std::stoi(tokens[1]); |