mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-30 13:05:20 +08:00
Update release
This commit is contained in:
+101
-101
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -978,10 +978,10 @@ ITEM(BACKSLASH, 0xDC) /* OEM_5 */ \
|
|||||||
ITEM(LEFT_BRACKET, 0xDD) /* OEM_6 */ \
|
ITEM(LEFT_BRACKET, 0xDD) /* OEM_6 */ \
|
||||||
ITEM(APOSTROPHE, 0xDE) /* OEM_7 */ \
|
ITEM(APOSTROPHE, 0xDE) /* OEM_7 */ \
|
||||||
|
|
||||||
#define GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM(NAME, CODE) _##NAME = CODE,
|
#define GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM(NAME, CODE) KEY_##NAME = CODE,
|
||||||
enum class VKEY
|
enum class VKEY
|
||||||
{
|
{
|
||||||
_UNKNOWN = -1,
|
KEY_UNKNOWN = -1,
|
||||||
GUI_DEFINE_KEYBOARD_CODE(GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM)
|
GUI_DEFINE_KEYBOARD_CODE(GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM)
|
||||||
};
|
};
|
||||||
#undef GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM
|
#undef GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM
|
||||||
@@ -5905,7 +5905,7 @@ Alt-Combined Shortcut Key Interfaces Helpers
|
|||||||
AltActionMap currentActiveAltActions;
|
AltActionMap currentActiveAltActions;
|
||||||
AltControlMap currentActiveAltTitles;
|
AltControlMap currentActiveAltTitles;
|
||||||
WString currentAltPrefix;
|
WString currentAltPrefix;
|
||||||
VKEY supressAltKey = VKEY::_UNKNOWN;
|
VKEY supressAltKey = VKEY::KEY_UNKNOWN;
|
||||||
|
|
||||||
void EnterAltHost(IGuiAltActionHost* host);
|
void EnterAltHost(IGuiAltActionHost* host);
|
||||||
void LeaveAltHost();
|
void LeaveAltHost();
|
||||||
@@ -9838,11 +9838,11 @@ namespace vl
|
|||||||
|
|
||||||
namespace controls
|
namespace controls
|
||||||
{
|
{
|
||||||
template<typename T, typename Enabled = YesType>
|
template<typename T, typename=void>
|
||||||
struct QueryServiceHelper;
|
struct QueryServiceHelper;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct QueryServiceHelper<T, typename PointerConvertable<decltype(T::Identifier), const wchar_t* const>::YesNoType>
|
struct QueryServiceHelper<T, std::enable_if_t<std::is_convertible_v<decltype(T::Identifier), const wchar_t* const>>>
|
||||||
{
|
{
|
||||||
static WString GetIdentifier()
|
static WString GetIdentifier()
|
||||||
{
|
{
|
||||||
@@ -9851,7 +9851,7 @@ namespace vl
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct QueryServiceHelper<T, typename PointerConvertable<decltype(T::GetIdentifier()), WString>::YesNoType>
|
struct QueryServiceHelper<T, std::enable_if_t<std::is_convertible_v<decltype(T::GetIdentifier()), WString>>>
|
||||||
{
|
{
|
||||||
static WString GetIdentifier()
|
static WString GetIdentifier()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9705,7 +9705,7 @@ FindInstanceLoadingSource
|
|||||||
|
|
||||||
template<typename TCallback>
|
template<typename TCallback>
|
||||||
auto FindByTag(Ptr<GuiInstanceContext> context, GlobalStringKey namespaceName, const WString& typeName, TCallback callback)
|
auto FindByTag(Ptr<GuiInstanceContext> context, GlobalStringKey namespaceName, const WString& typeName, TCallback callback)
|
||||||
-> typename RemoveCVR<decltype(callback({}).Value())>::Type
|
-> std::remove_cvref_t<decltype(callback({}).Value())>
|
||||||
{
|
{
|
||||||
vint index = context->namespaces.Keys().IndexOf(namespaceName);
|
vint index = context->namespaces.Keys().IndexOf(namespaceName);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
|||||||
@@ -361,9 +361,9 @@ Type Declaration
|
|||||||
STRUCT_MEMBER(verticalAntialias)
|
STRUCT_MEMBER(verticalAntialias)
|
||||||
END_STRUCT_MEMBER(FontProperties)
|
END_STRUCT_MEMBER(FontProperties)
|
||||||
|
|
||||||
#define GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM(NAME, CODE) ENUM_CLASS_ITEM(_##NAME)
|
#define GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM(NAME, CODE) ENUM_CLASS_ITEM(KEY_##NAME)
|
||||||
BEGIN_ENUM_ITEM(VKEY)
|
BEGIN_ENUM_ITEM(VKEY)
|
||||||
ENUM_CLASS_ITEM(_UNKNOWN)
|
ENUM_CLASS_ITEM(KEY_UNKNOWN)
|
||||||
GUI_DEFINE_KEYBOARD_CODE(GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM)
|
GUI_DEFINE_KEYBOARD_CODE(GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM)
|
||||||
END_ENUM_ITEM(VKEY)
|
END_ENUM_ITEM(VKEY)
|
||||||
#undef GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM
|
#undef GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM
|
||||||
|
|||||||
+21
-21
@@ -8282,11 +8282,11 @@ WindowsForm
|
|||||||
|
|
||||||
if (nonClient)
|
if (nonClient)
|
||||||
{
|
{
|
||||||
info.ctrl = WinIsKeyPressing(VKEY::_CONTROL);
|
info.ctrl = WinIsKeyPressing(VKEY::KEY_CONTROL);
|
||||||
info.shift = WinIsKeyPressing(VKEY::_SHIFT);
|
info.shift = WinIsKeyPressing(VKEY::KEY_SHIFT);
|
||||||
info.left= WinIsKeyPressing(VKEY::_LBUTTON);
|
info.left= WinIsKeyPressing(VKEY::KEY_LBUTTON);
|
||||||
info.middle= WinIsKeyPressing(VKEY::_MBUTTON);
|
info.middle= WinIsKeyPressing(VKEY::KEY_MBUTTON);
|
||||||
info.right = WinIsKeyPressing(VKEY::_RBUTTON);
|
info.right = WinIsKeyPressing(VKEY::KEY_RBUTTON);
|
||||||
|
|
||||||
POINTS point = MAKEPOINTS(lParam);
|
POINTS point = MAKEPOINTS(lParam);
|
||||||
NativePoint offset = GetClientBoundsInScreen().LeftTop();
|
NativePoint offset = GetClientBoundsInScreen().LeftTop();
|
||||||
@@ -8295,11 +8295,11 @@ WindowsForm
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info.ctrl=((VKEY)wParam & VKEY::_CONTROL)!=(VKEY)0;
|
info.ctrl=((VKEY)wParam & VKEY::KEY_CONTROL)!=(VKEY)0;
|
||||||
info.shift=((VKEY)wParam & VKEY::_SHIFT)!= (VKEY)0;
|
info.shift=((VKEY)wParam & VKEY::KEY_SHIFT)!= (VKEY)0;
|
||||||
info.left=((VKEY)wParam & VKEY::_LBUTTON)!= (VKEY)0;
|
info.left=((VKEY)wParam & VKEY::KEY_LBUTTON)!= (VKEY)0;
|
||||||
info.middle=((VKEY)wParam & VKEY::_MBUTTON)!= (VKEY)0;
|
info.middle=((VKEY)wParam & VKEY::KEY_MBUTTON)!= (VKEY)0;
|
||||||
info.right=((VKEY)wParam & VKEY::_RBUTTON)!= (VKEY)0;
|
info.right=((VKEY)wParam & VKEY::KEY_RBUTTON)!= (VKEY)0;
|
||||||
|
|
||||||
POINTS point = MAKEPOINTS(lParam);
|
POINTS point = MAKEPOINTS(lParam);
|
||||||
|
|
||||||
@@ -8322,10 +8322,10 @@ WindowsForm
|
|||||||
{
|
{
|
||||||
NativeWindowKeyInfo info;
|
NativeWindowKeyInfo info;
|
||||||
info.code=(VKEY)wParam;
|
info.code=(VKEY)wParam;
|
||||||
info.ctrl=WinIsKeyPressing(VKEY::_CONTROL);
|
info.ctrl=WinIsKeyPressing(VKEY::KEY_CONTROL);
|
||||||
info.shift=WinIsKeyPressing(VKEY::_SHIFT);
|
info.shift=WinIsKeyPressing(VKEY::KEY_SHIFT);
|
||||||
info.alt=WinIsKeyPressing(VKEY::_MENU);
|
info.alt=WinIsKeyPressing(VKEY::KEY_MENU);
|
||||||
info.capslock=WinIsKeyToggled(VKEY::_CAPITAL);
|
info.capslock=WinIsKeyToggled(VKEY::KEY_CAPITAL);
|
||||||
info.autoRepeatKeyDown = (((vuint32_t)lParam) >> 30) % 2 == 1;
|
info.autoRepeatKeyDown = (((vuint32_t)lParam) >> 30) % 2 == 1;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@@ -8334,10 +8334,10 @@ WindowsForm
|
|||||||
{
|
{
|
||||||
NativeWindowCharInfo info;
|
NativeWindowCharInfo info;
|
||||||
info.code=(wchar_t)wParam;
|
info.code=(wchar_t)wParam;
|
||||||
info.ctrl=WinIsKeyPressing(VKEY::_CONTROL);
|
info.ctrl=WinIsKeyPressing(VKEY::KEY_CONTROL);
|
||||||
info.shift=WinIsKeyPressing(VKEY::_SHIFT);
|
info.shift=WinIsKeyPressing(VKEY::KEY_SHIFT);
|
||||||
info.alt=WinIsKeyPressing(VKEY::_MENU);
|
info.alt=WinIsKeyPressing(VKEY::KEY_MENU);
|
||||||
info.capslock=WinIsKeyToggled(VKEY::_CAPITAL);
|
info.capslock=WinIsKeyToggled(VKEY::KEY_CAPITAL);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
#pragma pop_macro("_CONTROL")
|
#pragma pop_macro("_CONTROL")
|
||||||
@@ -8772,7 +8772,7 @@ WindowsForm
|
|||||||
{
|
{
|
||||||
NativeWindowKeyInfo info=ConvertKey(wParam, lParam);
|
NativeWindowKeyInfo info=ConvertKey(wParam, lParam);
|
||||||
info.autoRepeatKeyDown = false;
|
info.autoRepeatKeyDown = false;
|
||||||
if (supressingAlt && !info.ctrl && !info.shift && info.code == VKEY::_MENU)
|
if (supressingAlt && !info.ctrl && !info.shift && info.code == VKEY::KEY_MENU)
|
||||||
{
|
{
|
||||||
supressingAlt = false;
|
supressingAlt = false;
|
||||||
break;
|
break;
|
||||||
@@ -8786,7 +8786,7 @@ WindowsForm
|
|||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
{
|
{
|
||||||
NativeWindowKeyInfo info=ConvertKey(wParam, lParam);
|
NativeWindowKeyInfo info=ConvertKey(wParam, lParam);
|
||||||
if (supressingAlt && !info.ctrl && !info.shift && info.code == VKEY::_MENU)
|
if (supressingAlt && !info.ctrl && !info.shift && info.code == VKEY::KEY_MENU)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -14610,7 +14610,7 @@ WindowsInputService
|
|||||||
VKEY WindowsInputService::GetKey(const WString& name)
|
VKEY WindowsInputService::GetKey(const WString& name)
|
||||||
{
|
{
|
||||||
vint index = keys.Keys().IndexOf(name);
|
vint index = keys.Keys().IndexOf(name);
|
||||||
return index == -1 ? VKEY::_UNKNOWN : keys.Values()[index];
|
return index == -1 ? VKEY::KEY_UNKNOWN : keys.Values()[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1453,18 +1453,6 @@ UniscribeColor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
struct POD<presentation::elements_windows_gdi::UniscribeColorRange>
|
|
||||||
{
|
|
||||||
static const bool Result=true;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct POD<presentation::elements_windows_gdi::UniscribeColor>
|
|
||||||
{
|
|
||||||
static const bool Result=true;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace presentation
|
namespace presentation
|
||||||
{
|
{
|
||||||
namespace elements_windows_gdi
|
namespace elements_windows_gdi
|
||||||
|
|||||||
+141
-160
@@ -12,33 +12,10 @@ Author: Zihan Chen (vczh)
|
|||||||
Licensed under https://github.com/vczh-libraries/License
|
Licensed under https://github.com/vczh-libraries/License
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#if defined VCZH_MSVC
|
|
||||||
#include <Windows.h>
|
|
||||||
#elif defined VCZH_GCC
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace vl
|
namespace vl
|
||||||
{
|
{
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
NotCopyable
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
NotCopyable::NotCopyable()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NotCopyable::NotCopyable(const NotCopyable&)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NotCopyable& NotCopyable::operator=(const NotCopyable&)
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Error
|
Error
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
@@ -52,14 +29,151 @@ Error
|
|||||||
{
|
{
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Object
|
.\CONSOLE.CPP
|
||||||
|
***********************************************************************/
|
||||||
|
/***********************************************************************
|
||||||
|
Author: Zihan Chen (vczh)
|
||||||
|
Licensed under https://github.com/vczh-libraries/License
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
Object::~Object()
|
#if defined VCZH_MSVC
|
||||||
|
#include <Windows.h>
|
||||||
|
#elif defined VCZH_GCC
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace vl
|
||||||
{
|
{
|
||||||
|
namespace console
|
||||||
|
{
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
Console
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
void Console::Write(const wchar_t* string, vint length)
|
||||||
|
{
|
||||||
|
#if defined VCZH_MSVC
|
||||||
|
HANDLE outHandle=GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
DWORD fileMode=0;
|
||||||
|
DWORD written=0;
|
||||||
|
if((GetFileType(outHandle) & FILE_TYPE_CHAR) && GetConsoleMode(outHandle, &fileMode))
|
||||||
|
{
|
||||||
|
WriteConsole(outHandle, string, (int)length, &written,0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int codePage = GetConsoleOutputCP();
|
||||||
|
int charCount = WideCharToMultiByte(codePage, 0, string, -1, 0, 0, 0, 0);
|
||||||
|
char* codePageBuffer = new char[charCount];
|
||||||
|
WideCharToMultiByte(codePage, 0, string, -1, codePageBuffer, charCount, 0, 0);
|
||||||
|
WriteFile(outHandle, codePageBuffer, charCount-1, &written, 0);
|
||||||
|
delete[] codePageBuffer;
|
||||||
|
}
|
||||||
|
#elif defined VCZH_GCC
|
||||||
|
wstring s(string, string+length);
|
||||||
|
wcout<<s<<ends;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::Write(const wchar_t* string)
|
||||||
|
{
|
||||||
|
Write(string, wcslen(string));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::Write(const WString& string)
|
||||||
|
{
|
||||||
|
Write(string.Buffer(), string.Length());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::WriteLine(const WString& string)
|
||||||
|
{
|
||||||
|
Write(string);
|
||||||
|
Write(L"\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
WString Console::Read()
|
||||||
|
{
|
||||||
|
#if defined VCZH_MSVC
|
||||||
|
WString result;
|
||||||
|
DWORD count;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
wchar_t buffer;
|
||||||
|
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&buffer,1,&count,0);
|
||||||
|
if(buffer==L'\r')
|
||||||
|
{
|
||||||
|
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&buffer,1,&count,0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(buffer==L'\n')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result=result+WString::FromChar(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#elif defined VCZH_GCC
|
||||||
|
wstring s;
|
||||||
|
getline(wcin, s, L'\n');
|
||||||
|
return s.c_str();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::SetColor(bool red, bool green, bool blue, bool light)
|
||||||
|
{
|
||||||
|
#if defined VCZH_MSVC
|
||||||
|
WORD attribute=0;
|
||||||
|
if(red)attribute |=FOREGROUND_RED;
|
||||||
|
if(green)attribute |=FOREGROUND_GREEN;
|
||||||
|
if(blue)attribute |=FOREGROUND_BLUE;
|
||||||
|
if(light)attribute |=FOREGROUND_INTENSITY;
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),attribute);
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_INPUT_HANDLE),attribute);
|
||||||
|
#elif defined VCZH_GCC
|
||||||
|
int color = (blue?1:0)*4 + (green?1:0)*2 + (red?1:0);
|
||||||
|
if(light)
|
||||||
|
wprintf(L"\x1B[00;3%dm", color);
|
||||||
|
else
|
||||||
|
wprintf(L"\x1B[01;3%dm", color);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::SetTitle(const WString& string)
|
||||||
|
{
|
||||||
|
#if defined VCZH_MSVC
|
||||||
|
SetConsoleTitle(string.Buffer());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
.\DATETIME.CPP
|
||||||
|
***********************************************************************/
|
||||||
|
/***********************************************************************
|
||||||
|
Author: Zihan Chen (vczh)
|
||||||
|
Licensed under https://github.com/vczh-libraries/License
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#if defined VCZH_MSVC
|
||||||
|
#elif defined VCZH_GCC
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace vl
|
||||||
|
{
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
DateTime
|
DateTime
|
||||||
@@ -262,139 +376,6 @@ DateTime
|
|||||||
return FromFileTime(filetime-milliseconds);
|
return FromFileTime(filetime-milliseconds);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
Interface
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
Interface::~Interface()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
.\CONSOLE.CPP
|
|
||||||
***********************************************************************/
|
|
||||||
/***********************************************************************
|
|
||||||
Author: Zihan Chen (vczh)
|
|
||||||
Licensed under https://github.com/vczh-libraries/License
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
#if defined VCZH_MSVC
|
|
||||||
#elif defined VCZH_GCC
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
using namespace std;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace vl
|
|
||||||
{
|
|
||||||
namespace console
|
|
||||||
{
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
Console
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
void Console::Write(const wchar_t* string, vint length)
|
|
||||||
{
|
|
||||||
#if defined VCZH_MSVC
|
|
||||||
HANDLE outHandle=GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
DWORD fileMode=0;
|
|
||||||
DWORD written=0;
|
|
||||||
if((GetFileType(outHandle) & FILE_TYPE_CHAR) && GetConsoleMode(outHandle, &fileMode))
|
|
||||||
{
|
|
||||||
WriteConsole(outHandle, string, (int)length, &written,0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int codePage = GetConsoleOutputCP();
|
|
||||||
int charCount = WideCharToMultiByte(codePage, 0, string, -1, 0, 0, 0, 0);
|
|
||||||
char* codePageBuffer = new char[charCount];
|
|
||||||
WideCharToMultiByte(codePage, 0, string, -1, codePageBuffer, charCount, 0, 0);
|
|
||||||
WriteFile(outHandle, codePageBuffer, charCount-1, &written, 0);
|
|
||||||
delete[] codePageBuffer;
|
|
||||||
}
|
|
||||||
#elif defined VCZH_GCC
|
|
||||||
wstring s(string, string+length);
|
|
||||||
wcout<<s<<ends;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::Write(const wchar_t* string)
|
|
||||||
{
|
|
||||||
Write(string, wcslen(string));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::Write(const WString& string)
|
|
||||||
{
|
|
||||||
Write(string.Buffer(), string.Length());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::WriteLine(const WString& string)
|
|
||||||
{
|
|
||||||
Write(string);
|
|
||||||
Write(L"\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
WString Console::Read()
|
|
||||||
{
|
|
||||||
#if defined VCZH_MSVC
|
|
||||||
WString result;
|
|
||||||
DWORD count;
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
wchar_t buffer;
|
|
||||||
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&buffer,1,&count,0);
|
|
||||||
if(buffer==L'\r')
|
|
||||||
{
|
|
||||||
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&buffer,1,&count,0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if(buffer==L'\n')
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result=result+WString::FromChar(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
#elif defined VCZH_GCC
|
|
||||||
wstring s;
|
|
||||||
getline(wcin, s, L'\n');
|
|
||||||
return s.c_str();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::SetColor(bool red, bool green, bool blue, bool light)
|
|
||||||
{
|
|
||||||
#if defined VCZH_MSVC
|
|
||||||
WORD attribute=0;
|
|
||||||
if(red)attribute |=FOREGROUND_RED;
|
|
||||||
if(green)attribute |=FOREGROUND_GREEN;
|
|
||||||
if(blue)attribute |=FOREGROUND_BLUE;
|
|
||||||
if(light)attribute |=FOREGROUND_INTENSITY;
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),attribute);
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_INPUT_HANDLE),attribute);
|
|
||||||
#elif defined VCZH_GCC
|
|
||||||
int color = (blue?1:0)*4 + (green?1:0)*2 + (red?1:0);
|
|
||||||
if(light)
|
|
||||||
wprintf(L"\x1B[00;3%dm", color);
|
|
||||||
else
|
|
||||||
wprintf(L"\x1B[01;3%dm", color);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::SetTitle(const WString& string)
|
|
||||||
{
|
|
||||||
#if defined VCZH_MSVC
|
|
||||||
SetConsoleTitle(string.Buffer());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1665,7 +1646,7 @@ UnitTest
|
|||||||
#ifdef VCZH_MSVC
|
#ifdef VCZH_MSVC
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
SuppressCppFailure(ForwardValue<TCallback&&>(callback));
|
SuppressCppFailure(std::forward<TCallback&&>(callback));
|
||||||
}
|
}
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
@@ -1681,7 +1662,7 @@ UnitTest
|
|||||||
{
|
{
|
||||||
if (suppressFailure)
|
if (suppressFailure)
|
||||||
{
|
{
|
||||||
SuppressCFailure(ForwardValue<TCallback&&>(callback));
|
SuppressCFailure(std::forward<TCallback&&>(callback));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+79
-360
File diff suppressed because it is too large
Load Diff
+35
-15
@@ -438,16 +438,17 @@ Kernel Mode Objects
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Base type of all synchronization objects.</summary>
|
/// <summary>Base type of all synchronization objects.</summary>
|
||||||
class WaitableObject : public Object, public NotCopyable
|
class WaitableObject : public Object
|
||||||
{
|
{
|
||||||
#if defined VCZH_MSVC
|
#if defined VCZH_MSVC
|
||||||
private:
|
private:
|
||||||
threading_internal::WaitableData* waitableData;
|
threading_internal::WaitableData* waitableData;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
WaitableObject();
|
WaitableObject();
|
||||||
void SetData(threading_internal::WaitableData* data);
|
void SetData(threading_internal::WaitableData* data);
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(WaitableObject);
|
||||||
|
|
||||||
/// <summary>Test if the object has already been created. Some of the synchronization objects should initialize itself after the constructor.</summary>
|
/// <summary>Test if the object has already been created. Some of the synchronization objects should initialize itself after the constructor.</summary>
|
||||||
/// <returns>Returns true if the object has already been created.</returns>
|
/// <returns>Returns true if the object has already been created.</returns>
|
||||||
/// <remarks>This function is only available in Windows.</remarks>
|
/// <remarks>This function is only available in Windows.</remarks>
|
||||||
@@ -712,12 +713,13 @@ Kernel Mode Objects in Process
|
|||||||
/// In Windows, enter a owned critical section will not result in dead lock.
|
/// In Windows, enter a owned critical section will not result in dead lock.
|
||||||
/// In Linux and macOS, it works like a mutex.
|
/// In Linux and macOS, it works like a mutex.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
class CriticalSection : public Object, public NotCopyable
|
class CriticalSection : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend class ConditionVariable;
|
friend class ConditionVariable;
|
||||||
threading_internal::CriticalSectionData* internalData;
|
threading_internal::CriticalSectionData* internalData;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(CriticalSection);
|
||||||
/// <summary>Create a critical section.</summary>
|
/// <summary>Create a critical section.</summary>
|
||||||
CriticalSection();
|
CriticalSection();
|
||||||
~CriticalSection();
|
~CriticalSection();
|
||||||
@@ -731,11 +733,12 @@ Kernel Mode Objects in Process
|
|||||||
void Leave();
|
void Leave();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Scope : public Object, public NotCopyable
|
class Scope : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CriticalSection* criticalSection;
|
CriticalSection* criticalSection;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(Scope);
|
||||||
Scope(CriticalSection& _criticalSection);
|
Scope(CriticalSection& _criticalSection);
|
||||||
~Scope();
|
~Scope();
|
||||||
};
|
};
|
||||||
@@ -758,12 +761,13 @@ Kernel Mode Objects in Process
|
|||||||
/// }
|
/// }
|
||||||
/// ]]></code></program>
|
/// ]]></code></program>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ReaderWriterLock : public Object, public NotCopyable
|
class ReaderWriterLock : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend class ConditionVariable;
|
friend class ConditionVariable;
|
||||||
threading_internal::ReaderWriterLockData* internalData;
|
threading_internal::ReaderWriterLockData* internalData;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(ReaderWriterLock);
|
||||||
/// <summary>Create a reader writer lock.</summary>
|
/// <summary>Create a reader writer lock.</summary>
|
||||||
ReaderWriterLock();
|
ReaderWriterLock();
|
||||||
~ReaderWriterLock();
|
~ReaderWriterLock();
|
||||||
@@ -783,31 +787,34 @@ Kernel Mode Objects in Process
|
|||||||
/// <summary>Release a writer lock.</summary>
|
/// <summary>Release a writer lock.</summary>
|
||||||
void LeaveWriter();
|
void LeaveWriter();
|
||||||
public:
|
public:
|
||||||
class ReaderScope : public Object, public NotCopyable
|
class ReaderScope : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ReaderWriterLock* lock;
|
ReaderWriterLock* lock;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(ReaderScope);
|
||||||
ReaderScope(ReaderWriterLock& _lock);
|
ReaderScope(ReaderWriterLock& _lock);
|
||||||
~ReaderScope();
|
~ReaderScope();
|
||||||
};
|
};
|
||||||
|
|
||||||
class WriterScope : public Object, public NotCopyable
|
class WriterScope : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ReaderWriterLock* lock;
|
ReaderWriterLock* lock;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(WriterScope);
|
||||||
WriterScope(ReaderWriterLock& _lock);
|
WriterScope(ReaderWriterLock& _lock);
|
||||||
~WriterScope();
|
~WriterScope();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>Conditional variable.</summary>
|
/// <summary>Conditional variable.</summary>
|
||||||
class ConditionVariable : public Object, public NotCopyable
|
class ConditionVariable : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
threading_internal::ConditionVariableData* internalData;
|
threading_internal::ConditionVariableData* internalData;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(ConditionVariable);
|
||||||
/// <summary>Create a conditional variable.</summary>
|
/// <summary>Create a conditional variable.</summary>
|
||||||
ConditionVariable();
|
ConditionVariable();
|
||||||
~ConditionVariable();
|
~ConditionVariable();
|
||||||
@@ -868,11 +875,12 @@ User Mode Objects
|
|||||||
/// }
|
/// }
|
||||||
/// ]]></code></program>
|
/// ]]></code></program>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SpinLock : public Object, public NotCopyable
|
class SpinLock : public Object
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
volatile LockedInt token;
|
volatile LockedInt token;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(SpinLock);
|
||||||
/// <summary>Create a spin lock.</summary>
|
/// <summary>Create a spin lock.</summary>
|
||||||
SpinLock();
|
SpinLock();
|
||||||
~SpinLock();
|
~SpinLock();
|
||||||
@@ -886,11 +894,12 @@ User Mode Objects
|
|||||||
void Leave();
|
void Leave();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Scope : public Object, public NotCopyable
|
class Scope : public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SpinLock* spinLock;
|
SpinLock* spinLock;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(Scope);
|
||||||
Scope(SpinLock& _spinLock);
|
Scope(SpinLock& _spinLock);
|
||||||
~Scope();
|
~Scope();
|
||||||
};
|
};
|
||||||
@@ -910,7 +919,7 @@ Thread Local Storage
|
|||||||
/// This class is designed to define global variables.
|
/// This class is designed to define global variables.
|
||||||
/// Dynamically allocation will result in undefined behavior.
|
/// Dynamically allocation will result in undefined behavior.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
class ThreadLocalStorage : public Object, private NotCopyable
|
class ThreadLocalStorage : public Object
|
||||||
{
|
{
|
||||||
typedef void(*Destructor)(void*);
|
typedef void(*Destructor)(void*);
|
||||||
protected:
|
protected:
|
||||||
@@ -920,6 +929,7 @@ Thread Local Storage
|
|||||||
|
|
||||||
static void PushStorage(ThreadLocalStorage* storage);
|
static void PushStorage(ThreadLocalStorage* storage);
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(ThreadLocalStorage);
|
||||||
ThreadLocalStorage(Destructor _destructor);
|
ThreadLocalStorage(Destructor _destructor);
|
||||||
~ThreadLocalStorage();
|
~ThreadLocalStorage();
|
||||||
|
|
||||||
@@ -943,7 +953,7 @@ Thread Local Storage
|
|||||||
/// Dynamically allocation will result in undefined behavior.
|
/// Dynamically allocation will result in undefined behavior.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ThreadVariable : public Object, private NotCopyable
|
class ThreadVariable : public Object
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ThreadLocalStorage storage;
|
ThreadLocalStorage storage;
|
||||||
@@ -956,6 +966,8 @@ Thread Local Storage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(ThreadVariable);
|
||||||
|
|
||||||
/// <summary>Create a thread local variable.</summary>
|
/// <summary>Create a thread local variable.</summary>
|
||||||
ThreadVariable()
|
ThreadVariable()
|
||||||
:storage(&Destructor)
|
:storage(&Destructor)
|
||||||
@@ -996,12 +1008,14 @@ Thread Local Storage
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ThreadVariable<T*> : public Object, private NotCopyable
|
class ThreadVariable<T*> : public Object
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ThreadLocalStorage storage;
|
ThreadLocalStorage storage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(ThreadVariable);
|
||||||
|
|
||||||
ThreadVariable()
|
ThreadVariable()
|
||||||
:storage(nullptr)
|
:storage(nullptr)
|
||||||
{
|
{
|
||||||
@@ -2517,9 +2531,12 @@ Text Related
|
|||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
/// <summary>Text reader. All line breaks are normalized to CRLF regardless whatever in the input stream.</summary>
|
/// <summary>Text reader. All line breaks are normalized to CRLF regardless whatever in the input stream.</summary>
|
||||||
class TextReader : public Object, private NotCopyable
|
class TextReader : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(TextReader);
|
||||||
|
TextReader() = default;
|
||||||
|
|
||||||
/// <summary>Test does the reader reach the end or not.</summary>
|
/// <summary>Test does the reader reach the end or not.</summary>
|
||||||
/// <returns>Returns true if the reader reaches the end.</returns>
|
/// <returns>Returns true if the reader reaches the end.</returns>
|
||||||
virtual bool IsEnd()=0;
|
virtual bool IsEnd()=0;
|
||||||
@@ -2539,9 +2556,12 @@ Text Related
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>Text writer.</summary>
|
/// <summary>Text writer.</summary>
|
||||||
class TextWriter : public Object, private NotCopyable
|
class TextWriter : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(TextWriter);
|
||||||
|
TextWriter() = default;
|
||||||
|
|
||||||
/// <summary>Write a single character.</summary>
|
/// <summary>Write a single character.</summary>
|
||||||
/// <param name="c">The character to write.</param>
|
/// <param name="c">The character to write.</param>
|
||||||
virtual void WriteChar(wchar_t c)=0;
|
virtual void WriteChar(wchar_t c)=0;
|
||||||
|
|||||||
+26
-26
@@ -698,7 +698,7 @@ ReferenceCounterOperator
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ReferenceCounterOperator<T, typename PointerConvertable<T, reflection::DescriptableObject>::YesNoType>
|
struct ReferenceCounterOperator<T, std::enable_if_t<std::is_convertible_v<T*, reflection::DescriptableObject*>>>
|
||||||
{
|
{
|
||||||
static __forceinline volatile vint* CreateCounter(T* reference)
|
static __forceinline volatile vint* CreateCounter(T* reference)
|
||||||
{
|
{
|
||||||
@@ -1833,7 +1833,7 @@ ValueType
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
template<typename U = T>
|
template<typename U = T>
|
||||||
static CompareResult ComparePrimitiveInternal(const U& a, const U& b, typename AcceptAlways<vint, decltype(&TypedValueSerializerProvider<U>::Compare)>::Type)
|
static CompareResult ComparePrimitiveInternal(const U& a, const U& b, std::enable_if_t<sizeof(decltype(&TypedValueSerializerProvider<U>::Compare)) >= 0, vint>)
|
||||||
{
|
{
|
||||||
return TypedValueSerializerProvider<U>::Compare(a, b);
|
return TypedValueSerializerProvider<U>::Compare(a, b);
|
||||||
}
|
}
|
||||||
@@ -4072,7 +4072,7 @@ TypeInfoRetriver
|
|||||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||||
static Ptr<ITypeInfo> CreateTypeInfo()
|
static Ptr<ITypeInfo> CreateTypeInfo()
|
||||||
{
|
{
|
||||||
return DetailTypeInfoRetriver<typename RemoveCVR<T>::Type, TypeFlag>::CreateTypeInfo(Hint);
|
return DetailTypeInfoRetriver<std::remove_cvref_t<T>, TypeFlag>::CreateTypeInfo(Hint);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -4094,7 +4094,7 @@ TypeInfoRetriver Helper Functions (BoxValue, UnboxValue)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
Value BoxValue(const T& object, ITypeDescriptor* typeDescriptor=0)
|
Value BoxValue(const T& object, ITypeDescriptor* typeDescriptor=0)
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
using Type = std::remove_cvref_t<T>;
|
||||||
return ValueAccessor<Type, TypeInfoRetriver<Type>::Decorator>::BoxValue(object, typeDescriptor);
|
return ValueAccessor<Type, TypeInfoRetriver<Type>::Decorator>::BoxValue(object, typeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4107,7 +4107,7 @@ TypeInfoRetriver Helper Functions (BoxValue, UnboxValue)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
T UnboxValue(const Value& value, ITypeDescriptor* typeDescriptor=0, const WString& valueName=L"value")
|
T UnboxValue(const Value& value, ITypeDescriptor* typeDescriptor=0, const WString& valueName=L"value")
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
using Type = std::remove_cvref_t<T>;
|
||||||
return ValueAccessor<Type, TypeInfoRetriver<Type>::Decorator>::UnboxValue(value, typeDescriptor, valueName);
|
return ValueAccessor<Type, TypeInfoRetriver<Type>::Decorator>::UnboxValue(value, typeDescriptor, valueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5774,7 +5774,7 @@ ValueFunctionProxyWrapper<Func<R(TArgs...)>>
|
|||||||
template<typename R, typename ...TArgs>
|
template<typename R, typename ...TArgs>
|
||||||
struct BoxedFunctionInvoker
|
struct BoxedFunctionInvoker
|
||||||
{
|
{
|
||||||
static Value Invoke(const Func<R(TArgs...)>& function, Ptr<IValueList> arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(const Func<R(TArgs...)>& function, Ptr<IValueList> arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(arguments, 0, args...);
|
UnboxSpecifiedParameter(arguments, 0, args...);
|
||||||
R result = function(args...);
|
R result = function(args...);
|
||||||
@@ -5785,7 +5785,7 @@ ValueFunctionProxyWrapper<Func<R(TArgs...)>>
|
|||||||
template<typename ...TArgs>
|
template<typename ...TArgs>
|
||||||
struct BoxedFunctionInvoker<void, TArgs...>
|
struct BoxedFunctionInvoker<void, TArgs...>
|
||||||
{
|
{
|
||||||
static Value Invoke(const Func<void(TArgs...)>& function, Ptr<IValueList> arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(const Func<void(TArgs...)>& function, Ptr<IValueList> arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(arguments, 0, args...);
|
UnboxSpecifiedParameter(arguments, 0, args...);
|
||||||
function(args...);
|
function(args...);
|
||||||
@@ -5822,7 +5822,7 @@ ValueFunctionProxyWrapper<Func<R(TArgs...)>>
|
|||||||
CHECK_FAIL(L"Argument count mismatch.");
|
CHECK_FAIL(L"Argument count mismatch.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return internal_helper::BoxedFunctionInvoker<R, TArgs...>::Invoke(function, arguments, typename RemoveCVR<TArgs>::Type()...);
|
return internal_helper::BoxedFunctionInvoker<R, TArgs...>::Invoke(function, arguments, std::remove_cvref_t<TArgs>()...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5873,7 +5873,7 @@ ParameterAccessor<Func<R(TArgs...)>>
|
|||||||
result=[functionProxy](TArgs ...args)
|
result=[functionProxy](TArgs ...args)
|
||||||
{
|
{
|
||||||
Ptr<IValueList> arguments = IValueList::Create();
|
Ptr<IValueList> arguments = IValueList::Create();
|
||||||
internal_helper::AddValueToList(arguments, ForwardValue<TArgs>(args)...);
|
internal_helper::AddValueToList(arguments, std::forward<TArgs>(args)...);
|
||||||
typedef typename TypeInfoRetriver<R>::TempValueType ResultType;
|
typedef typename TypeInfoRetriver<R>::TempValueType ResultType;
|
||||||
ResultType proxyResult;
|
ResultType proxyResult;
|
||||||
description::UnboxParameter<ResultType>(functionProxy->Invoke(arguments), proxyResult);
|
description::UnboxParameter<ResultType>(functionProxy->Invoke(arguments), proxyResult);
|
||||||
@@ -5928,7 +5928,7 @@ CustomConstructorInfoImpl<R(TArgs...)>
|
|||||||
template<typename R, typename ...TArgs>
|
template<typename R, typename ...TArgs>
|
||||||
struct BoxedConstructorInvoker
|
struct BoxedConstructorInvoker
|
||||||
{
|
{
|
||||||
static Value Invoke(MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
R result = new typename TypeInfoRetriver<R>::Type(args...);
|
R result = new typename TypeInfoRetriver<R>::Type(args...);
|
||||||
@@ -5961,7 +5961,7 @@ CustomConstructorInfoImpl<R(TArgs...)>
|
|||||||
protected:
|
protected:
|
||||||
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
||||||
{
|
{
|
||||||
return internal_helper::BoxedConstructorInvoker<R, TArgs...>::Invoke(this, arguments, typename RemoveCVR<TArgs>::Type()...);
|
return internal_helper::BoxedConstructorInvoker<R, TArgs...>::Invoke(this, arguments, std::remove_cvref_t<TArgs>()...);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
||||||
@@ -5998,7 +5998,7 @@ CustomStaticMethodInfoImpl<TClass, R(TArgs...)>
|
|||||||
template<typename TClass, typename R, typename ...TArgs>
|
template<typename TClass, typename R, typename ...TArgs>
|
||||||
struct BoxedMethodInvoker
|
struct BoxedMethodInvoker
|
||||||
{
|
{
|
||||||
static Value Invoke(TClass* object, R(__thiscall TClass::* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(TClass* object, R(__thiscall TClass::* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
R result = (object->*method)(args...);
|
R result = (object->*method)(args...);
|
||||||
@@ -6009,7 +6009,7 @@ CustomStaticMethodInfoImpl<TClass, R(TArgs...)>
|
|||||||
template<typename TClass, typename ...TArgs>
|
template<typename TClass, typename ...TArgs>
|
||||||
struct BoxedMethodInvoker<TClass, void, TArgs...>
|
struct BoxedMethodInvoker<TClass, void, TArgs...>
|
||||||
{
|
{
|
||||||
static Value Invoke(TClass* object, void(__thiscall TClass::* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(TClass* object, void(__thiscall TClass::* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
(object->*method)(args...);
|
(object->*method)(args...);
|
||||||
@@ -6020,7 +6020,7 @@ CustomStaticMethodInfoImpl<TClass, R(TArgs...)>
|
|||||||
template<typename TClass, typename R, typename ...TArgs>
|
template<typename TClass, typename R, typename ...TArgs>
|
||||||
struct BoxedExternalMethodInvoker
|
struct BoxedExternalMethodInvoker
|
||||||
{
|
{
|
||||||
static Value Invoke(TClass* object, R(*method)(TClass*, TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(TClass* object, R(*method)(TClass*, TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
R result = method(object, args...);
|
R result = method(object, args...);
|
||||||
@@ -6031,7 +6031,7 @@ CustomStaticMethodInfoImpl<TClass, R(TArgs...)>
|
|||||||
template<typename TClass, typename ...TArgs>
|
template<typename TClass, typename ...TArgs>
|
||||||
struct BoxedExternalMethodInvoker<TClass, void, TArgs...>
|
struct BoxedExternalMethodInvoker<TClass, void, TArgs...>
|
||||||
{
|
{
|
||||||
static Value Invoke(TClass* object, void(*method)(TClass*, TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(TClass* object, void(*method)(TClass*, TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
method(object, args...);
|
method(object, args...);
|
||||||
@@ -6084,7 +6084,7 @@ CustomStaticMethodInfoImpl<TClass, R(TArgs...)>
|
|||||||
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
||||||
{
|
{
|
||||||
TClass* object=UnboxValue<TClass*>(thisObject, GetOwnerTypeDescriptor(), L"thisObject");
|
TClass* object=UnboxValue<TClass*>(thisObject, GetOwnerTypeDescriptor(), L"thisObject");
|
||||||
return internal_helper::BoxedMethodInvoker<TClass, R, TArgs...>::Invoke(object, method, this, arguments, typename RemoveCVR<TArgs>::Type()...);
|
return internal_helper::BoxedMethodInvoker<TClass, R, TArgs...>::Invoke(object, method, this, arguments, std::remove_cvref_t<TArgs>()...);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
||||||
@@ -6111,7 +6111,7 @@ CustomStaticMethodInfoImpl<TClass, R(TArgs...)>
|
|||||||
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
||||||
{
|
{
|
||||||
TClass* object=UnboxValue<TClass*>(thisObject, GetOwnerTypeDescriptor(), L"thisObject");
|
TClass* object=UnboxValue<TClass*>(thisObject, GetOwnerTypeDescriptor(), L"thisObject");
|
||||||
return internal_helper::BoxedExternalMethodInvoker<TClass, R, TArgs...>::Invoke(object, method, this, arguments, typename RemoveCVR<TArgs>::Type()...);
|
return internal_helper::BoxedExternalMethodInvoker<TClass, R, TArgs...>::Invoke(object, method, this, arguments, std::remove_cvref_t<TArgs>()...);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
||||||
@@ -6138,7 +6138,7 @@ CustomStaticMethodInfoImpl<R(TArgs...)>
|
|||||||
template<typename R, typename ...TArgs>
|
template<typename R, typename ...TArgs>
|
||||||
struct BoxedStaticMethodInvoker
|
struct BoxedStaticMethodInvoker
|
||||||
{
|
{
|
||||||
static Value Invoke(R(* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(R(* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
R result = method(args...);
|
R result = method(args...);
|
||||||
@@ -6149,7 +6149,7 @@ CustomStaticMethodInfoImpl<R(TArgs...)>
|
|||||||
template<typename ...TArgs>
|
template<typename ...TArgs>
|
||||||
struct BoxedStaticMethodInvoker<void, TArgs...>
|
struct BoxedStaticMethodInvoker<void, TArgs...>
|
||||||
{
|
{
|
||||||
static Value Invoke(void(* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static Value Invoke(void(* method)(TArgs...), MethodInfoImpl* methodInfo, collections::Array<Value>& arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
UnboxSpecifiedParameter(methodInfo, arguments, 0, args...);
|
||||||
method(args...);
|
method(args...);
|
||||||
@@ -6166,7 +6166,7 @@ CustomStaticMethodInfoImpl<R(TArgs...)>
|
|||||||
|
|
||||||
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
Value InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)override
|
||||||
{
|
{
|
||||||
return internal_helper::BoxedStaticMethodInvoker<R, TArgs...>::Invoke(method, this, arguments, typename RemoveCVR<TArgs>::Type()...);
|
return internal_helper::BoxedStaticMethodInvoker<R, TArgs...>::Invoke(method, this, arguments, std::remove_cvref_t<TArgs>()...);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
Value CreateFunctionProxyInternal(const Value& thisObject)override
|
||||||
@@ -6192,7 +6192,7 @@ CustomEventInfoImpl<void(TArgs...)>
|
|||||||
template<typename ...TArgs>
|
template<typename ...TArgs>
|
||||||
struct BoxedEventInvoker
|
struct BoxedEventInvoker
|
||||||
{
|
{
|
||||||
static void Invoke(Event<void(TArgs...)>& eventObject, Ptr<IValueList> arguments, typename RemoveCVR<TArgs>::Type&& ...args)
|
static void Invoke(Event<void(TArgs...)>& eventObject, Ptr<IValueList> arguments, std::remove_cvref_t<TArgs>&& ...args)
|
||||||
{
|
{
|
||||||
UnboxSpecifiedParameter(arguments, 0, args...);
|
UnboxSpecifiedParameter(arguments, 0, args...);
|
||||||
eventObject(args...);
|
eventObject(args...);
|
||||||
@@ -6213,7 +6213,7 @@ CustomEventInfoImpl<void(TArgs...)>
|
|||||||
auto func = Func<void(TArgs...)>([=](TArgs ...args)
|
auto func = Func<void(TArgs...)>([=](TArgs ...args)
|
||||||
{
|
{
|
||||||
auto arguments = IValueList::Create();
|
auto arguments = IValueList::Create();
|
||||||
internal_helper::AddValueToList(arguments, ForwardValue<TArgs>(args)...);
|
internal_helper::AddValueToList(arguments, std::forward<TArgs>(args)...);
|
||||||
handler->Invoke(arguments);
|
handler->Invoke(arguments);
|
||||||
});
|
});
|
||||||
return EventHelper<TArgs...>::Attach(eventObject, func);
|
return EventHelper<TArgs...>::Attach(eventObject, func);
|
||||||
@@ -6230,7 +6230,7 @@ CustomEventInfoImpl<void(TArgs...)>
|
|||||||
{
|
{
|
||||||
TClass* object = UnboxValue<TClass*>(Value::From(thisObject), GetOwnerTypeDescriptor(), L"thisObject");
|
TClass* object = UnboxValue<TClass*>(Value::From(thisObject), GetOwnerTypeDescriptor(), L"thisObject");
|
||||||
Event<void(TArgs...)>& eventObject = object->*eventRef;
|
Event<void(TArgs...)>& eventObject = object->*eventRef;
|
||||||
internal_helper::BoxedEventInvoker<TArgs...>::Invoke(eventObject, arguments, typename RemoveCVR<TArgs>::Type()...);
|
internal_helper::BoxedEventInvoker<TArgs...>::Invoke(eventObject, arguments, typename std::remove_cvref_t<TArgs>()...);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<ITypeInfo> GetHandlerTypeInternal()override
|
Ptr<ITypeInfo> GetHandlerTypeInternal()override
|
||||||
@@ -6545,13 +6545,13 @@ ParameterAccessor<TStruct>
|
|||||||
typeDescriptor = GetTypeDescriptor<typename TypeInfoRetriver<T>::Type>();
|
typeDescriptor = GetTypeDescriptor<typename TypeInfoRetriver<T>::Type>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
using Type = typename vl::RemoveCVR<T>::Type;
|
using Type = std::remove_cvref_t<T>;
|
||||||
return Value::From(new IValueType::TypedBox<Type>(object), typeDescriptor);
|
return Value::From(new IValueType::TypedBox<Type>(object), typeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static T UnboxValue(const Value& value, ITypeDescriptor* typeDescriptor, const WString& valueName)
|
static T UnboxValue(const Value& value, ITypeDescriptor* typeDescriptor, const WString& valueName)
|
||||||
{
|
{
|
||||||
using Type = typename vl::RemoveCVR<T>::Type;
|
using Type = std::remove_cvref_t<T>;
|
||||||
if (auto unboxedValue = value.GetBoxedValue().Cast<IValueType::TypedBox<Type>>())
|
if (auto unboxedValue = value.GetBoxedValue().Cast<IValueType::TypedBox<Type>>())
|
||||||
{
|
{
|
||||||
return unboxedValue->value;
|
return unboxedValue->value;
|
||||||
@@ -6911,7 +6911,7 @@ Class
|
|||||||
protected:\
|
protected:\
|
||||||
bool IsAggregatable()override\
|
bool IsAggregatable()override\
|
||||||
{\
|
{\
|
||||||
return AcceptValue<typename PointerConvertable<TYPENAME, AggregatableDescription<TYPENAME>>::YesNoType>::Result;\
|
return std::is_convertible_v<TYPENAME*, AggregatableDescription<TYPENAME>*>;\
|
||||||
}\
|
}\
|
||||||
void LoadInternal()override\
|
void LoadInternal()override\
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3422,18 +3422,6 @@ Data Structures for Backtracking
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
struct POD<regex_internal::StateSaver>
|
|
||||||
{
|
|
||||||
static const bool Result = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct POD<regex_internal::ExtensionSaver>
|
|
||||||
{
|
|
||||||
static const bool Result = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace regex_internal
|
namespace regex_internal
|
||||||
{
|
{
|
||||||
using namespace collections;
|
using namespace collections;
|
||||||
|
|||||||
+14
-17
@@ -58,7 +58,7 @@ Data Structure
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>A match produces by a <see cref="Regex"/>.</summary>
|
/// <summary>A match produces by a <see cref="Regex"/>.</summary>
|
||||||
class RegexMatch : public Object, private NotCopyable
|
class RegexMatch : public Object
|
||||||
{
|
{
|
||||||
friend class Regex;
|
friend class Regex;
|
||||||
public:
|
public:
|
||||||
@@ -76,6 +76,7 @@ Data Structure
|
|||||||
RegexMatch(const WString& _string, regex_internal::RichResult* _result, regex_internal::RichInterpretor* _rich);
|
RegexMatch(const WString& _string, regex_internal::RichResult* _result, regex_internal::RichInterpretor* _rich);
|
||||||
RegexMatch(const RegexString& _result);
|
RegexMatch(const RegexString& _result);
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(RegexMatch);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test if this match is a succeeded match or a failed match.
|
/// Test if this match is a succeeded match or a failed match.
|
||||||
@@ -216,7 +217,7 @@ Regex
|
|||||||
/// Testing only returns a bool very indicating success or failure.
|
/// Testing only returns a bool very indicating success or failure.
|
||||||
/// </p>
|
/// </p>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class Regex : public Object, private NotCopyable
|
class Regex : public Object
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
regex_internal::PureInterpretor* pure = nullptr;
|
regex_internal::PureInterpretor* pure = nullptr;
|
||||||
@@ -224,6 +225,7 @@ Regex
|
|||||||
|
|
||||||
void Process(const WString& text, bool keepEmpty, bool keepSuccess, bool keepFail, RegexMatch::List& matches)const;
|
void Process(const WString& text, bool keepEmpty, bool keepSuccess, bool keepFail, RegexMatch::List& matches)const;
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(Regex);
|
||||||
/// <summary>Create a regular expression. It will crash if the regular expression produces syntax error.</summary>
|
/// <summary>Create a regular expression. It will crash if the regular expression produces syntax error.</summary>
|
||||||
/// <param name="code">The regular expression in a string.</param>
|
/// <param name="code">The regular expression in a string.</param>
|
||||||
/// <param name="preferPure">Set to true to use DFA if possible.</param>
|
/// <param name="preferPure">Set to true to use DFA if possible.</param>
|
||||||
@@ -1009,7 +1011,7 @@ Tokenizer
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>Lexical analyzer.</summary>
|
/// <summary>Lexical analyzer.</summary>
|
||||||
class RegexLexer : public Object, private NotCopyable
|
class RegexLexer : public Object
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
regex_internal::PureInterpretor* pure = nullptr;
|
regex_internal::PureInterpretor* pure = nullptr;
|
||||||
@@ -1018,6 +1020,7 @@ Tokenizer
|
|||||||
RegexProc proc;
|
RegexProc proc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(RegexLexer);
|
||||||
/// <summary>Create a lexical analyzer by a set of regular expressions. [F:vl.regex.RegexToken.token] will be the index of the matched regular expression in the first argument.</summary>
|
/// <summary>Create a lexical analyzer by a set of regular expressions. [F:vl.regex.RegexToken.token] will be the index of the matched regular expression in the first argument.</summary>
|
||||||
/// <param name="tokens">ALl regular expression, each one represent a kind of tokens.</param>
|
/// <param name="tokens">ALl regular expression, each one represent a kind of tokens.</param>
|
||||||
/// <param name="_proc">Configuration of all callbacks.</param>
|
/// <param name="_proc">Configuration of all callbacks.</param>
|
||||||
@@ -1089,12 +1092,6 @@ Data Structure
|
|||||||
bool operator!=(wchar_t item)const;
|
bool operator!=(wchar_t item)const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
struct POD<regex_internal::CharRange>
|
|
||||||
{
|
|
||||||
static const bool Result=true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1231,9 +1228,12 @@ namespace vl
|
|||||||
Regex Expression AST
|
Regex Expression AST
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
class Expression : public Object, private NotCopyable
|
class Expression : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
NOT_COPYABLE(Expression);
|
||||||
|
Expression() = default;
|
||||||
|
|
||||||
typedef Ptr<Expression> Ref;
|
typedef Ptr<Expression> Ref;
|
||||||
typedef collections::Dictionary<WString, Expression::Ref> Map;
|
typedef collections::Dictionary<WString, Expression::Ref> Map;
|
||||||
|
|
||||||
@@ -1342,7 +1342,7 @@ Regex Expression AST
|
|||||||
void Apply(IRegexExpressionAlgorithm& algorithm);
|
void Apply(IRegexExpressionAlgorithm& algorithm);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RegexExpression : public Object, private NotCopyable
|
class RegexExpression : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Ptr<RegexExpression> Ref;
|
typedef Ptr<RegexExpression> Ref;
|
||||||
@@ -1350,6 +1350,9 @@ Regex Expression AST
|
|||||||
Expression::Map definitions; // Named regex to be referred
|
Expression::Map definitions; // Named regex to be referred
|
||||||
Expression::Ref expression; // Regex to match
|
Expression::Ref expression; // Regex to match
|
||||||
|
|
||||||
|
NOT_COPYABLE(RegexExpression);
|
||||||
|
RegexExpression() = default;
|
||||||
|
|
||||||
Expression::Ref Merge();
|
Expression::Ref Merge();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1660,12 +1663,6 @@ namespace vl
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
struct POD<regex_internal::CaptureRecord>
|
|
||||||
{
|
|
||||||
static const bool Result=true;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace regex_internal
|
namespace regex_internal
|
||||||
{
|
{
|
||||||
class RichResult
|
class RichResult
|
||||||
|
|||||||
@@ -21515,9 +21515,9 @@ namespace vl
|
|||||||
writer.WriteLine(L";");
|
writer.WriteLine(L";");
|
||||||
|
|
||||||
writer.WriteString(tryPrefix);
|
writer.WriteString(tryPrefix);
|
||||||
writer.WriteString(L"::vl::__vwsn::RunOnExit<::vl::RemoveCVR<decltype(");
|
writer.WriteString(L"::vl::__vwsn::RunOnExit<::std::remove_cvref_t<decltype(");
|
||||||
writer.WriteString(blockName);
|
writer.WriteString(blockName);
|
||||||
writer.WriteString(L")>::Type> ");
|
writer.WriteString(L")>> ");
|
||||||
writer.WriteString(blockName);
|
writer.WriteString(blockName);
|
||||||
writer.WriteString(L"_dtor(&");
|
writer.WriteString(L"_dtor(&");
|
||||||
writer.WriteString(blockName);
|
writer.WriteString(blockName);
|
||||||
|
|||||||
@@ -67,14 +67,14 @@ namespace vl
|
|||||||
Ptr<T> Ensure(Ptr<T>&& pointer)
|
Ptr<T> Ensure(Ptr<T>&& pointer)
|
||||||
{
|
{
|
||||||
CHECK_ERROR(pointer != nullptr, L"The pointer cannot be null.");
|
CHECK_ERROR(pointer != nullptr, L"The pointer cannot be null.");
|
||||||
return MoveValue(pointer);
|
return std::move(pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Nullable<T> Ensure(Nullable<T>&& nullable)
|
Nullable<T> Ensure(Nullable<T>&& nullable)
|
||||||
{
|
{
|
||||||
CHECK_ERROR(nullable, L"The pointer cannot be null.");
|
CHECK_ERROR(nullable, L"The pointer cannot be null.");
|
||||||
return MoveValue(nullable);
|
return std::move(nullable);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -87,18 +87,16 @@ namespace vl
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
WString ToString(const T& value)
|
WString ToString(const T& value)
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
|
||||||
WString str;
|
WString str;
|
||||||
CHECK_ERROR(reflection::description::TypedValueSerializerProvider<T>::Serialize(value, str), L"Failed to serialize.");
|
CHECK_ERROR(reflection::description::TypedValueSerializerProvider<std::remove_cvref_t<T>>::Serialize(value, str), L"Failed to serialize.");
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T Parse(const WString& str)
|
T Parse(const WString& str)
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
|
||||||
T value;
|
T value;
|
||||||
CHECK_ERROR(reflection::description::TypedValueSerializerProvider<T>::Deserialize(str, value), L"Failed to serialize.");
|
CHECK_ERROR(reflection::description::TypedValueSerializerProvider<std::remove_cvref_t<T>>::Deserialize(str, value), L"Failed to serialize.");
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,16 +151,14 @@ namespace vl
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
reflection::description::Value Box(const T& value)
|
reflection::description::Value Box(const T& value)
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
return reflection::description::BoxParameter<std::remove_cvref_t<T>>(const_cast<T&>(value));
|
||||||
return reflection::description::BoxParameter<Type>(const_cast<T&>(value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T Unbox(const reflection::description::Value& value)
|
T Unbox(const reflection::description::Value& value)
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
|
||||||
T result;
|
T result;
|
||||||
reflection::description::UnboxParameter<Type>(value, result);
|
reflection::description::UnboxParameter<std::remove_cvref_t<T>>(value, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,8 +202,7 @@ namespace vl
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
T UnboxWeak(const reflection::description::Value& value)
|
T UnboxWeak(const reflection::description::Value& value)
|
||||||
{
|
{
|
||||||
using Type = typename RemoveCVR<T>::Type;
|
return UnboxWeakHelper<std::remove_cvref_t<T>>::Unbox(value);
|
||||||
return UnboxWeakHelper<Type>::Unbox(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user