string_view refactor

This commit is contained in:
Jack Andersen
2017-11-12 20:13:32 -10:00
parent 420dcee552
commit cb5d22eed6
18 changed files with 98 additions and 94 deletions

View File

@@ -55,7 +55,7 @@ namespace boo
{
static logvisor::Module Log("boo::ApplicationUWP");
std::shared_ptr<IWindow> _WindowUWPNew(const SystemString& title, Boo3DAppContextUWP& d3dCtx,
std::shared_ptr<IWindow> _WindowUWPNew(SystemStringView title, Boo3DAppContextUWP& d3dCtx,
uint32_t sampleCount);
class ApplicationUWP final : public IApplication
@@ -79,9 +79,9 @@ class ApplicationUWP final : public IApplication
public:
ApplicationUWP(IApplicationCallback& callback,
const SystemString& uniqueName,
const SystemString& friendlyName,
const SystemString& pname,
SystemStringView uniqueName,
SystemStringView friendlyName,
SystemStringView pname,
const std::vector<SystemString>& args,
bool singleInstance)
: m_callback(callback),
@@ -266,17 +266,17 @@ public:
return clientReturn;
}
const SystemString& getUniqueName() const
SystemStringView getUniqueName() const
{
return m_uniqueName;
}
const SystemString& getFriendlyName() const
SystemStringView getFriendlyName() const
{
return m_friendlyName;
}
const SystemString& getProcessName() const
SystemStringView getProcessName() const
{
return m_pname;
}
@@ -286,7 +286,7 @@ public:
return m_args;
}
std::shared_ptr<IWindow> newWindow(const SystemString& title, uint32_t sampleCount)
std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t sampleCount)
{
if (!m_issuedWindow)
{
@@ -309,9 +309,9 @@ ref class AppView sealed : public IFrameworkView
internal:
AppView(IApplicationCallback& callback,
const SystemString& uniqueName,
const SystemString& friendlyName,
const SystemString& pname,
SystemStringView uniqueName,
SystemStringView friendlyName,
SystemStringView pname,
const std::vector<SystemString>& args,
bool singleInstance)
: m_app(callback, uniqueName, friendlyName, pname, args, singleInstance) { APP = &m_app; }

View File

@@ -67,7 +67,7 @@ namespace boo
static logvisor::Module Log("boo::ApplicationWin32");
Win32Cursors WIN32_CURSORS;
std::shared_ptr<IWindow> _WindowWin32New(const SystemString& title, Boo3DAppContextWin32& d3dCtx,
std::shared_ptr<IWindow> _WindowWin32New(SystemStringView title, Boo3DAppContextWin32& d3dCtx,
void* vulkanHandle, uint32_t sampleCount);
class ApplicationWin32 final : public IApplication
@@ -93,9 +93,9 @@ class ApplicationWin32 final : public IApplication
public:
ApplicationWin32(IApplicationCallback& callback,
const SystemString& uniqueName,
const SystemString& friendlyName,
const SystemString& pname,
SystemStringView uniqueName,
SystemStringView friendlyName,
SystemStringView pname,
const std::vector<SystemString>& args,
bool singleInstance)
: m_callback(callback),
@@ -429,17 +429,17 @@ public:
return clientReturn;
}
const SystemString& getUniqueName() const
SystemStringView getUniqueName() const
{
return m_uniqueName;
}
const SystemString& getFriendlyName() const
SystemStringView getFriendlyName() const
{
return m_friendlyName;
}
const SystemString& getProcessName() const
SystemStringView getProcessName() const
{
return m_pname;
}
@@ -452,7 +452,7 @@ public:
std::mutex m_nwmt;
std::condition_variable m_nwcv;
std::shared_ptr<IWindow> m_mwret;
std::shared_ptr<IWindow> newWindow(const SystemString& title, uint32_t sampleCount)
std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t sampleCount)
{
if (GetCurrentThreadId() != g_mainThreadId)
{
@@ -480,9 +480,9 @@ public:
IApplication* APP = NULL;
int ApplicationRun(IApplication::EPlatformType platform,
IApplicationCallback& cb,
const SystemString& uniqueName,
const SystemString& friendlyName,
const SystemString& pname,
SystemStringView uniqueName,
SystemStringView friendlyName,
SystemStringView pname,
const std::vector<SystemString>& args,
bool singleInstance)
{

View File

@@ -253,7 +253,7 @@ class WindowUWP : public IWindow
public:
WindowUWP(const SystemString& title, Boo3DAppContext& b3dCtx, uint32_t sampleCount)
WindowUWP(SystemStringView title, Boo3DAppContext& b3dCtx, uint32_t sampleCount)
{
IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11;
#if _WIN32_WINNT_WIN10
@@ -296,9 +296,9 @@ public:
return SystemString(m_appView->Title.Data());
}
void setTitle(const SystemString& title)
void setTitle(SystemStringView title)
{
m_appView->Title = title.c_str();
m_appView->Title = title.data();
}
void setCursor(EMouseCursor cursor)
@@ -459,7 +459,7 @@ public:
};
std::shared_ptr<IWindow> _WindowUAPNew(const SystemString& title, Boo3DAppContext& d3dCtx,
std::shared_ptr<IWindow> _WindowUAPNew(SystemStringView title, Boo3DAppContext& d3dCtx,
uint32_t sampleCount)
{
return std::make_shared<WindowUWP>(title, d3dCtx, sampleCount);

View File

@@ -502,8 +502,8 @@ public:
vk::init_dispatch_table_top(PFN_vkGetInstanceProcAddr(getVkProc));
if (m_ctx->m_instance == VK_NULL_HANDLE)
{
const SystemString& appName = APP->getUniqueName();
m_ctx->initVulkan(WCSTMBS(appName.c_str()).c_str());
auto appName = APP->getUniqueName();
m_ctx->initVulkan(WCSTMBS(appName.data()).c_str());
}
vk::init_dispatch_table_middle(m_ctx->m_instance, false);
@@ -970,7 +970,7 @@ class WindowWin32 : public IWindow
public:
WindowWin32(const SystemString& title, Boo3DAppContextWin32& b3dCtx, void* vulkanHandle, uint32_t sampleCount)
WindowWin32(SystemStringView title, Boo3DAppContextWin32& b3dCtx, void* vulkanHandle, uint32_t sampleCount)
{
m_hwnd = CreateWindowW(L"BooWindow", title.c_str(), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
@@ -1034,9 +1034,9 @@ public:
return SystemString(title, c);
}
void setTitle(const SystemString& title)
void setTitle(SystemStringView title)
{
SetWindowTextW(m_hwnd, title.c_str());
SetWindowTextW(m_hwnd, title.data());
}
static void _setCursor(HCURSOR cur)
@@ -1582,7 +1582,7 @@ public:
};
std::shared_ptr<IWindow> _WindowWin32New(const SystemString& title, Boo3DAppContextWin32& d3dCtx,
std::shared_ptr<IWindow> _WindowWin32New(SystemStringView title, Boo3DAppContextWin32& d3dCtx,
void* vulkanHandle, uint32_t sampleCount)
{
return std::make_shared<WindowWin32>(title, d3dCtx, vulkanHandle, sampleCount);