mirror of https://github.com/AxioDL/boo.git
string_view refactor
This commit is contained in:
parent
420dcee552
commit
cb5d22eed6
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # because of CMAKE_CXX_STANDARD
|
||||
project(boo)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT MSVC)
|
||||
|
|
|
@ -45,22 +45,22 @@ public:
|
|||
virtual EPlatformType getPlatformType() const=0;
|
||||
|
||||
virtual int run()=0;
|
||||
virtual const SystemString& getUniqueName() const=0;
|
||||
virtual const SystemString& getFriendlyName() const=0;
|
||||
virtual const SystemString& getProcessName() const=0;
|
||||
virtual SystemStringView getUniqueName() const=0;
|
||||
virtual SystemStringView getFriendlyName() const=0;
|
||||
virtual SystemStringView getProcessName() const=0;
|
||||
virtual const std::vector<SystemString>& getArgs() const=0;
|
||||
|
||||
/* Constructors/initializers for sub-objects */
|
||||
virtual std::shared_ptr<IWindow> newWindow(const SystemString& title, uint32_t drawSamples)=0;
|
||||
virtual std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t drawSamples)=0;
|
||||
|
||||
};
|
||||
|
||||
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=true);
|
||||
extern IApplication* APP;
|
||||
|
@ -68,8 +68,8 @@ extern IApplication* APP;
|
|||
static inline int
|
||||
ApplicationRun(IApplication::EPlatformType platform,
|
||||
IApplicationCallback& cb,
|
||||
const SystemString& uniqueName,
|
||||
const SystemString& friendlyName,
|
||||
SystemStringView uniqueName,
|
||||
SystemStringView friendlyName,
|
||||
int argc, const SystemChar** argv,
|
||||
bool singleInstance=true)
|
||||
{
|
||||
|
@ -87,9 +87,9 @@ using namespace Windows::ApplicationModel::Core;
|
|||
ref struct ViewProvider sealed : IFrameworkViewSource
|
||||
{
|
||||
ViewProvider(boo::IApplicationCallback& appCb,
|
||||
const SystemString& uniqueName,
|
||||
const SystemString& friendlyName,
|
||||
const SystemString& pname,
|
||||
SystemStringView uniqueName,
|
||||
SystemStringView friendlyName,
|
||||
SystemStringView pname,
|
||||
Platform::Array<Platform::String^>^ params,
|
||||
bool singleInstance)
|
||||
: m_appCb(appCb), m_uniqueName(uniqueName), m_friendlyName(friendlyName),
|
||||
|
|
|
@ -157,14 +157,14 @@ struct ITextInputCallback
|
|||
virtual bool hasMarkedText() const=0;
|
||||
virtual std::pair<int,int> markedRange() const=0;
|
||||
virtual std::pair<int,int> selectedRange() const=0;
|
||||
virtual void setMarkedText(const std::string& str,
|
||||
virtual void setMarkedText(std::string_view str,
|
||||
const std::pair<int,int>& selectedRange,
|
||||
const std::pair<int,int>& replacementRange)=0;
|
||||
virtual void unmarkText()=0;
|
||||
|
||||
virtual std::string substringForRange(const std::pair<int,int>& range,
|
||||
std::pair<int,int>& actualRange) const=0;
|
||||
virtual void insertText(const std::string& str, const std::pair<int,int>& range={-1,0})=0;
|
||||
virtual void insertText(std::string_view str, const std::pair<int,int>& range={-1,0})=0;
|
||||
virtual int characterIndexAtPoint(const SWindowCoord& point) const=0;
|
||||
virtual SWindowRect rectForCharacterRange(const std::pair<int,int>& range,
|
||||
std::pair<int,int>& actualRange) const=0;
|
||||
|
@ -267,7 +267,7 @@ public:
|
|||
virtual void hideWindow()=0;
|
||||
|
||||
virtual SystemString getTitle()=0;
|
||||
virtual void setTitle(const SystemString& title)=0;
|
||||
virtual void setTitle(SystemStringView title)=0;
|
||||
|
||||
virtual void setCursor(EMouseCursor cursor)=0;
|
||||
virtual void setWaitCursor(bool wait)=0;
|
||||
|
|
|
@ -13,6 +13,7 @@ static inline ComPtr<T>* ReferenceComPtr(ComPtr<T>& ptr)
|
|||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#ifndef ENABLE_BITWISE_ENUM
|
||||
#define ENABLE_BITWISE_ENUM(type)\
|
||||
|
@ -50,12 +51,14 @@ namespace boo
|
|||
|
||||
#ifdef _WIN32
|
||||
using SystemString = std::wstring;
|
||||
using SystemStringView = std::wstring_view;
|
||||
using SystemChar = wchar_t;
|
||||
# ifndef _S
|
||||
# define _S(val) L ## val
|
||||
# endif
|
||||
#else
|
||||
using SystemString = std::string;
|
||||
using SystemStringView = std::string_view;
|
||||
using SystemChar = char;
|
||||
# ifndef _S
|
||||
# define _S(val) val
|
||||
|
|
|
@ -58,9 +58,9 @@ public:
|
|||
inline DeviceType getDeviceType() const {return m_devType;}
|
||||
inline unsigned getVendorId() const {return m_vendorId;}
|
||||
inline unsigned getProductId() const {return m_productId;}
|
||||
inline const std::string& getVendorName() const {return m_vendorName;}
|
||||
inline const std::string& getProductName() const {return m_productName;}
|
||||
inline const std::string& getDevicePath() const {return m_devPath;}
|
||||
inline std::string_view getVendorName() const {return m_vendorName;}
|
||||
inline std::string_view getProductName() const {return m_productName;}
|
||||
inline std::string_view getDevicePath() const {return m_devPath;}
|
||||
inline bool isDeviceOpen() const {return (m_connectedDev != NULL);}
|
||||
inline std::shared_ptr<DeviceBase> openAndGetDevice()
|
||||
{
|
||||
|
|
|
@ -1131,7 +1131,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
#if _WIN32
|
||||
std::string thrName = WCSTMBS(APP->getFriendlyName().c_str()) + " GL Rendering Thread";
|
||||
#else
|
||||
std::string thrName = APP->getFriendlyName() + " GL Rendering Thread";
|
||||
std::string thrName = std::string(APP->getFriendlyName()) + " GL Rendering Thread";
|
||||
#endif
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
bool m_runningTransferLoop = false;
|
||||
bool m_isBt = false;
|
||||
|
||||
const std::string& m_devPath;
|
||||
std::string_view m_devPath;
|
||||
std::mutex m_initMutex;
|
||||
std::condition_variable m_initCond;
|
||||
std::thread m_thread;
|
||||
|
@ -91,14 +91,15 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
static void _threadProcUSBLL(std::shared_ptr<HIDDeviceIOKit> device)
|
||||
{
|
||||
char thrName[128];
|
||||
snprintf(thrName, 128, "%s Transfer Thread", device->m_token.getProductName().c_str());
|
||||
snprintf(thrName, 128, "%s Transfer Thread", device->m_token.getProductName().data());
|
||||
pthread_setname_np(thrName);
|
||||
char errStr[256];
|
||||
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
||||
|
||||
/* Get the HID element's parent (USB interrupt transfer-interface) */
|
||||
IOObjectPointer<io_iterator_t> devIter;
|
||||
IOObjectPointer<io_registry_entry_t> devEntry = IORegistryEntryFromPath(kIOMasterPortDefault, device->m_devPath.c_str());
|
||||
IOObjectPointer<io_registry_entry_t> devEntry = IORegistryEntryFromPath(kIOMasterPortDefault,
|
||||
device->m_devPath.data());
|
||||
IORegistryEntryGetChildIterator(devEntry, kIOServicePlane, &devIter);
|
||||
IOObjectPointer<io_object_t> interfaceEntry;
|
||||
while (IOObjectPointer<io_service_t> obj = IOIteratorNext(devIter))
|
||||
|
@ -111,8 +112,8 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
if (!interfaceEntry)
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to find interface for %s@%s\n",
|
||||
device->m_token.getProductName().c_str(),
|
||||
device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(),
|
||||
device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
lk.unlock();
|
||||
device->m_initCond.notify_one();
|
||||
|
@ -131,7 +132,7 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
if (err)
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
lk.unlock();
|
||||
device->m_initCond.notify_one();
|
||||
|
@ -144,7 +145,7 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
if (err)
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
lk.unlock();
|
||||
device->m_initCond.notify_one();
|
||||
|
@ -159,13 +160,13 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
if (err == kIOReturnExclusiveAccess)
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s: someone else using it\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
}
|
||||
lk.unlock();
|
||||
|
@ -243,19 +244,19 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
static void _threadProcHID(std::shared_ptr<HIDDeviceIOKit> device)
|
||||
{
|
||||
char thrName[128];
|
||||
snprintf(thrName, 128, "%s Transfer Thread", device->m_token.getProductName().c_str());
|
||||
snprintf(thrName, 128, "%s Transfer Thread", device->m_token.getProductName().data());
|
||||
pthread_setname_np(thrName);
|
||||
char errStr[256];
|
||||
std::unique_lock<std::mutex> lk(device->m_initMutex);
|
||||
|
||||
/* Get the HID element's object (HID device interface) */
|
||||
IOObjectPointer<io_service_t> interfaceEntry =
|
||||
IORegistryEntryFromPath(kIOMasterPortDefault, device->m_devPath.c_str());
|
||||
IORegistryEntryFromPath(kIOMasterPortDefault, device->m_devPath.data());
|
||||
if (!IOObjectConformsTo(interfaceEntry.get(), "IOHIDDevice"))
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to find interface for %s@%s\n",
|
||||
device->m_token.getProductName().c_str(),
|
||||
device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(),
|
||||
device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
lk.unlock();
|
||||
device->m_initCond.notify_one();
|
||||
|
@ -266,7 +267,7 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
if (!device->m_hidIntf)
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
lk.unlock();
|
||||
device->m_initCond.notify_one();
|
||||
|
@ -280,13 +281,13 @@ class HIDDeviceIOKit : public IHIDDevice
|
|||
if (err == kIOReturnExclusiveAccess)
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s: someone else using it\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(errStr, 256, "Unable to open %s@%s\n",
|
||||
device->m_token.getProductName().c_str(), device->m_devPath.c_str());
|
||||
device->m_token.getProductName().data(), device->m_devPath.data());
|
||||
device->m_devImp->deviceError(errStr);
|
||||
}
|
||||
lk.unlock();
|
||||
|
|
|
@ -37,7 +37,7 @@ class HIDDeviceUdev final : public IHIDDevice
|
|||
unsigned m_usbIntfOutPipe = 0;
|
||||
bool m_runningTransferLoop = false;
|
||||
|
||||
const std::string& m_devPath;
|
||||
std::string_view m_devPath;
|
||||
std::mutex m_initMutex;
|
||||
std::condition_variable m_initCond;
|
||||
std::thread m_thread;
|
||||
|
|
|
@ -36,7 +36,7 @@ class HIDDeviceWinUSB final : public IHIDDevice
|
|||
unsigned m_usbIntfOutPipe = 0;
|
||||
bool m_runningTransferLoop = false;
|
||||
|
||||
const std::string& m_devPath;
|
||||
std::string_view m_devPath;
|
||||
std::mutex m_initMutex;
|
||||
std::condition_variable m_initCond;
|
||||
std::thread m_thread;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace boo
|
|||
{
|
||||
static logvisor::Module Log("boo::ApplicationCocoa");
|
||||
|
||||
std::shared_ptr<IWindow> _WindowCocoaNew(const SystemString& title, NSOpenGLContext* lastGLCtx,
|
||||
std::shared_ptr<IWindow> _WindowCocoaNew(SystemStringView title, NSOpenGLContext* lastGLCtx,
|
||||
MetalContext* metalCtx, uint32_t sampleCount);
|
||||
|
||||
class ApplicationCocoa : public IApplication
|
||||
|
@ -58,9 +58,9 @@ private:
|
|||
|
||||
public:
|
||||
ApplicationCocoa(IApplicationCallback& callback,
|
||||
const SystemString& uniqueName,
|
||||
const SystemString& friendlyName,
|
||||
const SystemString& pname,
|
||||
SystemStringView uniqueName,
|
||||
SystemStringView friendlyName,
|
||||
SystemStringView pname,
|
||||
const std::vector<SystemString>& args)
|
||||
: m_callback(callback),
|
||||
m_uniqueName(uniqueName),
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
/* Spawn client thread */
|
||||
m_clientThread = std::thread([&]()
|
||||
{
|
||||
std::string thrName = getFriendlyName() + " Client Thread";
|
||||
std::string thrName = std::string(getFriendlyName()) + " Client Thread";
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
|
||||
/* Run app */
|
||||
|
@ -161,17 +161,17 @@ public:
|
|||
[NSApp terminate:nil];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public:
|
|||
return m_args;
|
||||
}
|
||||
|
||||
std::shared_ptr<IWindow> newWindow(const std::string& title, uint32_t sampleCount)
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t sampleCount)
|
||||
{
|
||||
auto newWindow = _WindowCocoaNew(title, m_lastGLCtx, &m_metalCtx, sampleCount);
|
||||
m_windows[newWindow->getPlatformHandle()] = newWindow;
|
||||
|
@ -200,13 +200,13 @@ void _CocoaUpdateLastGLCtx(NSOpenGLContext* lastGLCtx)
|
|||
IApplication* APP = nullptr;
|
||||
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)
|
||||
{
|
||||
std::string thrName = friendlyName + " Main Thread";
|
||||
std::string thrName = std::string(friendlyName) + " Main Thread";
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
@autoreleasepool
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace boo {class WindowCocoa; class GraphicsContextCocoa;}
|
|||
std::shared_ptr<boo::WindowCocoa> booWindow;
|
||||
id touchBarProvider;
|
||||
}
|
||||
- (id)initWithBooWindow:(std::shared_ptr<boo::WindowCocoa>&)bw title:(const std::string&)title;
|
||||
- (id)initWithBooWindow:(std::shared_ptr<boo::WindowCocoa>&)bw title:(std::string_view)title;
|
||||
- (void)setFrameDefault;
|
||||
- (NSRect)genFrameDefault;
|
||||
- (void)setTouchBarProvider:(id)provider;
|
||||
|
@ -1271,7 +1271,7 @@ class WindowCocoa : public IWindow
|
|||
|
||||
public:
|
||||
|
||||
void setup(const std::string& title, NSOpenGLContext* lastGLCtx, MetalContext* metalCtx, uint32_t sampleCount)
|
||||
void setup(std::string_view title, NSOpenGLContext* lastGLCtx, MetalContext* metalCtx, uint32_t sampleCount)
|
||||
{
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
|
@ -1337,11 +1337,11 @@ public:
|
|||
return [[m_nsWindow title] UTF8String];
|
||||
}
|
||||
|
||||
void setTitle(const std::string& title)
|
||||
void setTitle(std::string_view title)
|
||||
{
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow setTitle:[NSString stringWithUTF8String:title.c_str()]];
|
||||
[m_nsWindow setTitle:[NSString stringWithUTF8String:title.data()]];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1559,7 +1559,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowCocoaNew(const SystemString& title, NSOpenGLContext* lastGLCtx,
|
||||
std::shared_ptr<IWindow> _WindowCocoaNew(SystemStringView title, NSOpenGLContext* lastGLCtx,
|
||||
MetalContext* metalCtx, uint32_t sampleCount)
|
||||
{
|
||||
auto ret = std::make_shared<WindowCocoa>();
|
||||
|
@ -1570,7 +1570,7 @@ std::shared_ptr<IWindow> _WindowCocoaNew(const SystemString& title, NSOpenGLCont
|
|||
}
|
||||
|
||||
@implementation WindowCocoaInternal
|
||||
- (id)initWithBooWindow:(std::shared_ptr<boo::WindowCocoa>&)bw title:(const boo::SystemString&)title
|
||||
- (id)initWithBooWindow:(std::shared_ptr<boo::WindowCocoa>&)bw title:(std::string_view)title
|
||||
{
|
||||
self = [self initWithContentRect:[self genFrameDefault]
|
||||
styleMask:NSWindowStyleMaskTitled|
|
||||
|
@ -1580,7 +1580,7 @@ std::shared_ptr<IWindow> _WindowCocoaNew(const SystemString& title, NSOpenGLCont
|
|||
backing:NSBackingStoreBuffered
|
||||
defer:YES];
|
||||
self.releasedWhenClosed = NO;
|
||||
self.title = [NSString stringWithUTF8String:title.c_str()];
|
||||
self.title = [NSString stringWithUTF8String:title.data()];
|
||||
booWindow = bw;
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -114,7 +114,7 @@ static Window GetWindowOfEvent(XEvent* event, bool& windowEvent)
|
|||
return 0;
|
||||
}
|
||||
|
||||
std::shared_ptr<IWindow> _WindowXlibNew(const std::string& title,
|
||||
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
|
||||
Display* display, void* xcbConn,
|
||||
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
||||
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples);
|
||||
|
|
|
@ -94,7 +94,7 @@ struct WindowWayland : IWindow
|
|||
{
|
||||
GraphicsContextWayland m_gfxCtx;
|
||||
|
||||
WindowWayland(const std::string& title)
|
||||
WindowWayland(std::string_view title)
|
||||
: m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this)
|
||||
{
|
||||
|
||||
|
|
|
@ -936,7 +936,7 @@ class WindowXlib : public IWindow
|
|||
bool m_openGL = false;
|
||||
|
||||
public:
|
||||
WindowXlib(const std::string& title,
|
||||
WindowXlib(std::string_view title,
|
||||
Display* display, void* xcbConn,
|
||||
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
||||
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples)
|
||||
|
@ -1131,7 +1131,7 @@ public:
|
|||
return std::string();
|
||||
}
|
||||
|
||||
void setTitle(const std::string& title)
|
||||
void setTitle(std::string_view title)
|
||||
{
|
||||
const unsigned char* c_title = (unsigned char*)title.c_str();
|
||||
XLockDisplay(m_xDisp);
|
||||
|
|
Loading…
Reference in New Issue