2020-12-15 09:27:44 -04:00
|
|
|
// Copyright 2011-2020 Molecular Matters GmbH, all rights reserved.
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
2020-12-15 09:27:44 -04:00
|
|
|
// BEGIN EPIC MOD
|
|
|
|
|
//#include PCH_INCLUDE
|
|
|
|
|
// END EPIC MOD
|
2021-03-29 09:23:17 -04:00
|
|
|
|
2021-03-30 09:03:46 -04:00
|
|
|
#include "LC_StringUtil.h"
|
2021-03-29 09:23:17 -04:00
|
|
|
// BEGIN EPIC MOD
|
2022-01-03 15:42:39 -05:00
|
|
|
#if defined(__clang__) && defined(_MSC_VER) && _MSVC_LANG > 201402L && __clang_major__ < 13
|
2021-03-29 09:23:17 -04:00
|
|
|
// For reference: https://bugs.llvm.org/show_bug.cgi?id=41226#c16
|
2021-03-30 09:03:46 -04:00
|
|
|
#include <wchar.h>
|
2021-03-29 09:23:17 -04:00
|
|
|
#endif
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
#include "Windows/WindowsHWrapper.h"
|
2020-12-15 09:27:44 -04:00
|
|
|
// END EPIC MOD
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
|
{
|
2020-01-29 14:48:18 -05:00
|
|
|
static std::wstring ToWideString(const char* utf8Str, size_t length)
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
{
|
|
|
|
|
const int sizeNeeded = ::MultiByteToWideChar(CP_UTF8, 0, utf8Str, static_cast<int>(length), NULL, 0);
|
|
|
|
|
|
2020-01-29 14:48:18 -05:00
|
|
|
wchar_t* wstrTo = static_cast<wchar_t*>(_alloca(static_cast<size_t>(sizeNeeded) * sizeof(wchar_t)));
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
|
|
|
|
::MultiByteToWideChar(CP_UTF8, 0, utf8Str, static_cast<int>(length), wstrTo, sizeNeeded);
|
|
|
|
|
return std::wstring(wstrTo, static_cast<size_t>(sizeNeeded));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
static bool Matches(const T* str1, const T* str2)
|
|
|
|
|
{
|
|
|
|
|
unsigned int index = 0u;
|
|
|
|
|
T c1 = str1[index];
|
|
|
|
|
T c2 = str2[index];
|
|
|
|
|
|
|
|
|
|
while ((c1 != '\0') && (c2 != '\0'))
|
|
|
|
|
{
|
|
|
|
|
if (c1 != c2)
|
|
|
|
|
{
|
|
|
|
|
// at least one character is different
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++index;
|
|
|
|
|
c1 = str1[index];
|
|
|
|
|
c2 = str2[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// reached the end of at least one string, but the string could be of different length
|
|
|
|
|
return (c1 == c2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
static bool StartsWith(const T* str, const T* subString)
|
|
|
|
|
{
|
|
|
|
|
unsigned int index = 0u;
|
|
|
|
|
T c1 = str[index];
|
|
|
|
|
T c2 = subString[index];
|
|
|
|
|
|
|
|
|
|
while ((c1 != '\0') && (c2 != '\0'))
|
|
|
|
|
{
|
|
|
|
|
if (c1 != c2)
|
|
|
|
|
{
|
|
|
|
|
// at least one character is different
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++index;
|
|
|
|
|
c1 = str[index];
|
|
|
|
|
c2 = subString[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// reached the end of at least one string.
|
|
|
|
|
// if str has ended but subString has not, it cannot be fully contained in str.
|
|
|
|
|
if ((c1 == '\0') && (c2 != '\0'))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-03-18 08:13:59 -04:00
|
|
|
|
|
|
|
|
// BEGIN EPIC MOD
|
|
|
|
|
template <typename T>
|
|
|
|
|
static const T* StartsWithEx(const T* str, const T* subString)
|
|
|
|
|
{
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
// Reached the end of the substring, return the remaining part of original string
|
|
|
|
|
T c2 = *subString++;
|
|
|
|
|
if (c2 == 0)
|
|
|
|
|
{
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the characters don't match, we are done. We don't have to do a check specifically
|
|
|
|
|
// for 0 since we know that c2 must not be zero at this point.
|
|
|
|
|
T c1 = *str++;
|
|
|
|
|
if (c1 != c2)
|
|
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
bool MatchesWildcardRecursive(const T* target, const T* wildcard)
|
|
|
|
|
{
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
T w = *wildcard++;
|
|
|
|
|
|
|
|
|
|
// We have reached the end of the wildcard string, this is successful if have no more target string
|
|
|
|
|
if (w == 0)
|
|
|
|
|
{
|
|
|
|
|
return *target == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we have a wildcard character, then
|
|
|
|
|
else if (w == '*')
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Skip any multiple wildcards
|
|
|
|
|
for (; *wildcard == '*'; ++wildcard)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w = *wildcard++;
|
|
|
|
|
|
|
|
|
|
// If wildcard is at the end of the wildcards, then we have a match
|
|
|
|
|
if (w == 0)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Look through the target string for the given character.
|
|
|
|
|
// If we reach the end of the target string without finding a match
|
|
|
|
|
// then this is a failed match. If we find the character, recurse
|
|
|
|
|
// to match the remaining part of the string
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
T t = *target++;
|
|
|
|
|
if (t == 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (t == w && MatchesWildcardRecursive(target, wildcard))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we don't match the character, then we don't have a match
|
|
|
|
|
else if (w != *target++)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-30 09:03:46 -04:00
|
|
|
|
|
|
|
|
// Temporary replacement for std::wstring::find
|
|
|
|
|
static size_t WideFindOffset(const std::wstring& haystack, const std::wstring& needle)
|
|
|
|
|
{
|
2022-01-03 15:42:39 -05:00
|
|
|
#if defined(__clang__) && defined(_MSC_VER) && _MSVC_LANG > 201402L && __clang_major__ < 13
|
2021-03-30 09:03:46 -04:00
|
|
|
// For reference: https://bugs.llvm.org/show_bug.cgi?id=41226#c16
|
|
|
|
|
const wchar_t* found = ::wcsstr(haystack.c_str(), needle.c_str());
|
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
return static_cast<size_t>(found - haystack.c_str());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return std::wstring::npos;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
return haystack.find(needle);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 08:13:59 -04:00
|
|
|
// END EPIC MOD
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace string
|
|
|
|
|
{
|
|
|
|
|
std::wstring ToWideString(const char* utf8Str)
|
|
|
|
|
{
|
|
|
|
|
return detail::ToWideString(utf8Str, strlen(utf8Str));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring ToWideString(const char* utf8Str, size_t count)
|
|
|
|
|
{
|
|
|
|
|
size_t length = 0u;
|
2021-01-13 09:08:55 -04:00
|
|
|
// BEGIN EPIC MOD - PVS FIX
|
|
|
|
|
while ((length < count) && (utf8Str[length] != '\0'))
|
|
|
|
|
// END EPIC MOD
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
{
|
|
|
|
|
// find null-terminator
|
|
|
|
|
++length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return detail::ToWideString(utf8Str, length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring ToWideString(const std::string& str)
|
|
|
|
|
{
|
|
|
|
|
return detail::ToWideString(str.c_str(), str.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring Replace(const std::wstring& str, const std::wstring& from, const std::wstring& to)
|
|
|
|
|
{
|
|
|
|
|
std::wstring result = str;
|
|
|
|
|
|
2021-03-30 09:03:46 -04:00
|
|
|
// BEGIN EPIC MOD
|
|
|
|
|
size_t startPos = detail::WideFindOffset(str, from);
|
|
|
|
|
// END EPIC MOD
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
if (startPos == std::wstring::npos)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
result.replace(startPos, from.length(), to);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string Replace(const std::string& str, const std::string& from, const std::string& to)
|
|
|
|
|
{
|
|
|
|
|
std::string result = str;
|
|
|
|
|
|
|
|
|
|
size_t startPos = str.find(from);
|
|
|
|
|
if (startPos == std::string::npos)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
result.replace(startPos, from.length(), to);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-12-15 09:27:44 -04:00
|
|
|
std::string ReplaceAll(const std::string& str, const std::string& from, const std::string& to)
|
|
|
|
|
{
|
|
|
|
|
std::string result(str);
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
const size_t pos = result.find(from);
|
|
|
|
|
if (pos == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.replace(pos, from.length(), to);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
std::wstring ReplaceAll(const std::wstring& str, const std::wstring& from, const std::wstring& to)
|
|
|
|
|
{
|
|
|
|
|
std::wstring result(str);
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
2021-03-30 09:03:46 -04:00
|
|
|
// BEGIN EPIC MOD
|
|
|
|
|
const size_t pos = detail::WideFindOffset(result, from);
|
|
|
|
|
// END EPIC MOD
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
if (pos == std::wstring::npos)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.replace(pos, from.length(), to);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-01-29 14:48:18 -05:00
|
|
|
std::string EraseAll(const std::string& str, const std::string& subString)
|
|
|
|
|
{
|
|
|
|
|
const size_t subStringLength = subString.length();
|
|
|
|
|
std::string result(str);
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
const size_t pos = result.find(subString);
|
|
|
|
|
if (pos == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.erase(pos, subStringLength);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
std::wstring EraseAll(const std::wstring& str, const std::wstring& subString)
|
|
|
|
|
{
|
|
|
|
|
const size_t subStringLength = subString.length();
|
|
|
|
|
std::wstring result(str);
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
2021-03-30 09:03:46 -04:00
|
|
|
// BEGIN EPIC MOD
|
|
|
|
|
const size_t pos = detail::WideFindOffset(result, subString);
|
|
|
|
|
// END EPIC MOD
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
if (pos == std::wstring::npos)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.erase(pos, subStringLength);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char* Find(char* str, const char* subString)
|
|
|
|
|
{
|
|
|
|
|
return strstr(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* Find(wchar_t* str, const wchar_t* subString)
|
|
|
|
|
{
|
|
|
|
|
return wcsstr(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char* Find(const char* str, const char* subString)
|
|
|
|
|
{
|
|
|
|
|
return strstr(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const wchar_t* Find(const wchar_t* str, const wchar_t* subString)
|
|
|
|
|
{
|
|
|
|
|
return wcsstr(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-01-29 14:48:18 -05:00
|
|
|
const wchar_t* Find(const wchar_t* str, size_t strLength, const wchar_t* subString, size_t subStringLength)
|
|
|
|
|
{
|
|
|
|
|
const wchar_t* end = str + strLength;
|
|
|
|
|
while (str < end - subStringLength)
|
|
|
|
|
{
|
|
|
|
|
size_t i = 0;
|
|
|
|
|
for (; i < subStringLength; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (str[i] != subString[i])
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i == subStringLength)
|
|
|
|
|
return str;
|
|
|
|
|
|
|
|
|
|
++str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
bool Matches(const char* str1, const char* str2)
|
|
|
|
|
{
|
|
|
|
|
return detail::Matches(str1, str2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Matches(const wchar_t* str1, const wchar_t* str2)
|
|
|
|
|
{
|
|
|
|
|
return detail::Matches(str1, str2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Contains(const char* str, const char* subString)
|
|
|
|
|
{
|
|
|
|
|
return Find(str, subString) != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Contains(const wchar_t* str, const wchar_t* subString)
|
|
|
|
|
{
|
|
|
|
|
return Find(str, subString) != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool StartsWith(const char* str, const char* subString)
|
|
|
|
|
{
|
|
|
|
|
return detail::StartsWith(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool StartsWith(const wchar_t* str, const wchar_t* subString)
|
|
|
|
|
{
|
|
|
|
|
return detail::StartsWith(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-03-18 08:13:59 -04:00
|
|
|
// BEGIN EPIC MOD
|
|
|
|
|
const char* StartsWithEx(const char* str, const char* subString)
|
|
|
|
|
{
|
|
|
|
|
return detail::StartsWithEx(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const wchar_t* StartsWithEx(const wchar_t* str, const wchar_t* subString)
|
|
|
|
|
{
|
|
|
|
|
return detail::StartsWithEx(str, subString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MatchWildcard(const char* target, const char* wildcard)
|
|
|
|
|
{
|
|
|
|
|
return detail::MatchesWildcardRecursive(target, wildcard);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MatchWildcard(const wchar_t* target, const wchar_t* wildcard)
|
|
|
|
|
{
|
|
|
|
|
return detail::MatchesWildcardRecursive(target, wildcard);
|
|
|
|
|
}
|
|
|
|
|
// END EPIC MOD
|
|
|
|
|
|
|
|
|
|
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
std::string ToUpper(const char* str)
|
|
|
|
|
{
|
|
|
|
|
std::string upperStr(str);
|
|
|
|
|
|
|
|
|
|
char* dest = &upperStr[0];
|
|
|
|
|
for (size_t i = 0u; i < upperStr.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
dest[i] = static_cast<char>(::toupper(dest[i]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return upperStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string ToUpper(const std::string& str)
|
|
|
|
|
{
|
|
|
|
|
return ToUpper(str.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring ToUpper(const wchar_t* str)
|
|
|
|
|
{
|
|
|
|
|
std::wstring upperStr(str);
|
|
|
|
|
|
|
|
|
|
wchar_t* dest = &upperStr[0];
|
|
|
|
|
for (size_t i = 0u; i < upperStr.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
dest[i] = static_cast<wchar_t>(::towupper(dest[i]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return upperStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring ToUpper(const std::wstring& str)
|
|
|
|
|
{
|
|
|
|
|
return ToUpper(str.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring ToLower(const wchar_t* str)
|
|
|
|
|
{
|
|
|
|
|
std::wstring lowerStr(str);
|
|
|
|
|
|
|
|
|
|
wchar_t* dest = &lowerStr[0];
|
|
|
|
|
for (size_t i = 0u; i < lowerStr.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
dest[i] = static_cast<wchar_t>(::towlower(dest[i]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return lowerStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring ToLower(const std::wstring& str)
|
|
|
|
|
{
|
|
|
|
|
return ToLower(str.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring MakeSafeName(const std::wstring& name)
|
|
|
|
|
{
|
|
|
|
|
std::wstring safeName(name);
|
|
|
|
|
|
|
|
|
|
const size_t length = name.length();
|
|
|
|
|
for (size_t i = 0u; i < length; ++i)
|
|
|
|
|
{
|
|
|
|
|
if ((name[i] == '\\') ||
|
|
|
|
|
(name[i] == '/') ||
|
|
|
|
|
(name[i] == '*') ||
|
|
|
|
|
(name[i] == '?') ||
|
|
|
|
|
(name[i] == '"') ||
|
|
|
|
|
(name[i] == '<') ||
|
|
|
|
|
(name[i] == '>') ||
|
|
|
|
|
(name[i] == '|') ||
|
|
|
|
|
(name[i] == ':') ||
|
|
|
|
|
(name[i] == ';') ||
|
|
|
|
|
(name[i] == ',') ||
|
|
|
|
|
(name[i] == '.'))
|
|
|
|
|
{
|
|
|
|
|
safeName[i] = '_';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return safeName;
|
|
|
|
|
}
|
|
|
|
|
}
|