diff --git a/SHADE_Engine/src/Common/SHAllComponents.h b/SHADE_Engine/src/Common/SHAllComponents.h new file mode 100644 index 00000000..594e0f69 --- /dev/null +++ b/SHADE_Engine/src/Common/SHAllComponents.h @@ -0,0 +1,13 @@ +#pragma once +#include "Camera/SHCameraComponent.h" +#include "Camera/SHCameraArmComponent.h" +#include "Math/Transform/SHTransformComponent.h" +#include "Graphics/MiddleEnd/Interface/SHRenderable.h" +#include "Physics/Interface/SHRigidBodyComponent.h" +#include "UI/SHCanvasComponent.h" +#include "UI/SHButtonComponent.h" +#include "UI/SHUIComponent.h" +#include "Graphics/MiddleEnd/Lights/SHLightComponent.h" +#include "Graphics/MiddleEnd/Interface/SHRenderable.h" +#include "Physics/Interface/SHColliderComponent.h" +#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h" \ No newline at end of file diff --git a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp index bd39b38e..6e982045 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp @@ -239,10 +239,7 @@ namespace SHADE case AssetType::TEXTURE: break; case AssetType::MESH: break; case AssetType::SCENE: - if(auto editor = SHSystemManager::GetSystem()) - { editor->LoadScene(asset->id); - } break; case AssetType::PREFAB: break; case AssetType::MATERIAL: diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp index 6ac5933c..ef4ad35e 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp @@ -3,6 +3,11 @@ //#==============================================================# #include "SHpch.h" +//#==============================================================# +//|| Library Includes || +//#==============================================================# +#include + //#==============================================================# //|| SHADE Includes || //#==============================================================# @@ -16,14 +21,11 @@ #include "Tools/SHException.h" #include "Editor/IconsMaterialDesign.h" #include "SHHierarchyPanelCommands.h" - -//#==============================================================# -//|| Library Includes || -//#==============================================================# -#include +#include "Common/SHAllComponents.h" #include "Serialization/SHSerialization.h" #include "Tools/Utilities/SHClipboardUtilities.h" +#include "Tools/Utilities/SHStringUtilities.h" namespace SHADE @@ -80,7 +82,6 @@ namespace SHADE if (ImGui::IsWindowHovered() && !SHDragDrop::hasDragDrop && !ImGui::IsAnyItemHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left)) { - if (auto editor = SHSystemManager::GetSystem()) editor->selectedEntities.clear(); } ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal); @@ -99,7 +100,6 @@ namespace SHADE } if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyDown(ImGuiKey_LeftShift) && ImGui::IsKeyReleased(ImGuiKey_V)) { - const auto editor = SHSystemManager::GetSystem(); if (editor->selectedEntities.size() == 1) { PasteEntities(editor->selectedEntities.back()); @@ -141,16 +141,18 @@ namespace SHADE //#==============================================================# //|| Private Member Functions || //#==============================================================# - void SHHierarchyPanel::DrawMenuBar() const noexcept + void SHHierarchyPanel::DrawMenuBar() noexcept { if (ImGui::BeginMenuBar()) { auto size = ImGui::GetWindowSize(); auto g = ImGui::GetCurrentContext(); + + DrawHierarchyPanelFilter(); + ImGui::SetCursorPosX(size.x - g->Style.FramePadding.x * 15.0f); if (ImGui::SmallButton(ICON_MD_CLEAR_ALL)) { - auto editor = SHSystemManager::GetSystem(); editor->selectedEntities.clear(); } if (ImGui::IsItemHovered()) @@ -173,6 +175,56 @@ namespace SHADE } } + void SHHierarchyPanel::DrawHierarchyPanelFilter() noexcept + { + if(ImGui::InputTextWithHint("##hierarchyPanelFilter", "Filter", &filter)) + { + + } + ImGui::SameLine(); + if(ImGui::Button("x")) + { + filter.clear(); + } + } + + bool SHHierarchyPanel::EntityFilterCheck(SHSceneNode* entityNode) noexcept + { + if(!entityNode || filter.empty()) + return false; + + EntityID const eid = entityNode->GetEntityID(); + SHEntity* entity = SHEntityManager::GetEntityByID(eid); + + bool result = false; + + result |= SHStringUtilities::StringFindInsensitive(entity->name, filter) != std::string::npos; + + if(SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos) + { + result |= SHComponentManager::HasComponent(eid); + } + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + //result |= SHStringUtilities::StringFindInsensitive(rttr::type::get().get_name().data(), filter) != std::string::npos; + + //std::vector const& children = entityNode->GetChildren(); + + //for (auto const& child : children) + //{ + // result |= EntityFilterCheck(child); + //} + + return result; + } + ImRect SHHierarchyPanel::RecursivelyDrawEntityNode(SHSceneNode* const currentNode) { if (currentNode == nullptr) @@ -189,21 +241,39 @@ namespace SHADE scrollTo = MAX_EID; } - auto editor = SHSystemManager::GetSystem(); + auto* entity = SHEntityManager::GetEntityByID(eid); const bool isSelected = (std::ranges::find(editor->selectedEntities, eid) != editor->selectedEntities.end()); - const ImGuiTreeNodeFlags nodeFlags = ((isSelected) ? ImGuiTreeNodeFlags_Selected : 0) | ((children.empty()) ? ImGuiTreeNodeFlags_Leaf : ImGuiTreeNodeFlags_OpenOnArrow); - - //bool highlighted = false; - //if(highlighted) + bool highlighted = false; + //if(!filter.empty()) //{ - // ImGui::PushStyleColor(ImGuiCol_Text, highlightedColor); + // highlighted = EntityFilterCheck(currentNode); + // if (highlighted) + // { + // ImGui::PushStyleColor(ImGuiCol_Text, highlightedColor); + // + // ImGui::SetNextItemOpen(true); + // + // + // } + // else + // { + // + // } //} - auto* entity = SHEntityManager::GetEntityByID(currentNode->GetEntityID()); + const ImGuiTreeNodeFlags nodeFlags = ((isSelected) ? ImGuiTreeNodeFlags_Selected : 0) | ((children.empty()) ? ImGuiTreeNodeFlags_Leaf : ImGuiTreeNodeFlags_OpenOnArrow); + + //Draw Node - bool isNodeOpen = ImGui::TreeNodeEx(reinterpret_cast(entity), nodeFlags, "%u: %s", SHEntityManager::GetEntityIndex(eid), entity->name.c_str()); + bool isNodeOpen = ImGui::TreeNodeEx(reinterpret_cast(eid), nodeFlags, "%u: %s", SHEntityManager::GetEntityIndex(eid), entity->name.c_str()); + + if (highlighted) + { + ImGui::PopStyleColor(); + } + const ImRect nodeRect = ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax()); //Check For Begin Drag @@ -336,6 +406,7 @@ namespace SHADE drawList->AddLine(vertLineStart, vertLineEnd, treeLineColor, 2); ImGui::TreePop(); } + return nodeRect; } @@ -350,7 +421,6 @@ namespace SHADE std::vector entitiesToParent = CleanUpEIDList(entities); - //auto const editor = SHSystemManager::GetSystem(); SHEntityParentCommand::EntityParentData entityParentData; std::vector parentedEIDS; for (auto const& eid : entitiesToParent) @@ -371,7 +441,7 @@ namespace SHADE void SHHierarchyPanel::SelectRangeOfEntities(EntityID beginEID, EntityID endEID) { bool startSelecting = false; bool endSelecting = false; - auto const editor = SHSystemManager::GetSystem(); + editor->selectedEntities.clear(); auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph(); sceneGraph.Traverse([&](SHSceneNode* nodePtr) @@ -403,7 +473,6 @@ namespace SHADE void SHHierarchyPanel::SelectAllEntities() { - const auto editor = SHSystemManager::GetSystem(); editor->selectedEntities.clear(); auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph(); sceneGraph.Traverse([&](SHSceneNode* nodePtr) @@ -415,7 +484,6 @@ namespace SHADE void SHHierarchyPanel::CopySelectedEntities() { - const auto editor = SHSystemManager::GetSystem(); std::vector entitiesToCopy = CleanUpEIDList(editor->selectedEntities); SHClipboardUtilities::WriteToClipboard(SHSerialization::SerializeEntitiesToString(entitiesToCopy)); } @@ -428,7 +496,6 @@ namespace SHADE void SHHierarchyPanel::DeleteSelectedEntities() { - const auto editor = SHSystemManager::GetSystem(); std::vector entitiesToDelete = CleanUpEIDList(editor->selectedEntities); SHCommandManager::PerformCommand(std::make_shared(entitiesToDelete)); } diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.h b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.h index 9278a0a3..c6670948 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.h +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.h @@ -10,6 +10,8 @@ #include "imgui_internal.h" #include "ECS_Base/SHECSMacros.h" #include "Editor/EditorWindow/SHEditorWindow.h" +#include "ECS_Base/Entity/SHEntity.h" + namespace SHADE { class SHSceneNode; @@ -24,7 +26,11 @@ namespace SHADE void Exit() override; void SetScrollTo(EntityID eid); private: - void DrawMenuBar() const noexcept; + void DrawMenuBar() noexcept; + void DrawHierarchyPanelFilter() noexcept; + + bool EntityFilterCheck(SHSceneNode* entityNode) noexcept; + ImRect RecursivelyDrawEntityNode(SHSceneNode* const); void CreateChildEntity(EntityID parentEID) const noexcept; void ParentSelectedEntities(EntityID parentEID, std::vector const& entities) noexcept; diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp index 83647da7..64691cc5 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp @@ -93,7 +93,6 @@ namespace SHADE SHEditorWindow::Update(); if (Begin()) { - auto editor = SHSystemManager::GetSystem(); if (editor && !editor->selectedEntities.empty()) { EntityID const& eid = editor->selectedEntities[0]; diff --git a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp index 5014dbdd..3fe9ceb5 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp @@ -110,7 +110,7 @@ namespace SHADE { ImGui::BeginMenuBar(); ImGui::SetCursorPosX(ImGui::GetContentRegionAvail().x * 0.5f - 80.f); - const auto editor = SHSystemManager::GetSystem(); + ImGui::BeginDisabled(editor->editorState == SHEditor::State::PLAY); if(ImGui::SmallButton(ICON_MD_PLAY_ARROW)) { @@ -165,16 +165,18 @@ namespace SHADE { if (ImGui::Selectable("New Scene")) { - SHSystemManager::GetSystem()->NewScene(); + editor->NewScene(); } if (ImGui::Selectable("Save")) { - SHSystemManager::GetSystem()->SaveScene(); + editor->SaveScene(); } + ImGui::BeginDisabled(true); if (ImGui::Selectable("Load")) { //SHSystemManager::GetSystem()->LoadScene() } + ImGui::EndDisabled(); ImGui::EndMenu(); } } @@ -211,7 +213,7 @@ namespace SHADE auto* scriptEngine = static_cast(SHSystemManager::GetSystem()); scriptEngine->OpenSolution(); } - ImGui::BeginDisabled(SHSystemManager::GetSystem()->editorState != SHEditor::State::STOP); + ImGui::BeginDisabled(editor->editorState != SHEditor::State::STOP); if (ImGui::Selectable("Build Scripts - Debug")) { auto* scriptEngine = static_cast(SHSystemManager::GetSystem()); @@ -252,7 +254,6 @@ namespace SHADE { if (ImGui::Selectable(style.to_string().c_str())) { - if (auto editor = SHSystemManager::GetSystem()) editor->SetStyle(style.convert()); } } diff --git a/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.cpp b/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.cpp index 5f00cc37..05059336 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.cpp @@ -7,6 +7,8 @@ //|| SHADE Includes || //#==============================================================# #include "SHEditorWindow.h" +#include "ECS_Base/Managers/SHSystemManager.h" +#include "Editor/SHEditor.h" //#==============================================================# //|| Library Includes || @@ -21,6 +23,7 @@ namespace SHADE SHEditorWindow::SHEditorWindow(std::string_view const& name, ImGuiWindowFlags const& inFlags) :isOpen(true), isWindowHovered(false), windowName(name), windowFlags(inFlags), io(ImGui::GetIO()) { + editor = SHSystemManager::GetSystem(); } void SHEditorWindow::Init() diff --git a/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.h b/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.h index faacd8f2..9b932827 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.h +++ b/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindow.h @@ -12,9 +12,9 @@ //#==============================================================# struct ImGuiIO; typedef int ImGuiWindowFlags; - namespace SHADE { + class SHEditor; class SHEditorWindow { public: @@ -38,6 +38,6 @@ namespace SHADE ImGuiWindowFlags windowFlags = 0; ImGuiIO& io; - + SHEditor* editor; };//class SHEditorWindow }//namespace SHADE diff --git a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp index 93f4a615..8c32b1c5 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp @@ -35,7 +35,6 @@ namespace SHADE { SHEditorWindow::Update(); auto camSystem = SHSystemManager::GetSystem(); - SHEditor* editor = SHSystemManager::GetSystem(); if (!editor->selectedEntities.empty()) { diff --git a/SHADE_Engine/src/Serialization/SHSerialization.cpp b/SHADE_Engine/src/Serialization/SHSerialization.cpp index a0b961a3..6cb03195 100644 --- a/SHADE_Engine/src/Serialization/SHSerialization.cpp +++ b/SHADE_Engine/src/Serialization/SHSerialization.cpp @@ -11,15 +11,8 @@ #include #include "Assets/Asset Types/SHSceneAsset.h" -#include "Camera/SHCameraComponent.h" -#include "Camera/SHCameraArmComponent.h" -#include "Math/Transform/SHTransformComponent.h" -#include "Graphics/MiddleEnd/Interface/SHRenderable.h" -#include "Physics/Interface/SHRigidBodyComponent.h" -#include "UI/SHCanvasComponent.h" -#include "UI/SHButtonComponent.h" +#include "Common/SHAllComponents.h" #include "ECS_Base/Managers/SHSystemManager.h" -#include "Graphics/MiddleEnd/Lights/SHLightComponent.h" #include "Scripting/SHScriptEngine.h" #include "Tools/FileIO/SHFileIO.h" diff --git a/SHADE_Engine/src/Serialization/SHYAMLConverters.h b/SHADE_Engine/src/Serialization/SHYAMLConverters.h index 58268b57..2e2d45f4 100644 --- a/SHADE_Engine/src/Serialization/SHYAMLConverters.h +++ b/SHADE_Engine/src/Serialization/SHYAMLConverters.h @@ -1,5 +1,7 @@ #pragma once #include "Graphics/MiddleEnd/Interface/SHRenderable.h" +#include "Physics/Interface/SHColliderComponent.h" +#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h" #include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h" #include "Math/Geometry/SHBox.h" #include "Math/Geometry/SHSphere.h" @@ -11,8 +13,6 @@ #include "Graphics/MiddleEnd/Interface/SHMaterial.h" #include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h" #include "SHSerializationTools.h" -#include "Physics/Interface/SHColliderComponent.h" -#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h" #include "Graphics/MiddleEnd/TextRendering/SHFont.h" #include "Physics/Collision/SHCollisionTagMatrix.h" diff --git a/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp index b9698071..f547da6c 100644 --- a/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp +++ b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp @@ -13,6 +13,7 @@ of DigiPen Institute of Technology is prohibited. #include // Primary Header #include "SHStringUtilities.h" +#include namespace SHADE { @@ -50,5 +51,12 @@ namespace SHADE { return std::system_category().message(errorCode); } + + size_t SHStringUtilities::StringFindInsensitive(std::string str, std::string search, size_t pos) + { + std::transform(str.begin(), str.end(), str.begin(), [](char c) {return static_cast(std::tolower(c)); }); + std::transform(search.begin(), search.end(), search.begin(), [](char c) {return static_cast(std::tolower(c)); }); + return str.find(search, pos); + } } \ No newline at end of file diff --git a/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h index bac83b07..697e19f2 100644 --- a/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h +++ b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h @@ -4,9 +4,9 @@ \par email: kahwei.tng\@digipen.edu \date Nov 29, 2021 \brief Contains the declaration of functions for working with files and folders. - + Copyright (C) 2021 DigiPen Institute of Technology. -Reproduction or disclosure of this file or its contents without the prior written consent +Reproduction or disclosure of this file or its contents without the prior written consent of DigiPen Institute of Technology is prohibited. *//*************************************************************************************/ #pragma once @@ -16,66 +16,68 @@ of DigiPen Institute of Technology is prohibited. namespace SHADE { - /// - /// Contains useful functions for operating on strings. - /// - class SHStringUtilities - { - public: - /*-----------------------------------------------------------------------------*/ - /* Utility Functions */ - /*-----------------------------------------------------------------------------*/ - - /// - /// Splits a string separated by a specified delimiter into a vector of strings. - /// - /// Internal type of each element in the string. - /// Read only reference to the string to split. - /// Read only reference to the delimiter. - /// Vector of strings that have been split. - template - static std::vector> Split(const std::basic_string& str, const T& delim); - /// - /// Splits a string separated by a specified delimiter into a vector of strings. - /// Overload of Split() to allow for string literals to be accepted. - /// - /// Read only reference to the string to split. - /// Read only reference to the delimiter. - /// Vector of strings that have been split. - static std::vector Split(const std::string& str, const char& delim); - /// - /// Splits a string separated by a specified delimiter into a vector of strings. - /// Overload of Split() to allow for wide string literals to be accepted. - /// - /// Read only reference to the string to split. - /// Read only reference to the delimiter. - /// Vector of strings that have been split. - static std::vector Split(const std::wstring& str, const wchar_t& delim); - /// - /// Converts a wstring to a string. - /// - /// wstring to convert. - /// The converted wstring in string form. - static std::string WstrToStr(const std::wstring& wstr); - /// - /// Converts a string to a wstring. - /// - /// string to convert. - /// The converted string in wstring form. - static std::wstring StrToWstr(const std::string& str); - /// - /// Retrieves the error message associated with a Win32 error code. - /// - /// Win32 error code to decode. - /// String that represents the Win32 error. - static std::string GetWin32ErrorMessage(unsigned long errorCode); + /// + /// Contains useful functions for operating on strings. + /// + class SHStringUtilities + { + public: + /*-----------------------------------------------------------------------------*/ + /* Utility Functions */ + /*-----------------------------------------------------------------------------*/ - private: - /*-------------------------------------------------------------------------------*/ - /* Constructors/Destructors */ - /*-------------------------------------------------------------------------------*/ - SHStringUtilities() = delete; - }; + /// + /// Splits a string separated by a specified delimiter into a vector of strings. + /// + /// Internal type of each element in the string. + /// Read only reference to the string to split. + /// Read only reference to the delimiter. + /// Vector of strings that have been split. + template + static std::vector> Split(const std::basic_string& str, const T& delim); + /// + /// Splits a string separated by a specified delimiter into a vector of strings. + /// Overload of Split() to allow for string literals to be accepted. + /// + /// Read only reference to the string to split. + /// Read only reference to the delimiter. + /// Vector of strings that have been split. + static std::vector Split(const std::string& str, const char& delim); + /// + /// Splits a string separated by a specified delimiter into a vector of strings. + /// Overload of Split() to allow for wide string literals to be accepted. + /// + /// Read only reference to the string to split. + /// Read only reference to the delimiter. + /// Vector of strings that have been split. + static std::vector Split(const std::wstring& str, const wchar_t& delim); + /// + /// Converts a wstring to a string. + /// + /// wstring to convert. + /// The converted wstring in string form. + static std::string WstrToStr(const std::wstring& wstr); + /// + /// Converts a string to a wstring. + /// + /// string to convert. + /// The converted string in wstring form. + static std::wstring StrToWstr(const std::string& str); + /// + /// Retrieves the error message associated with a Win32 error code. + /// + /// Win32 error code to decode. + /// String that represents the Win32 error. + static std::string GetWin32ErrorMessage(unsigned long errorCode); + + static size_t StringFindInsensitive(std::string str, std::string search, size_t pos = 0); + + private: + /*-------------------------------------------------------------------------------*/ + /* Constructors/Destructors */ + /*-------------------------------------------------------------------------------*/ + SHStringUtilities() = delete; + }; } #include "SHStringUtilities.hpp"