Adds immediate migration results
This commit is contained in:
2395 files changed
+357322
-2524
No files matched your search
@@ -43,7 +43,7 @@ NGL_TARGET_INCLUDE_DIRECTORIES(LtsUtilsCore
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(LtsUtilsCore
|
||||
PUBLIC
|
||||
Qt5::Core
|
||||
Qt6::Core
|
||||
LtsUtilsCoreHeaderOnly
|
||||
)
|
||||
|
||||
@@ -60,8 +60,8 @@ IF((BUILD_WS OR BUILD_SV) AND BUILD_TESTING)
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(utils_test
|
||||
LtsUtilsCore
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
Qt6::Core
|
||||
Qt6::Test
|
||||
ddscore
|
||||
)
|
||||
ADD_TEST(NAME utils_test COMMAND $<TARGET_FILE:utils_test>)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "pgarray.h"
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
#include <QStringView>
|
||||
|
||||
#include <functional>
|
||||
#include <LtsUtilsCore/ltsutilscore_export.h>
|
||||
@@ -37,7 +38,7 @@ LTSUTILSCORE_EXPORT QString BigintArray::toPgString() const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline T convertFromPgString(const QString &str, const std::function<typename T::Type(const QStringRef &val, bool *bOk)> &convertFunc)
|
||||
static inline T convertFromPgString(const QString &str, const std::function<typename T::Type(QStringView val, bool *bOk)> &convertFunc)
|
||||
{
|
||||
typename T::ContainerType result;
|
||||
|
||||
@@ -52,10 +53,10 @@ static inline T convertFromPgString(const QString &str, const std::function<type
|
||||
idxEnd = str.length() + 1;
|
||||
}
|
||||
|
||||
const QStringRef strRef = str.midRef(idxStart + 1, idxEnd - idxStart - 1);
|
||||
const QVector<QStringRef> vec = strRef.split(QLatin1Char(','), QString::SkipEmptyParts);
|
||||
const QStringView strRef = QStringView(str).mid(idxStart + 1, idxEnd - idxStart - 1);
|
||||
const QVector<QStringView> vec = strRef.split(QLatin1Char(','), Qt::SkipEmptyParts);
|
||||
result.reserve(vec.size());
|
||||
for (const QStringRef &s : vec)
|
||||
for (const QStringView &s : vec)
|
||||
{
|
||||
bool ok = false;
|
||||
const typename T::Type i = convertFunc(s, &ok);
|
||||
@@ -70,14 +71,14 @@ template<>
|
||||
LTSUTILSCORE_EXPORT IntArray IntArray::fromPgString(const QString &str)
|
||||
{
|
||||
return convertFromPgString<IntArray>(str,
|
||||
[](const QStringRef & val, bool * bOk) { return val.toInt(bOk);});
|
||||
[](QStringView val, bool * bOk) { return val.toString().toInt(bOk);});
|
||||
}
|
||||
|
||||
template<>
|
||||
LTSUTILSCORE_EXPORT BigintArray BigintArray::fromPgString(const QString &str)
|
||||
{
|
||||
return convertFromPgString<BigintArray>(str,
|
||||
[](const QStringRef & val, bool * bOk) { return val.toLongLong(bOk);});
|
||||
[](QStringView val, bool * bOk) { return val.toString().toLongLong(bOk);});
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +116,7 @@ LTSUTILSCORE_EXPORT QString BigintArray2D::toPgString() const
|
||||
|
||||
|
||||
template<typename T>
|
||||
static inline T convertFromPgString2D(const QString &str, const std::function<typename T::Type(const QStringRef &val)> &convertFunc)
|
||||
static inline T convertFromPgString2D(const QString &str, const std::function<typename T::Type(QStringView val)> &convertFunc)
|
||||
{
|
||||
typename T::ContainerType ret;
|
||||
int idxStart = str.indexOf(QLatin1Char('{'));
|
||||
@@ -129,7 +130,7 @@ static inline T convertFromPgString2D(const QString &str, const std::function<ty
|
||||
idxEnd = str.length() + 1;
|
||||
}
|
||||
|
||||
const QStringRef strRef = str.midRef(idxStart + 1, idxEnd - idxStart - 1);
|
||||
const QStringView strRef = QStringView(str).mid(idxStart + 1, idxEnd - idxStart - 1);
|
||||
idxStart = strRef.indexOf(QLatin1Char('{'));
|
||||
while (idxStart >= 0)
|
||||
{
|
||||
@@ -137,8 +138,8 @@ static inline T convertFromPgString2D(const QString &str, const std::function<ty
|
||||
if (idxEnd < 0)
|
||||
break;
|
||||
|
||||
const QStringRef keyValueStr = strRef.mid(idxStart + 1, idxEnd - idxStart - 1);
|
||||
const QVector<QStringRef> keyValuePair = keyValueStr.split(QLatin1Char(','), QString::SkipEmptyParts);
|
||||
const QStringView keyValueStr = strRef.mid(idxStart + 1, idxEnd - idxStart - 1);
|
||||
const QVector<QStringView> keyValuePair = keyValueStr.split(QLatin1Char(','), Qt::SkipEmptyParts);
|
||||
if (keyValuePair.size() != 2)
|
||||
break;
|
||||
const typename T::Type key = convertFunc(keyValuePair.at(0).trimmed());
|
||||
@@ -156,14 +157,14 @@ template<>
|
||||
LTSUTILSCORE_EXPORT IntArray2D IntArray2D::fromPgString(const QString &str)
|
||||
{
|
||||
return convertFromPgString2D<IntArray2D>(str,
|
||||
[](const QStringRef & val) { return val.toInt();});
|
||||
[](QStringView val) { return val.toString().toInt();});
|
||||
}
|
||||
|
||||
template<>
|
||||
LTSUTILSCORE_EXPORT BigintArray2D BigintArray2D::fromPgString(const QString &str)
|
||||
{
|
||||
return convertFromPgString2D<BigintArray2D>(str,
|
||||
[](const QStringRef & val) { return val.toLongLong();});
|
||||
[](QStringView val) { return val.toString().toLongLong();});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user