[deploy] namespace 'string' rename to 'strings'

This commit is contained in:
Nomango 2020-02-23 22:08:14 +08:00
parent 7b6397b49c
commit f90624eb5b
8 changed files with 15 additions and 14 deletions

View File

@ -74,9 +74,10 @@ HRESULT Transcoder::LoadMediaFile(const String& file_path)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
ComPtr<IMFSourceReader> reader; WideString path = strings::ToWide(file_path);
hr = dlls::MediaFoundation::Get().MFCreateSourceReaderFromURL(string::ToWide(file_path).c_str(), nullptr, &reader); ComPtr<IMFSourceReader> reader;
hr = dlls::MediaFoundation::Get().MFCreateSourceReaderFromURL(path.c_str(), nullptr, &reader);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {

View File

@ -89,7 +89,7 @@ void ObjectBase::SetName(const String& name)
String ObjectBase::DumpObject() 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()); GetRefCount(), GetName().c_str());
} }

View File

@ -24,7 +24,7 @@
namespace kiwano namespace kiwano
{ {
namespace string namespace strings
{ {
#if defined(KGE_PLATFORM_WINDOWS) #if defined(KGE_PLATFORM_WINDOWS)

View File

@ -32,7 +32,7 @@ using String = std::string;
/// @brief 宽字符串容器 /// @brief 宽字符串容器
using WideString = std::wstring; using WideString = std::wstring;
namespace string namespace strings
{ {
/// \~chinese /// \~chinese

View File

@ -278,7 +278,7 @@ void WindowWin32Impl::Init(const String& title, uint32_t width, uint32_t height,
height = win_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(), handle_ = ::CreateWindowExW(is_fullscreen_ ? WS_EX_TOPMOST : 0, L"KiwanoAppWnd", wide_title.c_str(), GetStyle(),
left, top, width, height, nullptr, nullptr, hinst, nullptr); left, top, width, height, nullptr, nullptr, hinst, nullptr);
@ -321,7 +321,7 @@ void WindowWin32Impl::SetTitle(const String& title)
{ {
if (handle_) if (handle_)
{ {
WideString wide_title = string::ToWide(title); WideString wide_title = strings::ToWide(title);
::SetWindowTextW(handle_, wide_title.c_str()); ::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"); KGE_SYS_LOG("Window title changed");
this->title_ = string::ToNarrow(reinterpret_cast<LPCWSTR>(lparam)); this->title_ = strings::ToNarrow(reinterpret_cast<LPCWSTR>(lparam));
WindowTitleChangedEventPtr evt = new WindowTitleChangedEvent; WindowTitleChangedEventPtr evt = new WindowTitleChangedEvent;
evt->title = this->title_; evt->title = this->title_;

View File

@ -305,7 +305,7 @@ HRESULT STDMETHODCALLTYPE FontFileEnumerator::MoveNext(_Out_ BOOL* hasCurrentFil
if (nextIndex_ < filePaths_.size()) 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, &currentFile_); hr = pFactory_->CreateFontFileReference(file_name.c_str(), NULL, &currentFile_);

View File

@ -168,7 +168,7 @@ void RendererImpl::CreateTexture(Texture& texture, const String& file_path)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
WideString full_path = string::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path)); WideString full_path = strings::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path));
ComPtr<IWICBitmapDecoder> decoder; ComPtr<IWICBitmapDecoder> decoder;
hr = d2d_res_->CreateBitmapDecoderFromFile(decoder, full_path.c_str()); 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)) if (SUCCEEDED(hr))
{ {
WideString full_path = string::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path)); WideString full_path = strings::ToWide(FileSystem::GetInstance().GetFullPathForFile(file_path));
ComPtr<IWICBitmapDecoder> decoder; ComPtr<IWICBitmapDecoder> decoder;
hr = d2d_res_->CreateBitmapDecoderFromFile(decoder, full_path.c_str()); 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)) 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_WEIGHT font_weight = DWRITE_FONT_WEIGHT(style.font_weight);
DWRITE_FONT_STYLE font_style = style.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; DWRITE_FONT_STYLE font_style = style.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL;
auto collection = NativePtr::Get<IDWriteFontCollection>(style.font); auto collection = NativePtr::Get<IDWriteFontCollection>(style.font);
@ -592,7 +592,7 @@ void RendererImpl::CreateTextLayout(TextLayout& layout, const String& content, c
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
WideString wide = string::ToWide(content); WideString wide = strings::ToWide(content);
ComPtr<IDWriteTextLayout> output; ComPtr<IDWriteTextLayout> output;
hr = d2d_res_->CreateTextLayout(output, wide.c_str(), wide.length(), format); hr = d2d_res_->CreateTextLayout(output, wide.c_str(), wide.length(), format);

View File

@ -127,7 +127,7 @@ void TextLayout::SetFontFamily(const String& family, TextRange range)
if (native) 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 }); HRESULT hr = native->SetFontFamilyName(font_family.c_str(), { range.start, range.length });
KGE_THROW_IF_FAILED(hr, "IDWriteTextLayout::SetFontFamilyName failed"); KGE_THROW_IF_FAILED(hr, "IDWriteTextLayout::SetFontFamilyName failed");