Revise string literal usage

PR #16703.
This commit is contained in:
Chocobo1
2022-03-26 11:53:50 +08:00
committed by GitHub
parent e1abcc684a
commit 4ca6de2b54
55 changed files with 485 additions and 472 deletions

View File

@@ -34,6 +34,7 @@
#include <QString>
#include "base/exceptions.h"
#include "base/global.h"
namespace Utils
{
@@ -63,7 +64,7 @@ namespace Utils
* @throws RuntimeError if parsing fails
*/
Version(const QString &version)
: Version {version.split(QLatin1Char('.'))}
: Version {version.split(u'.')}
{
}
@@ -119,7 +120,7 @@ namespace Utils
QString res = QString::number((*this)[0]);
for (std::size_t i = 1; i <= lastSignificantIndex; ++i)
res += QLatin1Char('.') + QString::number((*this)[i]);
res += (u'.' + QString::number((*this)[i]));
return res;
}
@@ -162,7 +163,7 @@ namespace Utils
if ((static_cast<std::size_t>(versionParts.size()) > N)
|| (static_cast<std::size_t>(versionParts.size()) < Mandatory))
{
throw RuntimeError(QLatin1String("Incorrect number of version components"));
throw RuntimeError(u"Incorrect number of version components"_qs);
}
bool ok = false;
@@ -171,7 +172,7 @@ namespace Utils
{
res[i] = static_cast<T>(versionParts[static_cast<typename StringsList::size_type>(i)].toInt(&ok));
if (!ok)
throw RuntimeError(QLatin1String("Can not parse version component"));
throw RuntimeError(u"Can not parse version component"_qs);
}
return res;
}