From 99012725dcaed0400c00e5da3fb9d131083044c5 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 17 Jun 2021 14:15:19 +0200 Subject: [PATCH] Adjust includes --- Source/Editor/Scripting/ScriptsBuilder.cpp | 2 +- Source/Editor/Tools/Terrain/TerrainTools.cpp | 1 + Source/Engine/Audio/AudioSource.cpp | 1 + Source/Engine/Core/Types/String.h | 1 - Source/Engine/Core/Types/StringView.h | 63 ++++++++++++------- Source/Engine/Foliage/Foliage.cpp | 1 + .../Engine/Graphics/Textures/TextureBase.cpp | 3 +- Source/Engine/Level/Actors/SkyLight.cpp | 1 + Source/Engine/Level/Scene/SceneCSGData.cpp | 1 + Source/Engine/Navigation/NavMesh.cpp | 1 + .../Engine/Physics/Actors/WheeledVehicle.cpp | 1 + .../Scripting/ManagedCLR/MClass.Mono.cpp | 5 -- Source/Engine/Scripting/ManagedCLR/MClass.h | 6 -- Source/Engine/Scripting/Scripting.cpp | 12 ---- Source/Engine/Scripting/Scripting.h | 6 +- Source/Engine/Scripting/ScriptingObject.cpp | 2 +- .../Engine/ShadowsOfMordor/Builder.DoWork.cpp | 1 + .../ShadowsOfMordor/Builder.Entries.cpp | 1 + .../ShadowsOfMordor/Builder.Hemispheres.cpp | 1 + Source/Engine/ShadowsOfMordor/Builder.h | 1 + Source/Engine/Terrain/Terrain.cpp | 1 + 21 files changed, 57 insertions(+), 55 deletions(-) diff --git a/Source/Editor/Scripting/ScriptsBuilder.cpp b/Source/Editor/Scripting/ScriptsBuilder.cpp index 71323dc34..ed30922f7 100644 --- a/Source/Editor/Scripting/ScriptsBuilder.cpp +++ b/Source/Editor/Scripting/ScriptsBuilder.cpp @@ -304,7 +304,7 @@ MClass* ScriptsBuilder::FindScript(const StringView& scriptName) GetClassName(mclass->GetFullName(), mclassName); if (className == mclassName) { - LOG(Info, "Found {0} type for type {1} (assembly {2})", mclass->ToString(), String(scriptName.Get(), scriptName.Length()), assembly->ToString()); + LOG(Info, "Found {0} type for type {1} (assembly {2})", String(mclass->GetFullName()), String(scriptName.Get(), scriptName.Length()), assembly->ToString()); return mclass; } } diff --git a/Source/Editor/Tools/Terrain/TerrainTools.cpp b/Source/Editor/Tools/Terrain/TerrainTools.cpp index e89b5e3e9..fb90d786a 100644 --- a/Source/Editor/Tools/Terrain/TerrainTools.cpp +++ b/Source/Editor/Tools/Terrain/TerrainTools.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "TerrainTools.h" +#include "Engine/Core/Log.h" #include "Engine/Core/Cache.h" #include "Engine/Core/Math/Int2.h" #include "Engine/Core/Math/Color32.h" diff --git a/Source/Engine/Audio/AudioSource.cpp b/Source/Engine/Audio/AudioSource.cpp index 192fd845f..2b82ec6ea 100644 --- a/Source/Engine/Audio/AudioSource.cpp +++ b/Source/Engine/Audio/AudioSource.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "AudioSource.h" +#include "Engine/Core/Log.h" #include "Engine/Level/SceneObjectsFactory.h" #include "Engine/Serialization/Serialization.h" #include "Engine/Graphics/RenderTask.h" diff --git a/Source/Engine/Core/Types/String.h b/Source/Engine/Core/Types/String.h index d7d42f211..6871cb287 100644 --- a/Source/Engine/Core/Types/String.h +++ b/Source/Engine/Core/Types/String.h @@ -5,7 +5,6 @@ #include "Engine/Platform/Platform.h" #include "Engine/Platform/StringUtils.h" #include "Engine/Core/Formatting.h" -#include "Engine/Core/Templates.h" /// /// Represents text as a sequence of characters. Container uses a single dynamic memory allocation to store the characters data. Characters sequence is always null-terminated. diff --git a/Source/Engine/Core/Types/StringView.h b/Source/Engine/Core/Types/StringView.h index e267b760e..bb987b3b4 100644 --- a/Source/Engine/Core/Types/StringView.h +++ b/Source/Engine/Core/Types/StringView.h @@ -19,21 +19,6 @@ protected: public: - /// - /// Copies the data. - /// - /// The other object. - /// The reference to this object. - FORCE_INLINE StringViewBase& operator=(const StringViewBase& other) - { - if (this != &other) - { - _data = other._data; - _length = other._length; - } - return *this; - } - /// /// Gets the specific const character from this string. /// @@ -82,7 +67,7 @@ public: /// /// Gets the length of the string. /// - FORCE_INLINE int32 Length() const + FORCE_INLINE constexpr int32 Length() const { return _length; } @@ -90,7 +75,7 @@ public: /// /// Gets the pointer to the string. /// - FORCE_INLINE const T* operator*() const + FORCE_INLINE constexpr const T* operator*() const { return _data; } @@ -98,7 +83,7 @@ public: /// /// Gets the pointer to the string. /// - FORCE_INLINE const T* Get() const + FORCE_INLINE constexpr const T* Get() const { return _data; } @@ -202,7 +187,7 @@ public: /// /// Initializes a new instance of the class. /// - StringView() + constexpr StringView() { _data = nullptr; _length = 0; @@ -218,7 +203,7 @@ public: /// Initializes a new instance of the class. /// /// The reference to the static string. - StringView(const StringView& str) + constexpr StringView(const StringView& str) { _data = str._data; _length = str._length; @@ -239,7 +224,7 @@ public: /// /// The characters sequence. /// The characters sequence length (excluding null-terminator character). - StringView(const Char* str, int32 length) + constexpr StringView(const Char* str, int32 length) { _data = str; _length = length; @@ -259,6 +244,21 @@ public: return *this; } + /// + /// Assigns the static string. + /// + /// The other object. + /// The reference to this object. + FORCE_INLINE constexpr StringView& operator=(const StringView& other) + { + if (this != &other) + { + _data = other._data; + _length = other._length; + } + return *this; + } + /// /// Lexicographically test whether this string is equivalent to the other given string (case sensitive). /// @@ -394,7 +394,7 @@ public: /// /// Initializes a new instance of the class. /// - StringAnsiView() + constexpr StringAnsiView() { _data = nullptr; _length = 0; @@ -410,7 +410,7 @@ public: /// Initializes a new instance of the class. /// /// The reference to the static string. - StringAnsiView(const StringAnsiView& str) + constexpr StringAnsiView(const StringAnsiView& str) { _data = str._data; _length = str._length; @@ -431,7 +431,7 @@ public: /// /// The characters sequence. /// The characters sequence length (excluding null-terminator character). - StringAnsiView(const char* str, int32 length) + constexpr StringAnsiView(const char* str, int32 length) { _data = str; _length = length; @@ -451,6 +451,21 @@ public: return *this; } + /// + /// Assigns the static string. + /// + /// The other object. + /// The reference to this object. + FORCE_INLINE constexpr StringAnsiView& operator=(const StringAnsiView& other) + { + if (this != &other) + { + _data = other._data; + _length = other._length; + } + return *this; + } + /// /// Lexicographically test whether this string is equivalent to the other given string (case sensitive). /// diff --git a/Source/Engine/Foliage/Foliage.cpp b/Source/Engine/Foliage/Foliage.cpp index bb809d4e0..84b0573d8 100644 --- a/Source/Engine/Foliage/Foliage.cpp +++ b/Source/Engine/Foliage/Foliage.cpp @@ -3,6 +3,7 @@ #include "Foliage.h" #include "FoliageType.h" #include "FoliageCluster.h" +#include "Engine/Core/Log.h" #include "Engine/Core/Random.h" #include "Engine/Engine/Engine.h" #include "Engine/Graphics/RenderTask.h" diff --git a/Source/Engine/Graphics/Textures/TextureBase.cpp b/Source/Engine/Graphics/Textures/TextureBase.cpp index d21d61f2f..af5d96394 100644 --- a/Source/Engine/Graphics/Textures/TextureBase.cpp +++ b/Source/Engine/Graphics/Textures/TextureBase.cpp @@ -2,16 +2,15 @@ #include "TextureBase.h" #include "TextureData.h" +#include "Engine/Core/Math/Color32.h" #include "Engine/Graphics/GPUDevice.h" #include "Engine/Graphics/Textures/GPUTexture.h" #include "Engine/Graphics/RenderTools.h" #include "Engine/Graphics/PixelFormatExtensions.h" #include "Engine/Debug/Exceptions/ArgumentOutOfRangeException.h" #include "Engine/Debug/Exceptions/InvalidOperationException.h" -#include "Engine/Core/Math/Color32.h" #include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Content/Factories/BinaryAssetFactory.h" -#include REGISTER_BINARY_ASSET_ABSTRACT(TextureBase, "FlaxEngine.TextureBase"); diff --git a/Source/Engine/Level/Actors/SkyLight.cpp b/Source/Engine/Level/Actors/SkyLight.cpp index da7efbf31..94ccf6c29 100644 --- a/Source/Engine/Level/Actors/SkyLight.cpp +++ b/Source/Engine/Level/Actors/SkyLight.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "SkyLight.h" +#include "Engine/Core/Log.h" #include "Engine/Platform/FileSystem.h" #include "Engine/Graphics/RenderView.h" #include "Engine/Graphics/RenderTask.h" diff --git a/Source/Engine/Level/Scene/SceneCSGData.cpp b/Source/Engine/Level/Scene/SceneCSGData.cpp index 2ac5121b5..2e4ecc3b3 100644 --- a/Source/Engine/Level/Scene/SceneCSGData.cpp +++ b/Source/Engine/Level/Scene/SceneCSGData.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "SceneCSGData.h" +#include "Engine/Core/Log.h" #include "Engine/CSG/CSGBuilder.h" #include "Engine/Serialization/Serialization.h" #include "Engine/Level/Scene/Scene.h" diff --git a/Source/Engine/Navigation/NavMesh.cpp b/Source/Engine/Navigation/NavMesh.cpp index fe7756049..32ba8c61f 100644 --- a/Source/Engine/Navigation/NavMesh.cpp +++ b/Source/Engine/Navigation/NavMesh.cpp @@ -5,6 +5,7 @@ #include "Engine/Level/Scene/Scene.h" #include "Engine/Serialization/Serialization.h" #if COMPILE_WITH_ASSETS_IMPORTER +#include "Engine/Core/Log.h" #include "Engine/ContentImporters/AssetsImportingManager.h" #include "Engine/Serialization/MemoryWriteStream.h" #if USE_EDITOR diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.cpp b/Source/Engine/Physics/Actors/WheeledVehicle.cpp index 558e4f98c..0fe53f570 100644 --- a/Source/Engine/Physics/Actors/WheeledVehicle.cpp +++ b/Source/Engine/Physics/Actors/WheeledVehicle.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "WheeledVehicle.h" +#include "Engine/Core/Log.h" #include "Engine/Physics/Physics.h" #include "Engine/Physics/Utilities.h" #include "Engine/Level/Scene/Scene.h" diff --git a/Source/Engine/Scripting/ManagedCLR/MClass.Mono.cpp b/Source/Engine/Scripting/ManagedCLR/MClass.Mono.cpp index 21551afc0..b02580ab8 100644 --- a/Source/Engine/Scripting/ManagedCLR/MClass.Mono.cpp +++ b/Source/Engine/Scripting/ManagedCLR/MClass.Mono.cpp @@ -80,11 +80,6 @@ MClass::~MClass() _events.ClearDelete(); } -String MClass::ToString() const -{ - return String(_fullname); -} - MonoClass* MClass::GetNative() const { return _monoClass; diff --git a/Source/Engine/Scripting/ManagedCLR/MClass.h b/Source/Engine/Scripting/ManagedCLR/MClass.h index a8d083d7b..e4d0ba74c 100644 --- a/Source/Engine/Scripting/ManagedCLR/MClass.h +++ b/Source/Engine/Scripting/ManagedCLR/MClass.h @@ -73,12 +73,6 @@ public: return _fullname; } - /// - /// Gets the class full name as string. - /// - /// The class full name. - String ToString() const; - #if USE_MONO /// diff --git a/Source/Engine/Scripting/Scripting.cpp b/Source/Engine/Scripting/Scripting.cpp index 2888497c7..55a60f799 100644 --- a/Source/Engine/Scripting/Scripting.cpp +++ b/Source/Engine/Scripting/Scripting.cpp @@ -639,9 +639,7 @@ MClass* Scripting::FindClass(MonoClass* monoClass) { if (monoClass == nullptr) return nullptr; - PROFILE_CPU(); - auto& modules = BinaryModule::GetModules(); for (auto module : modules) { @@ -653,7 +651,6 @@ MClass* Scripting::FindClass(MonoClass* monoClass) return result; } } - return nullptr; } @@ -661,9 +658,7 @@ MClass* Scripting::FindClass(const StringAnsiView& fullname) { if (fullname.IsEmpty()) return nullptr; - PROFILE_CPU(); - auto& modules = BinaryModule::GetModules(); for (auto module : modules) { @@ -675,7 +670,6 @@ MClass* Scripting::FindClass(const StringAnsiView& fullname) return result; } } - return nullptr; } @@ -683,9 +677,7 @@ MonoClass* Scripting::FindClassNative(const StringAnsiView& fullname) { if (fullname.IsEmpty()) return nullptr; - PROFILE_CPU(); - auto& modules = BinaryModule::GetModules(); for (auto module : modules) { @@ -697,7 +689,6 @@ MonoClass* Scripting::FindClassNative(const StringAnsiView& fullname) return result->GetNative(); } } - return nullptr; } @@ -705,9 +696,7 @@ ScriptingTypeHandle Scripting::FindScriptingType(const StringAnsiView& fullname) { if (fullname.IsEmpty()) return ScriptingTypeHandle(); - PROFILE_CPU(); - auto& modules = BinaryModule::GetModules(); for (auto module : modules) { @@ -717,7 +706,6 @@ ScriptingTypeHandle Scripting::FindScriptingType(const StringAnsiView& fullname) return ScriptingTypeHandle(module, typeIndex); } } - return ScriptingTypeHandle(); } diff --git a/Source/Engine/Scripting/Scripting.h b/Source/Engine/Scripting/Scripting.h index 98fddfc7f..fcdd3746c 100644 --- a/Source/Engine/Scripting/Scripting.h +++ b/Source/Engine/Scripting/Scripting.h @@ -91,21 +91,21 @@ public: /// /// Finds the class with given fully qualified name within whole assembly. /// - /// The full name of the type eg: System.Int64.MaxInt. + /// The full name of the type eg: System.Int64. /// The MClass object or null if missing. static MClass* FindClass(const StringAnsiView& fullname); /// /// Finds the native class with given fully qualified name within whole assembly. /// - /// The full name of the type eg: System.Int64.MaxInt. + /// The full name of the type eg: System.Int64. /// The MClass object or null if missing. static MonoClass* FindClassNative(const StringAnsiView& fullname); /// /// Finds the scripting type of the given fullname by searching loaded scripting assemblies. /// - /// The full name of the type eg: System.Int64.MaxInt. + /// The full name of the type eg: System.Int64. /// The scripting type or invalid type if missing. static ScriptingTypeHandle FindScriptingType(const StringAnsiView& fullname); diff --git a/Source/Engine/Scripting/ScriptingObject.cpp b/Source/Engine/Scripting/ScriptingObject.cpp index 5208b1560..a66b8a103 100644 --- a/Source/Engine/Scripting/ScriptingObject.cpp +++ b/Source/Engine/Scripting/ScriptingObject.cpp @@ -259,7 +259,7 @@ void ScriptingObject::OnDeleteObject() String ScriptingObject::ToString() const { - return _type ? _type.GetType().ManagedClass->ToString() : String::Empty; + return _type ? String(_type.GetType().ManagedClass->GetFullName()) : String::Empty; } ManagedScriptingObject::ManagedScriptingObject(const SpawnParams& params) diff --git a/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp b/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp index fcacc9de8..74e46a03f 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "Builder.h" +#include "Engine/Core/Log.h" #include "Engine/Core/Types/TimeSpan.h" #include "Engine/Core/Math/Math.h" #include "Engine/Level/Actors/BoxBrush.h" diff --git a/Source/Engine/ShadowsOfMordor/Builder.Entries.cpp b/Source/Engine/ShadowsOfMordor/Builder.Entries.cpp index b14937338..445555b69 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.Entries.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.Entries.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "Builder.h" +#include "Engine/Core/Log.h" #include "Engine/Core/Math/Math.h" #include "Engine/Level/Actors/BoxBrush.h" #include "Engine/Level/Actors/StaticModel.h" diff --git a/Source/Engine/ShadowsOfMordor/Builder.Hemispheres.cpp b/Source/Engine/ShadowsOfMordor/Builder.Hemispheres.cpp index f04d790a8..edad95799 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.Hemispheres.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.Hemispheres.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #include "Builder.h" +#include "Engine/Core/Log.h" #include "Engine/Core/Math/Math.h" #include "Engine/Level/SceneQuery.h" #include "Engine/Level/Actors/BoxBrush.h" diff --git a/Source/Engine/ShadowsOfMordor/Builder.h b/Source/Engine/ShadowsOfMordor/Builder.h index c8c84f5bf..6d07a0587 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.h +++ b/Source/Engine/ShadowsOfMordor/Builder.h @@ -10,6 +10,7 @@ #if COMPILE_WITH_GI_BAKING #include "Engine/Graphics/RenderTask.h" +#include "Engine/Core/Singleton.h" // Forward declarations #if COMPILE_WITH_ASSETS_IMPORTER diff --git a/Source/Engine/Terrain/Terrain.cpp b/Source/Engine/Terrain/Terrain.cpp index 2ff053432..8aff910f3 100644 --- a/Source/Engine/Terrain/Terrain.cpp +++ b/Source/Engine/Terrain/Terrain.cpp @@ -2,6 +2,7 @@ #include "Terrain.h" #include "TerrainPatch.h" +#include "Engine/Core/Log.h" #include "Engine/Core/Math/Ray.h" #include "Engine/Level/Scene/SceneRendering.h" #include "Engine/Serialization/Serialization.h"