2018-09-24 12:34:54 -04:00
|
|
|
#include "QStringUtils.h"
|
|
|
|
|
|
|
|
template <typename Type>
|
|
|
|
static Type CvtToNativePath(const QString& str);
|
|
|
|
|
|
|
|
template <typename Type>
|
|
|
|
static QString CvtToString(const Type& str);
|
|
|
|
|
|
|
|
template <>
|
2018-09-25 14:25:52 -04:00
|
|
|
std::string CvtToNativePath(const QString& str)
|
2018-09-24 12:34:54 -04:00
|
|
|
{
|
|
|
|
return str.toStdString();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2018-09-25 14:25:52 -04:00
|
|
|
std::wstring CvtToNativePath(const QString& str)
|
2018-09-24 12:34:54 -04:00
|
|
|
{
|
|
|
|
return str.toStdWString();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2018-09-25 14:25:52 -04:00
|
|
|
QString CvtToString(const std::string& str)
|
2018-09-24 12:34:54 -04:00
|
|
|
{
|
|
|
|
return QString::fromStdString(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2018-09-25 14:25:52 -04:00
|
|
|
QString CvtToString(const std::wstring& str)
|
2018-09-24 12:34:54 -04:00
|
|
|
{
|
|
|
|
return QString::fromStdWString(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
boost::filesystem::path QStringToPath(const QString& str)
|
|
|
|
{
|
|
|
|
auto result = CvtToNativePath<boost::filesystem::path::string_type>(str);
|
|
|
|
return boost::filesystem::path(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString PathToQString(const boost::filesystem::path& path)
|
|
|
|
{
|
|
|
|
return CvtToString(path.native());
|
|
|
|
}
|