4 Commits
17 changed files with 166 additions and 261 deletions
+3 -3
View File
@@ -19,7 +19,7 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false BinPackArguments: false
BinPackParameters: false BinPackParameters: false
BraceWrapping: BraceWrapping:
AfterClass: true AfterClass: true
AfterControlStatement: true AfterControlStatement: true
AfterEnum: true AfterEnum: true
@@ -55,13 +55,13 @@ DerivePointerAlignment: false
DisableFormat: false DisableFormat: false
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true FixNamespaceComments: true
ForEachMacros: ForEachMacros:
- forever - forever
- foreach - foreach
- Q_FOREACH - Q_FOREACH
- BOOST_FOREACH - BOOST_FOREACH
IncludeBlocks: Preserve IncludeBlocks: Preserve
IncludeCategories: IncludeCategories:
- Regex: '^<Q.*' - Regex: '^<Q.*'
Priority: 200 Priority: 200
- Regex: '^(<|"(gtest|gmock|isl|json)/)' - Regex: '^(<|"(gtest|gmock|isl|json)/)'
-7
View File
@@ -1,7 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text eol=crlf
*.h text eol=crlf
-64
View File
@@ -1,64 +0,0 @@
name: Build libbsarch
on:
push:
branches: [master]
tags:
- "*"
pull_request:
types: [opened, synchronize, reopened]
env:
VCPKG_BINARY_SOURCES: clear;x-azblob,${{ vars.AZ_BLOB_VCPKG_URL }},${{ secrets.AZ_BLOB_SAS }},readwrite
jobs:
build:
runs-on: windows-2022
steps:
- name: "Set environmental variables"
shell: bash
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
- uses: actions/checkout@v4
- run: cmake --preset vs2022-windows "-DCMAKE_INSTALL_PREFIX=install"
# build both Debug and Release for package
- name: Build libbsarch
run: |
cmake --build vsbuild --config Debug --verbose
cmake --build vsbuild --config Release --verbose
- name: Install libbsarch
run: |
cmake --install vsbuild --config Debug
cmake --install vsbuild --config Release
- name: Upload libbsarch artifact
uses: actions/upload-artifact@master
with:
name: libbsarch
path: ./install
publish:
if: github.ref_type == 'tag'
needs: build
runs-on: windows-2022
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@master
with:
name: libbsarch
path: ./install
- name: Create libbsarch archive
run: 7z a libbsarch_${{ github.ref_name }}.7z ./install/*
- name: Publish Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh release create --draft=false --notes="${{ github.ref_name }}" "${{ github.ref_name }}" ./libbsarch_${{ github.ref_name }}.7z
-17
View File
@@ -1,17 +0,0 @@
name: Lint libbsarch
on:
push:
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check format
uses: ModOrganizer2/check-formatting-action@master
with:
check-path: "."
exclude-regex: "third-party"
-20
View File
@@ -1,20 +0,0 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-case-conflict
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5
hooks:
- id: clang-format
'types_or': [c++, c]
ci:
autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks."
autofix_prs: true
autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate."
autoupdate_schedule: quarterly
submodules: false
+10 -7
View File
@@ -5,6 +5,7 @@ include(CMakePackageConfigHelpers)
project(libbsarch CXX) project(libbsarch CXX)
find_package(mo2-dds-header CONFIG REQUIRED) find_package(mo2-dds-header CONFIG REQUIRED)
find_package(Qt6 COMPONENTS Core)
get_target_property(SRCS mo2::dds-header SOURCES) get_target_property(SRCS mo2::dds-header SOURCES)
@@ -73,6 +74,14 @@ if (MSVC)
target_compile_options(libbsarch_OOP PRIVATE /MP) target_compile_options(libbsarch_OOP PRIVATE /MP)
endif() endif()
# adding Qt support
if(Qt6_FOUND)
message("libbsarch: Qt6 found, enabling Qt support")
target_link_libraries(libbsarch_OOP PUBLIC Qt::Core)
target_compile_definitions(libbsarch PUBLIC "LIBBSARCH_QT_SUPPORT")
target_compile_definitions(libbsarch_OOP PUBLIC "LIBBSARCH_QT_SUPPORT")
endif()
# target_link_libraries(libbsarch_OOP PUBLIC libbsarch) # target_link_libraries(libbsarch_OOP PUBLIC libbsarch)
# install # install
@@ -107,15 +116,9 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in
NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO
) )
include(${CMAKE_CURRENT_SOURCE_DIR}/Version.cmake)
set(LIBBSARCH_VERSION
${LIBBSARCH_MAJOR_VERSION}.${LIBBSARCH_MINOR_VERSION}.${LIBBSARCH_PATCH_VERSION})
write_basic_package_version_file( write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/mo2-libbsarch-config-version.cmake" "${CMAKE_CURRENT_BINARY_DIR}/mo2-libbsarch-config-version.cmake"
VERSION "${LIBBSARCH_VERSION}" VERSION "0.0.13"
COMPATIBILITY AnyNewerVersion COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT ARCH_INDEPENDENT
) )
-3
View File
@@ -1,3 +0,0 @@
set(LIBBSARCH_MAJOR_VERSION 0)
set(LIBBSARCH_MINOR_VERSION 1)
set(LIBBSARCH_PATCH_VERSION 2)
+1 -1
View File
@@ -20,7 +20,7 @@ type
TwbBSResultMessageBuffer = packed record TwbBSResultMessageBuffer = packed record
buffer: TwbBSResultBuffer; buffer: TwbBSResultBuffer;
message: TwbBSResultMessage; message: TwbBSResultMessage;
end; end;
{Shared} {Shared}
+3 -3
View File
@@ -62,17 +62,17 @@ public:
void *context) void *context)
{ {
const auto &path = *static_cast<convertible_string *>(context) + '/' + convertible_string(file_path); const auto &path = *static_cast<convertible_string *>(context) + '/' + convertible_string(file_path);
auto image = std::make_unique<DirectX::ScratchImage>(); auto image = std::make_unique<DirectX::ScratchImage>();
DirectX::TexMetadata info; DirectX::TexMetadata info;
const auto hr = LoadFromDDSFile(PREPARE_PATH_LIBBSARCH(path), DirectX::DDS_FLAGS_BAD_DXTN_TAILS, &info, *image); const auto hr = LoadFromDDSFile(PREPARE_PATH_LIBBSARCH(path), DirectX::DDS_FLAGS_BAD_DXTN_TAILS, &info, *image);
if (FAILED(hr)) if (FAILED(hr))
{ {
//Do not throw here. Exceptions will be ignored //Do not throw here. Exceptions will be ignored
return; return;
} }
dds_info->width = info.width; dds_info->width = info.width;
dds_info->height = info.height; dds_info->height = info.height;
dds_info->mipmaps = info.mipLevels; dds_info->mipmaps = info.mipLevels;
+1 -1
View File
@@ -8,7 +8,7 @@
namespace libbsarch { namespace libbsarch {
/*! /*!
* \brief The bs_archive_auto class is a convenience class. It manages both bs_archive and bs_archive_entries. * \brief The bs_archive_auto class is a convenience class. It manages both bs_archive and bs_archive_entries.
* It is recommended when packing from disk/extracting to disk * It is recommended when packing from disk/extracting to disk
* Otherwise, if using memory, the use of these two separate classes is recommended * Otherwise, if using memory, the use of these two separate classes is recommended
*/ */
@@ -13,10 +13,6 @@
#include "string_convert.hpp" #include "string_convert.hpp"
namespace libbsarch { namespace libbsarch {
template<typename String>
class convertible_string_converter;
class convertible_string class convertible_string
{ {
public: public:
@@ -39,6 +35,12 @@ public:
operator std::wstring() const; operator std::wstring() const;
operator const wchar_t *() const; operator const wchar_t *() const;
#ifdef LIBBSARCH_QT_SUPPORT
convertible_string(const QString &qsvalue, bool to_native_path = true);
convertible_string &operator=(const QString &qsvalue);
operator QString() const;
#endif
/* Util */ /* Util */
bool remove_substring(const convertible_string &sub_str); bool remove_substring(const convertible_string &sub_str);
convertible_string &to_native_path(); convertible_string &to_native_path();
@@ -13,6 +13,13 @@
#include <string> #include <string>
namespace libbsarch { namespace libbsarch {
#ifdef LIBBSARCH_QT_SUPPORT
std::wstring to_wstring(const QString &str);
std::string to_string(const QString &str);
QString to_qstring(const std::string &str);
QString to_qstring(const std::wstring &str);
#endif
std::string to_string(const std::wstring &str); std::string to_string(const std::wstring &str);
std::wstring to_wstring(const std::string &str); std::wstring to_wstring(const std::string &str);
} // namespace libbsarch } // namespace libbsarch
+4 -2
View File
@@ -69,12 +69,14 @@ void bs_archive_auto::save_to_disk(const convertible_string &archive_path)
{ {
switch (file.data.index()) switch (file.data.index())
{ {
case 0: { case 0:
{
const auto &blob = std::get<memory_blob>(file.data); const auto &blob = std::get<memory_blob>(file.data);
bs_archive::add_file_from_memory(file.path_in_archive, blob); bs_archive::add_file_from_memory(file.path_in_archive, blob);
break; break;
} }
case 1: { case 1:
{
const auto &file_path = std::get<convertible_string>(file.data); const auto &file_path = std::get<convertible_string>(file.data);
const auto &blob = disk_blob(file.path_in_archive, file_path, bool()); const auto &blob = disk_blob(file.path_in_archive, file_path, bool());
bs_archive::add_file_from_disk(blob); bs_archive::add_file_from_disk(blob);
+4 -2
View File
@@ -3,7 +3,8 @@
namespace libbsarch { namespace libbsarch {
bs_archive_entries::bs_archive_entries() bs_archive_entries::bs_archive_entries()
: _entries(bsa_entry_list_create()) : _entries(bsa_entry_list_create())
{} {
}
bs_archive_entries::bs_archive_entries(const std::vector<convertible_string> &entries) bs_archive_entries::bs_archive_entries(const std::vector<convertible_string> &entries)
: _entries(bsa_entry_list_create()) : _entries(bsa_entry_list_create())
@@ -14,7 +15,8 @@ bs_archive_entries::bs_archive_entries(const std::vector<convertible_string> &en
bs_archive_entries::bs_archive_entries(const bsa_entry_list_t &entries) bs_archive_entries::bs_archive_entries(const bsa_entry_list_t &entries)
: _entries(entries) : _entries(entries)
{} {
}
bs_archive_entries::~bs_archive_entries() bs_archive_entries::~bs_archive_entries()
{ {
+75 -127
View File
@@ -3,204 +3,152 @@
namespace libbsarch { namespace libbsarch {
BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create() BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create() {
{ return NULL;
return NULL;
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_free(bsa_entry_list_t entry_list) BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_free(bsa_entry_list_t entry_list) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(uint32_t) bsa_entry_list_count(bsa_entry_list_t entry_list) BSARCH_DLL_API(uint32_t) bsa_entry_list_count(bsa_entry_list_t entry_list) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_list, const wchar_t *entry_string) BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_list, const wchar_t *entry_string) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(uint32_t) BSARCH_DLL_API(uint32_t) bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, wchar_t *string_buffer) {
bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, wchar_t *string_buffer) return 0;
{
return 0;
} }
BSARCH_DLL_API(bsa_archive_t) bsa_create() BSARCH_DLL_API(bsa_archive_t) bsa_create() {
{ return NULL;
return NULL;
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_free(bsa_archive_t archive) BSARCH_DLL_API(bsa_result_message_t) bsa_free(bsa_archive_t archive) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_load_from_file(bsa_archive_t archive, const wchar_t *file_path) BSARCH_DLL_API(bsa_result_message_t) bsa_load_from_file(bsa_archive_t archive, const wchar_t *file_path) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_create_archive(bsa_archive_t archive, const wchar_t *file_path, bsa_archive_type_t archive_type, bsa_entry_list_t entry_list) {
bsa_create_archive(bsa_archive_t archive, return { 0 };
const wchar_t *file_path,
bsa_archive_type_t archive_type,
bsa_entry_list_t entry_list)
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_save(bsa_archive_t archive) BSARCH_DLL_API(bsa_result_message_t) bsa_save(bsa_archive_t archive) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_disk(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *source_path) {
bsa_add_file_from_disk(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *source_path) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_disk_root(bsa_archive_t archive, const wchar_t* root_dir, const wchar_t* source_path) {
bsa_add_file_from_disk_root(bsa_archive_t archive, const wchar_t *root_dir, const wchar_t *source_path) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_memory(bsa_archive_t archive, const wchar_t *file_path, uint32_t size, bsa_buffer_t data) {
bsa_add_file_from_memory(bsa_archive_t archive, const wchar_t *file_path, uint32_t size, bsa_buffer_t data) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_file_record_t) bsa_find_file_record(bsa_archive_t archive, const wchar_t *file_path) BSARCH_DLL_API(bsa_file_record_t) bsa_find_file_record(bsa_archive_t archive, const wchar_t *file_path) {
{ return NULL;
return NULL;
} }
BSARCH_DLL_API(bsa_result_message_buffer_t) BSARCH_DLL_API(bsa_result_message_buffer_t) bsa_extract_file_data_by_record(bsa_archive_t archive, bsa_file_record_t file_record) {
bsa_extract_file_data_by_record(bsa_archive_t archive, bsa_file_record_t file_record) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_buffer_t) BSARCH_DLL_API(bsa_result_message_buffer_t) bsa_extract_file_data_by_filename(bsa_archive_t archive, const wchar_t *file_path) {
bsa_extract_file_data_by_filename(bsa_archive_t archive, const wchar_t *file_path) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_file_data_free(bsa_archive_t archive, bsa_result_buffer_t file_data_result) BSARCH_DLL_API(bsa_result_message_t) bsa_file_data_free(bsa_archive_t archive, bsa_result_buffer_t file_data_result) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_extract_file(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *save_as) {
bsa_extract_file(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *save_as) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_iterate_files(bsa_archive_t archive, bsa_file_iteration_proc_t file_iteration_proc, void *context) {
bsa_iterate_files(bsa_archive_t archive, bsa_file_iteration_proc_t file_iteration_proc, void *context) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bool) bsa_file_exists(bsa_archive_t archive, const wchar_t *file_path) BSARCH_DLL_API(bool) bsa_file_exists(bsa_archive_t archive, const wchar_t *file_path) {
{ return false;
return false;
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_get_resource_list(bsa_archive_t archive, bsa_entry_list_t entry_result_list, const wchar_t *folder) {
bsa_get_resource_list(bsa_archive_t archive, bsa_entry_list_t entry_result_list, const wchar_t *folder) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) BSARCH_DLL_API(bsa_result_message_t) bsa_resolve_hash(bsa_archive_t archive, uint64_t hash, bsa_entry_list_t entry_result_list) {
bsa_resolve_hash(bsa_archive_t archive, uint64_t hash, bsa_entry_list_t entry_result_list) return { 0 };
{
return {0};
} }
BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive) BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive) {
{ return { 0 };
return {0};
} }
BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(bsa_archive_type_t) bsa_archive_type_get(bsa_archive_t archive) BSARCH_DLL_API(bsa_archive_type_t) bsa_archive_type_get(bsa_archive_t archive) {
{ return bsa_archive_type_t::baNone;
return bsa_archive_type_t::baNone;
} }
BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive) BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(uint32_t) bsa_file_count_get(bsa_archive_t archive) BSARCH_DLL_API(uint32_t) bsa_file_count_get(bsa_archive_t archive) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(uint32_t) bsa_archive_flags_get(bsa_archive_t archive) BSARCH_DLL_API(uint32_t) bsa_archive_flags_get(bsa_archive_t archive) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(void) bsa_archive_flags_set(bsa_archive_t archive, uint32_t flags) BSARCH_DLL_API(void) bsa_archive_flags_set(bsa_archive_t archive, uint32_t flags) {
{ return;
return;
} }
BSARCH_DLL_API(uint32_t) bsa_file_flags_get(bsa_archive_t archive) BSARCH_DLL_API(uint32_t) bsa_file_flags_get(bsa_archive_t archive) {
{ return 0;
return 0;
} }
BSARCH_DLL_API(void) bsa_file_flags_set(bsa_archive_t archive, uint32_t flags) BSARCH_DLL_API(void) bsa_file_flags_set(bsa_archive_t archive, uint32_t flags) {
{ return;
return;
} }
BSARCH_DLL_API(bool) bsa_compress_get(bsa_archive_t archive) BSARCH_DLL_API(bool) bsa_compress_get(bsa_archive_t archive) {
{ return false;
return false;
} }
BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags) BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags) {
{ return;
return;
} }
BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive) BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive) {
{ return false;
return false;
} }
BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags) BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags) {
{ return;
return;
} }
BSARCH_DLL_API(void) BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context) {
bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context) return;
{ }
return;
} }
} // namespace libbsarch
#endif #endif
+23
View File
@@ -100,4 +100,27 @@ convertible_string &convertible_string::to_native_path()
return *this; return *this;
} }
#ifdef LIBBSARCH_QT_SUPPORT
convertible_string::convertible_string(const QString &qsvalue, bool to_native_path)
: str_(to_string(qsvalue))
, auto_convert_to_native_path(to_native_path)
{
if (auto_convert_to_native_path)
this->to_native_path();
}
convertible_string &convertible_string::operator=(const QString &qsvalue)
{
str_ = to_string(qsvalue);
if (auto_convert_to_native_path)
this->to_native_path();
return *this;
}
convertible_string::operator QString() const
{
return to_qstring(str_);
}
#endif
} // namespace libbsarch } // namespace libbsarch
+29
View File
@@ -5,6 +5,35 @@
#include "string_convert.hpp" #include "string_convert.hpp"
namespace libbsarch { namespace libbsarch {
#ifdef LIBBSARCH_QT_SUPPORT
std::wstring to_wstring(const QString &str)
{
#ifdef _MSC_VER
return std::wstring(reinterpret_cast<const wchar_t *>(str.utf16()));
#else
return str.toStdWString();
#endif
}
std::string to_string(const QString &str)
{
return str.toStdString();
}
QString to_qstring(const std::string &str)
{
return QString::fromStdString(str);
}
QString to_qstring(const std::wstring &str)
{
#ifdef _MSC_VER
return QString::fromUtf16(reinterpret_cast<const ushort *>(str.c_str()));
#else
return QString::fromStdWString(str);
#endif
}
#endif
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> s_converter; static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> s_converter;
std::string to_string(const std::wstring &str) std::string to_string(const std::wstring &str)