refactor: Replace deskflow::string::stringToSizeType with QString::size()
This commit is contained in:
@ -12,7 +12,6 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
namespace deskflow::string {
|
||||
@ -140,14 +139,6 @@ std::string sprintf(const char *fmt, ...)
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t stringToSizeType(const std::string &string)
|
||||
{
|
||||
std::istringstream iss(string);
|
||||
size_t value;
|
||||
iss >> value;
|
||||
return value;
|
||||
}
|
||||
|
||||
//
|
||||
// CaselessCmp
|
||||
//
|
||||
|
||||
@ -40,12 +40,6 @@ Equivalent to sprintf() except the result is returned as a String.
|
||||
*/
|
||||
std::string sprintf(const char *fmt, ...);
|
||||
|
||||
//! Convert a string to a size type
|
||||
/*!
|
||||
Convert an a \c string to an size type
|
||||
*/
|
||||
size_t stringToSizeType(const std::string &string);
|
||||
|
||||
//! Case-insensitive comparisons
|
||||
/*!
|
||||
This class provides case-insensitve comparison functions.
|
||||
|
||||
@ -74,7 +74,7 @@ ClipboardChunk::assemble(deskflow::IStream *stream, std::string &dataCached, Cli
|
||||
}
|
||||
|
||||
if (mark == ChunkType::DataStart) {
|
||||
s_expectedSize = deskflow::string::stringToSizeType(data);
|
||||
s_expectedSize = QString::fromStdString(data).size();
|
||||
LOG_DEBUG("start receiving clipboard data");
|
||||
dataCached.clear();
|
||||
return Started;
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
|
||||
#include "base/String.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void StringTests::formatWithArgs()
|
||||
{
|
||||
const char *format = "%%%{1}=%{2}";
|
||||
@ -33,11 +31,4 @@ void StringTests::formatedString()
|
||||
QCOMPARE("answer=42", result);
|
||||
}
|
||||
|
||||
void StringTests::stringToInt()
|
||||
{
|
||||
std::string number = "123";
|
||||
size_t value = deskflow::string::stringToSizeType(number);
|
||||
QCOMPARE(value, 123);
|
||||
}
|
||||
|
||||
QTEST_MAIN(StringTests)
|
||||
|
||||
@ -12,5 +12,4 @@ class StringTests : public QObject
|
||||
private Q_SLOTS:
|
||||
void formatWithArgs();
|
||||
void formatedString();
|
||||
void stringToInt();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user