feat: add more separation between types of std::string in StringUtils

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-11-03 16:59:03 -03:00
parent ab6c7244fc
commit dff5fea976
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -5,15 +5,27 @@
namespace StringUtils { namespace StringUtils {
#if defined Q_OS_WIN32 #if defined Q_OS_WIN32
inline std::wstring toStdString(QString s) using string = std::wstring;
inline string toStdString(QString s)
{ {
return s.toStdWString(); return s.toStdWString();
} }
inline QString fromStdString(string s)
{
return QString::fromStdWString(s);
}
#else #else
inline std::string toStdString(QString s) using string = std::string;
inline string toStdString(QString s)
{ {
return s.toStdString(); return s.toStdString();
} }
inline QString fromStdString(string s)
{
return QString::fromStdString(s);
}
#endif #endif
int naturalCompare(const QString& s1, const QString& s2, Qt::CaseSensitivity cs); int naturalCompare(const QString& s1, const QString& s2, Qt::CaseSensitivity cs);