mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-17 17:05:24 +00:00
string_view refactor
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user