diff --git a/src/kiwano-audio/Transcoder.cpp b/src/kiwano-audio/Transcoder.cpp index c2be5f8c..42e02539 100644 --- a/src/kiwano-audio/Transcoder.cpp +++ b/src/kiwano-audio/Transcoder.cpp @@ -74,9 +74,10 @@ HRESULT Transcoder::LoadMediaFile(const String& file_path) { HRESULT hr = S_OK; - ComPtr reader; + WideString path = strings::ToWide(file_path); - hr = dlls::MediaFoundation::Get().MFCreateSourceReaderFromURL(string::ToWide(file_path).c_str(), nullptr, &reader); + ComPtr reader; + hr = dlls::MediaFoundation::Get().MFCreateSourceReaderFromURL(path.c_str(), nullptr, &reader); if (SUCCEEDED(hr)) { diff --git a/src/kiwano/core/ObjectBase.cpp b/src/kiwano/core/ObjectBase.cpp index 73774984..1e8be8e6 100644 --- a/src/kiwano/core/ObjectBase.cpp +++ b/src/kiwano/core/ObjectBase.cpp @@ -89,7 +89,7 @@ void ObjectBase::SetName(const String& name) String ObjectBase::DumpObject() { - return string::Format("{ class=\"%s\" id=%d refcount=%d name=\"%s\" }", typeid(*this).name(), GetObjectID(), + return strings::Format("{ class=\"%s\" id=%d refcount=%d name=\"%s\" }", typeid(*this).name(), GetObjectID(), GetRefCount(), GetName().c_str()); } diff --git a/src/kiwano/core/String.cpp b/src/kiwano/core/String.cpp index 896d32d1..04948cc6 100644 --- a/src/kiwano/core/String.cpp +++ b/src/kiwano/core/String.cpp @@ -24,7 +24,7 @@ namespace kiwano { -namespace string +namespace strings { #if defined(KGE_PLATFORM_WINDOWS) diff --git a/src/kiwano/core/String.h b/src/kiwano/core/String.h index ef8c91f0..83103ee4 100644 --- a/src/kiwano/core/String.h +++ b/src/kiwano/core/String.h @@ -32,7 +32,7 @@ using String = std::string; /// @brief 宽字符串容器 using WideString = std::wstring; -namespace string +namespace strings { /// \~chinese diff --git a/src/kiwano/platform/win32/WindowImpl.cpp b/src/kiwano/platform/win32/WindowImpl.cpp index 543dd238..1f15f5f3 100644 --- a/src/kiwano/platform/win32/WindowImpl.cpp +++ b/src/kiwano/platform/win32/WindowImpl.cpp @@ -278,7 +278,7 @@ void WindowWin32Impl::Init(const String& title, uint32_t width, uint32_t height, height = win_height; } - WideString wide_title = string::ToWide(title); + WideString wide_title = strings::ToWide(title); handle_ = ::CreateWindowExW(is_fullscreen_ ? WS_EX_TOPMOST : 0, L"KiwanoAppWnd", wide_title.c_str(), GetStyle(), left, top, width, height, nullptr, nullptr, hinst, nullptr); @@ -321,7 +321,7 @@ void WindowWin32Impl::SetTitle(const String& title) { if (handle_) { - WideString wide_title = string::ToWide(title); + WideString wide_title = strings::ToWide(title); ::SetWindowTextW(handle_, wide_title.c_str()); } } @@ -630,7 +630,7 @@ LRESULT WindowWin32Impl::MessageProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA { KGE_SYS_LOG("Window title changed"); - this->title_ = string::ToNarrow(reinterpret_cast(lparam)); + this->title_ = strings::ToNarrow(reinterpret_cast(lparam)); WindowTitleChangedEventPtr evt = new WindowTitleChangedEvent; evt->title = this->title_; diff --git a/src/kiwano/render/DirectX/FontCollectionLoader.cpp b/src/kiwano/render/DirectX/FontCollectionLoader.cpp index d3f94e8e..3c0fb0c9 100644 --- a/src/kiwano/render/DirectX/FontCollectionLoader.cpp +++ b/src/kiwano/render/DirectX/FontCollectionLoader.cpp @@ -305,7 +305,7 @@ HRESULT STDMETHODCALLTYPE FontFileEnumerator::MoveNext(_Out_ BOOL* hasCurrentFil if (nextIndex_ < filePaths_.size()) { - WideString file_name = string::ToWide(filePaths_[nextIndex_]); + WideString file_name = strings::ToWide(filePaths_[nextIndex_]); hr = pFactory_->CreateFontFileReference(file_name.c_str(), NULL, ¤tFile_); diff --git a/src/kiwano/render/DirectX/RendererImpl.cpp b/src/kiwano/render/DirectX/RendererImpl.cpp index efb0198f..1f4e8042 100644 --- a/src/kiwano/render/DirectX/RendererImpl.cpp +++ b/src/kiwano/render/DirectX/RendererImpl.cpp @@ -168,7 +168,7 @@ void RendererImpl::CreateTexture(Texture& texture, const String& file_path) if (SUCCEEDED(hr)) { - WideString full_path = string::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path)); + WideString full_path = strings::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path)); ComPtr decoder; hr = d2d_res_->CreateBitmapDecoderFromFile(decoder, full_path.c_str()); @@ -279,7 +279,7 @@ void RendererImpl::CreateGifImage(GifImage& gif, const String& file_path) if (SUCCEEDED(hr)) { - WideString full_path = string::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path)); + WideString full_path = strings::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path)); ComPtr decoder; hr = d2d_res_->CreateBitmapDecoderFromFile(decoder, full_path.c_str()); @@ -581,7 +581,7 @@ void RendererImpl::CreateTextLayout(TextLayout& layout, const String& content, c if (SUCCEEDED(hr)) { - WideString font_family = style.font_family.empty() ? L"" : string::ToWide(style.font_family); + WideString font_family = style.font_family.empty() ? L"" : strings::ToWide(style.font_family); DWRITE_FONT_WEIGHT font_weight = DWRITE_FONT_WEIGHT(style.font_weight); DWRITE_FONT_STYLE font_style = style.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; auto collection = NativePtr::Get(style.font); @@ -592,7 +592,7 @@ void RendererImpl::CreateTextLayout(TextLayout& layout, const String& content, c if (SUCCEEDED(hr)) { - WideString wide = string::ToWide(content); + WideString wide = strings::ToWide(content); ComPtr output; hr = d2d_res_->CreateTextLayout(output, wide.c_str(), wide.length(), format); diff --git a/src/kiwano/render/TextLayout.cpp b/src/kiwano/render/TextLayout.cpp index 08ddecbb..210e1d2a 100644 --- a/src/kiwano/render/TextLayout.cpp +++ b/src/kiwano/render/TextLayout.cpp @@ -127,7 +127,7 @@ void TextLayout::SetFontFamily(const String& family, TextRange range) if (native) { - WideString font_family = family.empty() ? L"" : string::ToWide(family); + WideString font_family = family.empty() ? L"" : strings::ToWide(family); HRESULT hr = native->SetFontFamilyName(font_family.c_str(), { range.start, range.length }); KGE_THROW_IF_FAILED(hr, "IDWriteTextLayout::SetFontFamilyName failed");