Introduce StringVector::equals()

Allows comparing tokens with C strings without a heap allocation. Do the
same when comparing two tokens from two different StringVectors.

And use it at all places where operator ==() has an argument, which is a
StringVector::operator []() result.

Change-Id: Id36eff96767ab99b235ecbd12fb14446a3efa869
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90201
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
This commit is contained in:
Miklos Vajna
2020-03-09 09:05:30 +01:00
committed by Andras Timar
parent 7eea5b85ab
commit a7d3efdd4e
14 changed files with 215 additions and 163 deletions

View File

@ -94,7 +94,7 @@ protected:
if (tokens.size() == 0)
continue;
if (tokens[0] == "?" || tokens[0] == "help")
if (tokens.equals(0, "?") || tokens.equals(0, "help"))
{
std::cout <<
"Commands mimic LOOL protocol but we talk directly to LOKit:" << std::endl <<
@ -103,7 +103,7 @@ protected:
" tile part pixelwidth pixelheight docposx docposy doctilewidth doctileheight" << std::endl <<
" calls LibreOfficeKitDocument::paintTile" << std::endl;
}
else if (tokens[0] == "status")
else if (tokens.equals(0, "status"))
{
if (tokens.size() != 1)
{
@ -116,7 +116,7 @@ protected:
std::cout << " " << i << ": '" << loKitDocument->pClass->getPartName(loKitDocument, i) << "'" << std::endl;
}
}
else if (tokens[0] == "tile")
else if (tokens.equals(0, "tile"))
{
if (tokens.size() != 8)
{