├── .github └── workflows │ ├── code_coverage.yml │ ├── deploy_release.yml │ ├── documentation.yml │ ├── tests_linux.yml │ ├── tests_macos.yml │ └── tests_windows.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── Docs ├── Doxyfile ├── rfk-compact-logo.svg └── rfk-logo.svg ├── LICENSE.md ├── README.md ├── Refureku ├── CMakeLists.txt ├── Generator │ ├── CMakeLists.txt │ ├── Include │ │ └── RefurekuGenerator │ │ │ ├── CodeGen │ │ │ ├── ReflectionCodeGenModule.h │ │ │ └── ReflectionCodeGenModule.inl │ │ │ ├── Misc │ │ │ ├── Helpers.h │ │ │ └── Helpers.inl │ │ │ ├── Parsing │ │ │ └── FileParser.h │ │ │ └── Properties │ │ │ ├── InstantiatorPropertyCodeGen.h │ │ │ └── PropertySettingsPropertyCodeGen.h │ ├── LibraryGenerator │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── RefurekuSettings.toml │ └── Source │ │ └── main.cpp └── Library │ ├── CMakeLists.txt │ ├── Include │ ├── Internal │ │ └── Refureku │ │ │ ├── Generated │ │ │ ├── EntityMacros.h │ │ │ ├── Instantiator.rfkh.h │ │ │ ├── Instantiator.rfks.h │ │ │ ├── ParseAllNested.rfkh.h │ │ │ ├── ParseAllNested.rfks.h │ │ │ ├── Property.rfkh.h │ │ │ ├── Property.rfks.h │ │ │ ├── PropertySettings.rfkh.h │ │ │ └── PropertySettings.rfks.h │ │ │ ├── Misc │ │ │ ├── Algorithm.h │ │ │ ├── Algorithm.inl │ │ │ ├── GetPimplMacroImpl.h │ │ │ ├── StringViewJoiner.h │ │ │ └── StringViewJoiner.inl │ │ │ └── TypeInfo │ │ │ ├── Archetypes │ │ │ ├── ArchetypeImpl.h │ │ │ ├── ArchetypeImpl.inl │ │ │ ├── ArchetypeRegistererImpl.h │ │ │ ├── ArchetypeRegistererImpl.inl │ │ │ ├── EnumImpl.h │ │ │ ├── EnumImpl.inl │ │ │ ├── EnumValueImpl.h │ │ │ ├── EnumValueImpl.inl │ │ │ ├── FundamentalArchetypeImpl.h │ │ │ ├── FundamentalArchetypeImpl.inl │ │ │ ├── StructImpl.h │ │ │ ├── StructImpl.inl │ │ │ ├── SubclassData.h │ │ │ └── Template │ │ │ │ ├── ClassTemplateImpl.h │ │ │ │ ├── ClassTemplateImpl.inl │ │ │ │ ├── ClassTemplateInstantiationImpl.h │ │ │ │ ├── ClassTemplateInstantiationImpl.inl │ │ │ │ ├── ClassTemplateInstantiationRegistererImpl.h │ │ │ │ ├── ClassTemplateInstantiationRegistererImpl.inl │ │ │ │ ├── NonTypeTemplateArgumentImpl.h │ │ │ │ ├── NonTypeTemplateArgumentImpl.inl │ │ │ │ ├── NonTypeTemplateParameterImpl.h │ │ │ │ ├── NonTypeTemplateParameterImpl.inl │ │ │ │ ├── TemplateArgumentImpl.h │ │ │ │ ├── TemplateArgumentImpl.inl │ │ │ │ ├── TemplateParameterImpl.h │ │ │ │ ├── TemplateParameterImpl.inl │ │ │ │ ├── TemplateTemplateArgumentImpl.h │ │ │ │ ├── TemplateTemplateArgumentImpl.inl │ │ │ │ ├── TemplateTemplateParameterImpl.h │ │ │ │ ├── TemplateTemplateParameterImpl.inl │ │ │ │ ├── TypeTemplateArgumentImpl.h │ │ │ │ ├── TypeTemplateArgumentImpl.inl │ │ │ │ ├── TypeTemplateParameterImpl.h │ │ │ │ └── TypeTemplateParameterImpl.inl │ │ │ ├── DatabaseImpl.h │ │ │ ├── DatabaseImpl.inl │ │ │ ├── Entity │ │ │ ├── DefaultEntityRegistererImpl.h │ │ │ ├── DefaultEntityRegistererImpl.inl │ │ │ ├── EntityCastInternal.h │ │ │ ├── EntityCastInternal.inl │ │ │ ├── EntityHash.h │ │ │ ├── EntityImpl.h │ │ │ └── EntityImpl.inl │ │ │ ├── Functions │ │ │ ├── FunctionBaseImpl.h │ │ │ ├── FunctionBaseImpl.inl │ │ │ ├── FunctionImpl.h │ │ │ ├── FunctionImpl.inl │ │ │ ├── FunctionParameterImpl.h │ │ │ ├── FunctionParameterImpl.inl │ │ │ ├── MethodBaseImpl.h │ │ │ ├── MethodBaseImpl.inl │ │ │ ├── MethodImpl.h │ │ │ ├── MethodImpl.inl │ │ │ ├── StaticMethodImpl.h │ │ │ └── StaticMethodImpl.inl │ │ │ ├── Namespace │ │ │ ├── NamespaceFragmentImpl.h │ │ │ ├── NamespaceFragmentImpl.inl │ │ │ ├── NamespaceFragmentRegistererImpl.h │ │ │ ├── NamespaceFragmentRegistererImpl.inl │ │ │ ├── NamespaceImpl.h │ │ │ └── NamespaceImpl.inl │ │ │ ├── TypeImpl.h │ │ │ ├── TypeImpl.inl │ │ │ └── Variables │ │ │ ├── FieldBaseImpl.h │ │ │ ├── FieldBaseImpl.inl │ │ │ ├── FieldImpl.h │ │ │ ├── FieldImpl.inl │ │ │ ├── StaticFieldImpl.h │ │ │ ├── StaticFieldImpl.inl │ │ │ ├── VariableBaseImpl.h │ │ │ ├── VariableBaseImpl.inl │ │ │ ├── VariableImpl.h │ │ │ └── VariableImpl.inl │ └── Public │ │ └── Refureku │ │ ├── Config.h │ │ ├── Containers │ │ ├── Allocator.h │ │ ├── Allocator.inl │ │ ├── Vector.h │ │ └── Vector.inl │ │ ├── Exceptions │ │ ├── ArgCountMismatch.h │ │ ├── ArgTypeMismatch.h │ │ ├── BadNamespaceFormat.h │ │ ├── ConstViolation.h │ │ ├── InvalidArchetype.h │ │ ├── ReturnTypeMismatch.h │ │ └── TypeMismatch.h │ │ ├── Generated │ │ ├── EntityMacros.h │ │ ├── Instantiator.rfkh.h │ │ ├── ParseAllNested.rfkh.h │ │ ├── Property.rfkh.h │ │ └── PropertySettings.rfkh.h │ │ ├── Misc │ │ ├── CodeGenerationHelpers.h │ │ ├── CodeGenerationHelpers.inl │ │ ├── CopyConstness.h │ │ ├── DisableWarningMacros.h │ │ ├── EnumMacros.h │ │ ├── FundamentalTypes.h │ │ ├── GetPimplMacro.h │ │ ├── Pimpl.h │ │ ├── Pimpl.inl │ │ ├── Predicate.h │ │ ├── SharedPtr.h │ │ ├── SharedPtr.inl │ │ ├── TypeTraits.h │ │ ├── TypeTraitsMacros.h │ │ ├── UniquePtr.h │ │ ├── UniquePtr.inl │ │ └── Visitor.h │ │ ├── NativeProperties.h │ │ ├── Object.h │ │ ├── Properties │ │ ├── Instantiator.h │ │ ├── ParseAllNested.h │ │ ├── Property.h │ │ └── PropertySettings.h │ │ ├── Refureku.h │ │ └── TypeInfo │ │ ├── Archetypes │ │ ├── Archetype.h │ │ ├── ArchetypeRegisterer.h │ │ ├── EClassKind.h │ │ ├── Enum.h │ │ ├── Enum.inl │ │ ├── EnumValue.h │ │ ├── EnumValue.inl │ │ ├── FundamentalArchetype.h │ │ ├── GetArchetype.h │ │ ├── GetArchetype.inl │ │ ├── ParentStruct.h │ │ ├── Struct.h │ │ ├── Struct.inl │ │ └── Template │ │ │ ├── ClassTemplate.h │ │ │ ├── ClassTemplate.inl │ │ │ ├── ClassTemplateInstantiation.h │ │ │ ├── ClassTemplateInstantiationRegisterer.h │ │ │ ├── ETemplateParameterKind.h │ │ │ ├── NonTypeTemplateArgument.h │ │ │ ├── NonTypeTemplateArgument.inl │ │ │ ├── NonTypeTemplateParameter.h │ │ │ ├── TemplateArgument.h │ │ │ ├── TemplateParameter.h │ │ │ ├── TemplateTemplateArgument.h │ │ │ ├── TemplateTemplateParameter.h │ │ │ ├── TypeTemplateArgument.h │ │ │ └── TypeTemplateParameter.h │ │ ├── Cast.h │ │ ├── Cast.inl │ │ ├── Database.h │ │ ├── Database.inl │ │ ├── EAccessSpecifier.h │ │ ├── ETypePartDescriptor.h │ │ ├── Entity │ │ ├── DefaultEntityRegisterer.h │ │ ├── EEntityKind.h │ │ ├── Entity.h │ │ ├── Entity.inl │ │ └── EntityCast.h │ │ ├── Functions │ │ ├── EFunctionFlags.h │ │ ├── EMethodFlags.h │ │ ├── Function.h │ │ ├── Function.inl │ │ ├── FunctionBase.h │ │ ├── FunctionBase.inl │ │ ├── FunctionHelper.h │ │ ├── FunctionHelper.inl │ │ ├── FunctionParameter.h │ │ ├── ICallable.h │ │ ├── MemberFunction.h │ │ ├── MemberFunction.inl │ │ ├── Method.h │ │ ├── Method.inl │ │ ├── MethodBase.h │ │ ├── MethodHelper.h │ │ ├── MethodHelper.inl │ │ ├── NonMemberFunction.h │ │ ├── NonMemberFunction.inl │ │ ├── StaticMethod.h │ │ └── StaticMethod.inl │ │ ├── MethodFieldHelpers.h │ │ ├── Namespace │ │ ├── Namespace.h │ │ ├── Namespace.inl │ │ ├── NamespaceFragment.h │ │ └── NamespaceFragmentRegisterer.h │ │ ├── Type.h │ │ ├── Type.inl │ │ ├── TypePart.h │ │ └── Variables │ │ ├── EFieldFlags.h │ │ ├── EVarFlags.h │ │ ├── Field.h │ │ ├── Field.inl │ │ ├── FieldBase.h │ │ ├── StaticField.h │ │ ├── StaticField.inl │ │ ├── Variable.h │ │ ├── Variable.inl │ │ ├── VariableBase.h │ │ └── VariableBase.inl │ ├── Source │ ├── Object.cpp │ ├── Properties │ │ ├── Instantiator.cpp │ │ ├── ParseAllNested.cpp │ │ ├── Property.cpp │ │ └── PropertySettings.cpp │ └── TypeInfo │ │ ├── Archetypes │ │ ├── Archetype.cpp │ │ ├── ArchetypeRegisterer.cpp │ │ ├── Enum.cpp │ │ ├── EnumValue.cpp │ │ ├── FundamentalArchetype.cpp │ │ ├── GetArchetype.cpp │ │ ├── ParentStruct.cpp │ │ ├── Struct.cpp │ │ └── Template │ │ │ ├── ClassTemplate.cpp │ │ │ ├── ClassTemplateInstantiation.cpp │ │ │ ├── ClassTemplateInstantiationRegisterer.cpp │ │ │ ├── NonTypeTemplateArgument.cpp │ │ │ ├── NonTypeTemplateParameter.cpp │ │ │ ├── TemplateArgument.cpp │ │ │ ├── TemplateParameter.cpp │ │ │ ├── TemplateTemplateArgument.cpp │ │ │ ├── TemplateTemplateParameter.cpp │ │ │ ├── TypeTemplateArgument.cpp │ │ │ └── TypeTemplateParameter.cpp │ │ ├── Cast.cpp │ │ ├── Database.cpp │ │ ├── Entity │ │ ├── DefaultEntityRegisterer.cpp │ │ ├── Entity.cpp │ │ ├── EntityCast.cpp │ │ └── EntityHash.cpp │ │ ├── EnumValue.cpp │ │ ├── Functions │ │ ├── Function.cpp │ │ ├── FunctionBase.cpp │ │ ├── FunctionParameter.cpp │ │ ├── Method.cpp │ │ ├── MethodBase.cpp │ │ └── StaticMethod.cpp │ │ ├── Namespace │ │ ├── Namespace.cpp │ │ ├── NamespaceFragment.cpp │ │ └── NamespaceFragmentRegisterer.cpp │ │ ├── Type.cpp │ │ ├── TypePart.cpp │ │ └── Variables │ │ ├── Field.cpp │ │ ├── FieldBase.cpp │ │ ├── StaticField.cpp │ │ ├── Variable.cpp │ │ └── VariableBase.cpp │ └── Tests │ ├── ArchetypeTests.cpp │ ├── CMakeLists.txt │ ├── CastTests.cpp │ ├── ClassTemplateTests.cpp │ ├── DatabaseTests.cpp │ ├── EntityCastTests.cpp │ ├── EntityTests.cpp │ ├── EnumTests.cpp │ ├── EnumValueTests.cpp │ ├── FieldBaseTests.cpp │ ├── FieldTests.cpp │ ├── FunctionBaseTests.cpp │ ├── FunctionTests.cpp │ ├── Include │ ├── 1weird file-name.test.h │ ├── BaseObject.h │ ├── ConstructionTrackedClass.h │ ├── ForwardDeclaredClass.h │ ├── ManualClassReflection.h │ ├── ManualClassTemplateReflection.h │ ├── ManualEnumReflection.h │ ├── ManualFunctionReflection.h │ ├── ManualNamespaceReflection.h │ ├── ManualVariableReflection.h │ ├── MixedClassTemplate.h │ ├── NonReflectedClass.h │ ├── NonTypeTemplateClassTemplate.h │ ├── PropertyInheritance.h │ ├── TemplateTemplateClassTemplate.h │ ├── TestCast.h │ ├── TestClass.h │ ├── TestClass2.h │ ├── TestDatabase.h │ ├── TestEnum.h │ ├── TestFieldBase.h │ ├── TestFields.h │ ├── TestFunctions.h │ ├── TestInstantiator.h │ ├── TestMethodBase.h │ ├── TestMethods.h │ ├── TestNamespace.h │ ├── TestNestedClassTemplates.h │ ├── TestNestedClasses.h │ ├── TestNestedEnums.h │ ├── TestProperties.h │ ├── TestStaticFields.h │ ├── TestStaticMethods.h │ ├── TestStruct.h │ ├── TestUniquePtr.h │ ├── TestVariables.h │ └── TypeTemplateClassTemplate.h │ ├── InstantiatorTests.cpp │ ├── ManualReflectionTests.cpp │ ├── MethodBaseTests.cpp │ ├── MethodTests.cpp │ ├── NamespaceTests.cpp │ ├── NestedClassTests.cpp │ ├── NestedEnumTests.cpp │ ├── PropertyInheritanceTests.cpp │ ├── RefurekuTestsSettings.toml │ ├── Src │ ├── 1weird file-name.test.cpp │ ├── BaseObject.cpp │ ├── ConstructionTrackedClass.cpp │ ├── ForwardDeclaredClass.cpp │ ├── ManualClassReflection.cpp │ ├── ManualClassTemplateReflection.cpp │ ├── ManualEnumReflection.cpp │ ├── ManualFunctionReflection.cpp │ ├── ManualNamespaceReflection.cpp │ ├── ManualVariableReflection.cpp │ ├── MixedClassTemplate.cpp │ ├── NonTypeTemplateClassTemplate.cpp │ ├── PropertyInheritance.cpp │ ├── TemplateTemplateClassTemplate.cpp │ ├── TestCast.cpp │ ├── TestClass.cpp │ ├── TestClass2.cpp │ ├── TestDatabase.cpp │ ├── TestEnum.cpp │ ├── TestFieldBase.cpp │ ├── TestFields.cpp │ ├── TestFunctions.cpp │ ├── TestInstantiator.cpp │ ├── TestMethodBase.cpp │ ├── TestMethods.cpp │ ├── TestNamespace.cpp │ ├── TestNestedClassTemplates.cpp │ ├── TestNestedClasses.cpp │ ├── TestNestedEnums.cpp │ ├── TestProperties.cpp │ ├── TestStaticFields.cpp │ ├── TestStaticMethods.cpp │ ├── TestStruct.cpp │ ├── TestVariables.cpp │ └── TypeTemplateClassTemplate.cpp │ ├── StaticFieldTests.cpp │ ├── StaticMethodTests.cpp │ ├── StructTests.cpp │ ├── TypeTests.cpp │ ├── VariableTests.cpp │ ├── VectorTests.cpp │ └── main.cpp └── codecov.yml /.github/workflows/documentation.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*.*.*' 7 | workflow_dispatch: 8 | 9 | jobs: 10 | docs-gen: 11 | name: Doxygen 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout repository 16 | uses: actions/checkout@v2 17 | 18 | - name: Clone Doxygen Awesome CSS 19 | uses: actions/checkout@v2 20 | with: 21 | repository: jothepro/doxygen-awesome-css 22 | ref: v1.6.0 23 | path: "doxygen-awesome-css" 24 | 25 | - name: Compute version 26 | id: version 27 | run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} 28 | 29 | - name: Update Refureku Version in Doxyfile 30 | if: startsWith(github.event.ref, 'refs/tags/v') 31 | uses: jacobtomlinson/gha-find-replace@v2 32 | with: 33 | find: "PROJECT_NUMBER += v[0-9]+.[0-9]+.[0-9]+.?" 34 | replace: "PROJECT_NUMBER = ${{ steps.version.outputs.VERSION }}" 35 | include: "Docs/Doxyfile" 36 | regex: true 37 | 38 | - name: Run Doxygen 39 | uses: mattnotmitt/doxygen-action@v1.1.0 40 | with: 41 | doxyfile-path: "./Docs/Doxyfile" 42 | 43 | - name: Deploy Documentation 44 | uses: peaceiris/actions-gh-pages@v3 45 | with: 46 | github_token: ${{ secrets.GITHUB_TOKEN }} 47 | publish_dir: ./html 48 | allow_empty_commit: true 49 | full_commit_message: "Deploy ${{ steps.version.outputs.VERSION }} Documentation" -------------------------------------------------------------------------------- /.github/workflows/tests_macos.yml: -------------------------------------------------------------------------------- 1 | name: MacOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - dev 8 | workflow_dispatch: 9 | 10 | jobs: 11 | macos_clang: 12 | name: MacOS | Clang 13 | runs-on: macos-latest 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | build_config: [Release, Debug] 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v2 23 | with: 24 | submodules: 'recursive' 25 | 26 | - name: Install ninja 27 | uses: seanmiddleditch/gha-setup-ninja@master 28 | 29 | - name: Install CMake 30 | uses: jwlawson/actions-setup-cmake@v1.8 31 | with: 32 | cmake-version: '3.15.0' 33 | 34 | - name: Generate Project 35 | run: cmake -B Build/${{ matrix.build_config }} -DCMAKE_BUILD_TYPE=${{ matrix.build_config }} -DRFK_DEV=1 -G "Ninja" 36 | 37 | - name: Build Refureku 38 | run: cmake --build Build/${{ matrix.build_config }} --config ${{ matrix.build_config }} --verbose 39 | 40 | - name: Run Tests 41 | run: cd Build/${{ matrix.build_config }} && ctest -C ${{ matrix.build_config }} -V -------------------------------------------------------------------------------- /.github/workflows/tests_windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - dev 8 | workflow_dispatch: 9 | 10 | jobs: 11 | windows_msvc: 12 | name: Windows | MSVC 13 | runs-on: windows-2019 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | build_config: [Release, Debug] 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v2 23 | with: 24 | submodules: 'recursive' 25 | 26 | - name: Generate Project 27 | run: cmake -B Build/${{ matrix.build_config }} -DCMAKE_BUILD_TYPE=${{ matrix.build_config }} -DRFK_DEV=1 -G "Visual Studio 16 2019" -A x64 28 | 29 | - name: Build Refureku 30 | run: cmake --build Build/${{ matrix.build_config }} --config ${{ matrix.build_config }} --verbose 31 | 32 | - name: Run Tests 33 | run: cd Build/${{ matrix.build_config }} && ctest -C ${{ matrix.build_config }} -V -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Folders 2 | Build/ 3 | Bin/ 4 | Binaries/ 5 | Lib/ 6 | Logs/ 7 | Generated/ 8 | enc_temp_folder/ 9 | out/ 10 | 11 | #Exception for the library generated folder 12 | !Refureku/Library/Include/Internal/Refureku/Generated 13 | !Refureku/Library/Include/Public/Refureku/Generated 14 | 15 | #Settings 16 | *.json 17 | 18 | #logs 19 | *.bsc 20 | *.htm 21 | 22 | # Binaries 23 | *.exe 24 | *.iobj 25 | *.ipdb 26 | *.pdb 27 | *.ilk 28 | *.dmp 29 | 30 | # Visual Studio Files 31 | *.suo 32 | *.csproj.user 33 | *.vbproj.user 34 | *.user 35 | *.vcxproj.filters 36 | *.vcxproj.user 37 | ipch 38 | *sdf 39 | \.vs/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | 2 | [submodule "Kodgen"] 3 | path = Refureku/Generator/ThirdParty/Kodgen 4 | url = https://github.com/jsoysouvanh/Kodgen 5 | branch = master -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.0) 2 | 3 | project(Refureku) 4 | 5 | # Information messages about cmake version and compiler 6 | message("Cmake: ${CMAKE_VERSION}") 7 | message("Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") 8 | 9 | # Enable tests 10 | include(CTest) 11 | 12 | add_subdirectory(Refureku) -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2021 Julien SOYSOUVANH - All Rights Reserved 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Refureku/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13.5) 2 | 3 | # Setup output directory 4 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Lib) # .lib / .a 5 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Bin) # .dll / .so / .dylib 6 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Bin) # .exe 7 | 8 | add_subdirectory(Generator) 9 | add_subdirectory(Library) -------------------------------------------------------------------------------- /Refureku/Generator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.0) 2 | 3 | project(RefurekuGenerator) 4 | 5 | # Build dependencies 6 | add_subdirectory(ThirdParty/Kodgen) 7 | 8 | set(RefurekuGeneratorExeTarget RefurekuGenerator) 9 | add_executable(${RefurekuGeneratorExeTarget} Source/main.cpp) 10 | 11 | target_include_directories(${RefurekuGeneratorExeTarget} PRIVATE Include) 12 | 13 | target_link_libraries(${RefurekuGeneratorExeTarget} PRIVATE Kodgen) 14 | 15 | if (RFK_DEV) 16 | 17 | # Setup compilation definitions 18 | target_compile_definitions(${RefurekuGeneratorExeTarget} PUBLIC RFK_DEV=1) 19 | 20 | if (NOT MSVC) # Clang or GCC 21 | target_compile_options(${RefurekuGeneratorExeTarget} PUBLIC -fsanitize=address -fno-omit-frame-pointer) 22 | target_link_options(${RefurekuGeneratorExeTarget} PUBLIC -fsanitize=address -fno-omit-frame-pointer) 23 | endif() 24 | 25 | endif() 26 | 27 | if (MSVC) 28 | 29 | # Setup warning level 30 | string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Remove the default flag /W3 31 | target_compile_options(${RefurekuGeneratorExeTarget} PRIVATE /W4 /MP) 32 | 33 | else () # Clang or GCC 34 | 35 | target_compile_options(${RefurekuGeneratorExeTarget} PRIVATE -Wall -Wextra -Wpedantic) 36 | 37 | endif() 38 | 39 | 40 | # Copy the RefurekuSettings template file next to the generated binary 41 | add_custom_command( TARGET ${RefurekuGeneratorExeTarget} PRE_BUILD 42 | COMMAND ${CMAKE_COMMAND} -E copy 43 | ${PROJECT_SOURCE_DIR}/RefurekuSettings.toml 44 | $,${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/RefurekuSettings.toml,${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/RefurekuSettings.toml>) 45 | 46 | add_subdirectory(LibraryGenerator) -------------------------------------------------------------------------------- /Refureku/Generator/Include/RefurekuGenerator/Misc/Helpers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | namespace rfk 16 | { 17 | class Helpers 18 | { 19 | public: 20 | Helpers() = delete; 21 | Helpers(Helpers const&) = delete; 22 | Helpers(Helpers&&) = delete; 23 | ~Helpers() = delete; 24 | 25 | /** 26 | * @brief Convert a kodgen::EEntityType to the corresponding integer value in rfk::Entity::EKind 27 | * 28 | * @param entityType The enum value to convert. 29 | * 30 | * @return The converted value. 31 | */ 32 | constexpr static kodgen::uint16 convertToEntityKind(kodgen::EEntityType entityType) noexcept; 33 | }; 34 | 35 | #include "RefurekuGenerator/Misc/Helpers.inl" 36 | } -------------------------------------------------------------------------------- /Refureku/Generator/Include/RefurekuGenerator/Misc/Helpers.inl: -------------------------------------------------------------------------------- 1 | 2 | constexpr kodgen::uint16 Helpers::convertToEntityKind(kodgen::EEntityType entityType) noexcept 3 | { 4 | switch (entityType) 5 | { 6 | case kodgen::EEntityType::Namespace: 7 | return 1 << 0; 8 | 9 | case kodgen::EEntityType::Class: 10 | return 1 << 1; 11 | 12 | case kodgen::EEntityType::Struct: 13 | return 1 << 2; 14 | 15 | case kodgen::EEntityType::Enum: 16 | return 1 << 3; 17 | 18 | case kodgen::EEntityType::Variable: 19 | return 1 << 5; 20 | 21 | case kodgen::EEntityType::Field: 22 | return 1 << 6; 23 | 24 | case kodgen::EEntityType::Function: 25 | return 1 << 7; 26 | 27 | case kodgen::EEntityType::Method: 28 | return 1 << 8; 29 | 30 | case kodgen::EEntityType::EnumValue: 31 | return 1 << 9; 32 | 33 | case kodgen::EEntityType::Undefined: 34 | [[fallthrough]]; 35 | default: 36 | assert(false); 37 | } 38 | 39 | return 0u; 40 | } -------------------------------------------------------------------------------- /Refureku/Generator/Include/RefurekuGenerator/Parsing/FileParser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | class FileParser : public kodgen::FileParser 15 | { 16 | protected: 17 | virtual void preParse(fs::path const& parseFile) noexcept override 18 | { 19 | if (logger != nullptr) 20 | { 21 | logger->log("Start parsing: " + parseFile.string(), kodgen::ILogger::ELogSeverity::Info); 22 | } 23 | } 24 | 25 | virtual void postParse(fs::path const& parseFile, kodgen::FileParsingResult const& result) noexcept override 26 | { 27 | if (logger != nullptr) 28 | { 29 | for (kodgen::ParsingError const& parsingError : result.errors) 30 | { 31 | logger->log(parsingError.toString(), kodgen::ILogger::ELogSeverity::Error); 32 | } 33 | 34 | logger->log(parseFile.string() + ": Found " + std::to_string(result.namespaces.size()) + " namespace(s), " + 35 | std::to_string(result.structs.size()) + " struct(s), " + 36 | std::to_string(result.classes.size()) + " classe(s) and " + 37 | std::to_string(result.enums.size()) + " enum(s).", kodgen::ILogger::ELogSeverity::Info); 38 | } 39 | } 40 | }; 41 | } -------------------------------------------------------------------------------- /Refureku/Generator/LibraryGenerator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13.5) 2 | 3 | project(LibraryGenerator) 4 | 5 | set(LibraryGeneratorTarget LibraryGenerator) 6 | add_executable(${LibraryGeneratorTarget} main.cpp) 7 | 8 | target_link_libraries(${LibraryGeneratorTarget} PRIVATE Kodgen) 9 | 10 | target_include_directories(${LibraryGeneratorTarget} PUBLIC ../Include) -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/Generated/EntityMacros.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef RFKNamespace 4 | #define RFKNamespace(...) 5 | #endif 6 | 7 | #ifndef RFKClass 8 | #define RFKClass(...) 9 | #endif 10 | 11 | #ifndef RFKStruct 12 | #define RFKStruct(...) 13 | #endif 14 | 15 | #ifndef RFKVariable 16 | #define RFKVariable(...) 17 | #endif 18 | 19 | #ifndef RFKField 20 | #define RFKField(...) 21 | #endif 22 | 23 | #ifndef RFKMethod 24 | #define RFKMethod(...) 25 | #endif 26 | 27 | #ifndef RFKEnum 28 | #define RFKEnum(...) 29 | #endif 30 | 31 | #ifndef RFKEnumVal 32 | #define RFKEnumVal(...) 33 | #endif 34 | 35 | #ifndef RFKFunction 36 | #define RFKFunction(...) 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/Generated/Property.rfkh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "EntityMacros.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | #define File_Property_GENERATED \ 26 | 27 | 28 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/Generated/Property.rfks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../Public/Refureku/Properties/Property.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/Misc/GetPimplMacroImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | 12 | #define RFK_GEN_GET_PIMPL(type, source) \ 13 | RFK_NODISCARD inline type* getPimpl() noexcept { return reinterpret_cast(source); } \ 14 | RFK_NODISCARD inline type const* getPimpl() const noexcept { return reinterpret_cast(source); } 15 | 16 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/Misc/StringViewJoiner.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | namespace rfk 14 | { 15 | 16 | template 17 | class StringViewJoiner 18 | { 19 | private: 20 | /** 21 | * @brief Join all strings into a single std::array of chars. 22 | * Implementation found here: https://stackoverflow.com/questions/38955940/how-to-concatenate-static-strings-at-compile-time 23 | * 24 | * @return An std::array that contains the concatenation of all passed std::string_view. 25 | */ 26 | static constexpr auto joinStringViews() noexcept; 27 | 28 | /** Array containing the concatenated string views. */ 29 | static constexpr auto concatenatedStringsArray = joinStringViews(); 30 | 31 | public: 32 | StringViewJoiner() = delete; 33 | ~StringViewJoiner() = delete; 34 | 35 | /** Result of the concatenation. */ 36 | static constexpr std::string_view value{concatenatedStringsArray.data(), concatenatedStringsArray.size() - 1}; 37 | }; 38 | 39 | #include "Refureku/Utility/StringViewJoiner.inl" 40 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/Misc/StringViewJoiner.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | constexpr auto StringViewJoiner::joinStringViews() noexcept 10 | { 11 | constexpr std::size_t resultLength = (Strs.size() + ... + 0); 12 | std::array result{}; 13 | result[resultLength] = 0; 14 | 15 | auto append = [i = 0, &result](auto const& s) mutable 16 | { 17 | for (auto c : s) result[i++] = c; 18 | }; 19 | 20 | (append(Strs), ...); 21 | 22 | return result; 23 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/ArchetypeImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Archetype.h" 11 | #include "Refureku/TypeInfo/Entity/EntityImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class Archetype::ArchetypeImpl : public Entity::EntityImpl 16 | { 17 | private: 18 | /** Access specifier of this archetype. Relevant only when this archetype is nested (Undefined otherwise). */ 19 | EAccessSpecifier _accessSpecifier = EAccessSpecifier::Undefined; 20 | 21 | /** Size in bytes an instance of this archetype takes in memory, basically what sizeof(Type) returns */ 22 | std::size_t _memorySize = 0; 23 | 24 | public: 25 | inline ArchetypeImpl(char const* name, 26 | std::size_t id, 27 | EEntityKind kind, 28 | std::size_t memorySize, 29 | Entity const* outerEntity = nullptr) noexcept; 30 | 31 | /** 32 | * @brief Getter for the field _memorySize. 33 | * 34 | * @return _memorySize. 35 | */ 36 | inline std::size_t getMemorySize() const noexcept; 37 | 38 | /** 39 | * @brief Getter for the field _accessSpecifier. 40 | * 41 | * @return _accessSpecifier. 42 | */ 43 | inline EAccessSpecifier getAccessSpecifier() const noexcept; 44 | 45 | /** 46 | * @brief Setter for the field _accessSpecifier. 47 | * 48 | * @param The access specifier to set. 49 | */ 50 | inline void setAccessSpecifier(EAccessSpecifier) noexcept; 51 | }; 52 | 53 | #include "Refureku/TypeInfo/Archetypes/ArchetypeImpl.inl" 54 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/ArchetypeImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline Archetype::ArchetypeImpl::ArchetypeImpl(char const* name, std::size_t id, EEntityKind kind, std::size_t memorySize, Entity const* outerEntity) noexcept: 9 | Entity::EntityImpl(name, id, kind, outerEntity), 10 | _accessSpecifier{EAccessSpecifier::Undefined}, 11 | _memorySize{memorySize} 12 | { 13 | } 14 | 15 | inline EAccessSpecifier Archetype::ArchetypeImpl::getAccessSpecifier() const noexcept 16 | { 17 | return _accessSpecifier; 18 | } 19 | 20 | inline void Archetype::ArchetypeImpl::setAccessSpecifier(EAccessSpecifier accessSpecifier) noexcept 21 | { 22 | _accessSpecifier = accessSpecifier; 23 | } 24 | 25 | inline std::size_t Archetype::ArchetypeImpl::getMemorySize() const noexcept 26 | { 27 | return _memorySize; 28 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/ArchetypeRegistererImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "Refureku/TypeInfo/Archetypes/ArchetypeRegisterer.h" 13 | #include "Refureku/TypeInfo/Archetypes/Archetype.h" 14 | #include "Refureku/TypeInfo/DatabaseImpl.h" 15 | 16 | namespace rfk 17 | { 18 | class internal::ArchetypeRegistererImpl final 19 | { 20 | private: 21 | Archetype const& _registeredArchetype; 22 | 23 | public: 24 | inline ArchetypeRegistererImpl(Archetype const& archetype) noexcept; 25 | inline ~ArchetypeRegistererImpl() noexcept; 26 | 27 | /** 28 | * @brief Getter for the field _registeredEntity. 29 | * 30 | * @return _registeredEntity. 31 | */ 32 | inline Archetype const& getRegisteredArchetype() const noexcept; 33 | }; 34 | 35 | #include "Refureku/TypeInfo/Archetypes/ArchetypeRegistererImpl.inl" 36 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/ArchetypeRegistererImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline internal::ArchetypeRegistererImpl::ArchetypeRegistererImpl(Archetype const& archetype) noexcept: 9 | _registeredArchetype{archetype} 10 | { 11 | //Archetypes which are not at file level should not be registered 12 | assert(archetype.getOuterEntity() == nullptr); 13 | 14 | Database::getInstance()._pimpl->registerFileLevelEntityRecursive(archetype); 15 | } 16 | 17 | inline internal::ArchetypeRegistererImpl::~ArchetypeRegistererImpl() noexcept 18 | { 19 | Database::getInstance()._pimpl->unregisterEntityRecursive(_registeredArchetype); 20 | } 21 | 22 | inline Archetype const& internal::ArchetypeRegistererImpl::getRegisteredArchetype() const noexcept 23 | { 24 | return _registeredArchetype; 25 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/EnumImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline Enum::EnumImpl::EnumImpl(char const* name, std::size_t id, Archetype const* underlyingArchetype, Entity const* outerEntity) noexcept: 9 | ArchetypeImpl(name, id, EEntityKind::Enum, underlyingArchetype->getMemorySize(), outerEntity), 10 | _underlyingArchetype{*underlyingArchetype} 11 | { 12 | } 13 | 14 | inline EnumValue& Enum::EnumImpl::addEnumValue(char const* name, std::size_t id, int64 value, Enum const* backRef) noexcept 15 | { 16 | return _enumValues.emplace_back(name, id, value, backRef); 17 | } 18 | 19 | inline void Enum::EnumImpl::setEnumValuesCapacity(std::size_t capacity) noexcept 20 | { 21 | _enumValues.reserve(capacity); 22 | } 23 | 24 | inline std::vector const& Enum::EnumImpl::getEnumValues() const noexcept 25 | { 26 | return _enumValues; 27 | } 28 | 29 | inline Archetype const& Enum::EnumImpl::getUnderlyingArchetype() const noexcept 30 | { 31 | return _underlyingArchetype; 32 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/EnumValueImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/EnumValue.h" 11 | #include "Refureku/TypeInfo/Entity/EntityImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class EnumValue::EnumValueImpl final : public Entity::EntityImpl 16 | { 17 | private: 18 | /** Value of this enum value. */ 19 | int64 _value = 0; 20 | 21 | public: 22 | inline EnumValueImpl(char const* name, 23 | std::size_t id, 24 | int64 value, 25 | Entity const* outerEntity = nullptr) noexcept; 26 | 27 | /** 28 | * @brief Getter for the field _value. 29 | * 30 | * @return _value. 31 | */ 32 | inline int64 getValue() const noexcept; 33 | }; 34 | 35 | #include "Refureku/TypeInfo/Archetypes/EnumValueImpl.inl" 36 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/EnumValueImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline EnumValue::EnumValueImpl::EnumValueImpl(char const* name, std::size_t id, int64 value, Entity const* outerEntity) noexcept: 9 | EntityImpl(name, id, EEntityKind::EnumValue, outerEntity), 10 | _value{value} 11 | { 12 | } 13 | 14 | inline int64 EnumValue::EnumValueImpl::getValue() const noexcept 15 | { 16 | return _value; 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/FundamentalArchetypeImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #include "Refureku/TypeInfo/Archetypes/FundamentalArchetype.h" 9 | #include "Refureku/TypeInfo/Archetypes/ArchetypeImpl.h" 10 | 11 | namespace rfk 12 | { 13 | class FundamentalArchetype::FundamentalArchetypeImpl final : public Archetype::ArchetypeImpl 14 | { 15 | public: 16 | inline FundamentalArchetypeImpl(char const* name, 17 | std::size_t id, 18 | std::size_t memorySize) noexcept; 19 | }; 20 | 21 | #include "Refureku/TypeInfo/Archetypes/FundamentalArchetypeImpl.inl" 22 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/FundamentalArchetypeImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline FundamentalArchetype::FundamentalArchetypeImpl::FundamentalArchetypeImpl(char const* name, std::size_t id, std::size_t memorySize) noexcept: 9 | ArchetypeImpl(name, id, EEntityKind::FundamentalArchetype, memorySize) 10 | { 11 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/SubclassData.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include //std::ptrdiff_t 11 | 12 | namespace rfk 13 | { 14 | struct SubclassData 15 | { 16 | /** Bytes offset to add to a subclass instance to get a pointer to the base type. */ 17 | std::ptrdiff_t pointerOffset; 18 | 19 | SubclassData(std::ptrdiff_t pointerOffset) noexcept: 20 | pointerOffset{pointerOffset} 21 | { 22 | } 23 | }; 24 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/ClassTemplateImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline ClassTemplate::ClassTemplateImpl::ClassTemplateImpl(char const* name, std::size_t id, bool isClass) noexcept: 9 | StructImpl(name, id, 0u, isClass, EClassKind::Template) 10 | { 11 | } 12 | 13 | inline void ClassTemplate::ClassTemplateImpl::addTemplateInstantiation(ClassTemplateInstantiation const& instantiation) noexcept 14 | { 15 | _templateInstantiations.insert(&instantiation); 16 | } 17 | 18 | inline void ClassTemplate::ClassTemplateImpl::removeTemplateInstantiation(ClassTemplateInstantiation const& instantiation) noexcept 19 | { 20 | _templateInstantiations.erase(&instantiation); 21 | } 22 | 23 | inline void ClassTemplate::ClassTemplateImpl::addTemplateParameter(TemplateParameter const& param) noexcept 24 | { 25 | _templateParameters.push_back(¶m); 26 | } 27 | 28 | inline std::vector const& ClassTemplate::ClassTemplateImpl::getTemplateParameters() const noexcept 29 | { 30 | return _templateParameters; 31 | } 32 | 33 | inline std::unordered_set const& ClassTemplate::ClassTemplateImpl::getTemplateInstantiations() const noexcept 34 | { 35 | return _templateInstantiations; 36 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiationImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline ClassTemplateInstantiation::ClassTemplateInstantiationImpl::ClassTemplateInstantiationImpl(char const* name, std::size_t id, std::size_t memorySize, 9 | bool isClass, Archetype const& classTemplate) noexcept: 10 | StructImpl(name, id, memorySize, isClass, EClassKind::TemplateInstantiation), 11 | _classTemplate{static_cast(classTemplate)} 12 | { 13 | } 14 | 15 | inline void ClassTemplateInstantiation::ClassTemplateInstantiationImpl::addTemplateArgument(TemplateArgument const& arg) noexcept 16 | { 17 | _templateArguments.push_back(&arg); 18 | } 19 | 20 | inline ClassTemplate const& ClassTemplateInstantiation::ClassTemplateInstantiationImpl::getClassTemplate() const noexcept 21 | { 22 | return _classTemplate; 23 | } 24 | 25 | inline std::vector const& ClassTemplateInstantiation::ClassTemplateInstantiationImpl::getTemplateArguments() const noexcept 26 | { 27 | return _templateArguments; 28 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiationRegistererImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiationRegisterer.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiation.h" 12 | #include "Refureku/TypeInfo/DatabaseImpl.h" 13 | 14 | namespace rfk 15 | { 16 | class internal::ClassTemplateInstantiationRegistererImpl final 17 | { 18 | private: 19 | /** Registered template instantiation. */ 20 | ClassTemplateInstantiation const& _registeredClassTemplateInstantiation; 21 | 22 | public: 23 | inline ClassTemplateInstantiationRegistererImpl(ClassTemplateInstantiation const& instantiation) noexcept; 24 | inline ~ClassTemplateInstantiationRegistererImpl() noexcept; 25 | }; 26 | 27 | #include "Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiationRegistererImpl.inl" 28 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiationRegistererImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline internal::ClassTemplateInstantiationRegistererImpl::ClassTemplateInstantiationRegistererImpl(ClassTemplateInstantiation const& instantiation) noexcept: 9 | _registeredClassTemplateInstantiation{instantiation} 10 | { 11 | Database::getInstance()._pimpl->registerEntityIdRecursive(instantiation); 12 | } 13 | 14 | inline internal::ClassTemplateInstantiationRegistererImpl::~ClassTemplateInstantiationRegistererImpl() noexcept 15 | { 16 | Database::getInstance()._pimpl->unregisterEntityRecursive(_registeredClassTemplateInstantiation); 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgumentImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgument.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateArgumentImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class NonTypeTemplateArgument::NonTypeTemplateArgumentImpl : public TemplateArgument::TemplateArgumentImpl 16 | { 17 | private: 18 | /** Archetype of the argument value. */ 19 | Archetype const* _valueArchetype; 20 | 21 | /** Pointer to the argument value. */ 22 | void const* _valuePtr; 23 | 24 | public: 25 | inline NonTypeTemplateArgumentImpl(Archetype const* valueArchetype, 26 | void const* valuePtr) noexcept; 27 | 28 | /** 29 | * @brief Getter for the field _valueArchetype. 30 | * 31 | * @return _valueArchetype. 32 | */ 33 | RFK_NODISCARD inline Archetype const* getArchetype() const noexcept; 34 | 35 | /** 36 | * @brief Getter for the field _valuePtr. 37 | * 38 | * @return _valuePtr. 39 | */ 40 | RFK_NODISCARD inline void const* getValuePtr() const noexcept; 41 | }; 42 | 43 | #include "Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgumentImpl.inl" 44 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgumentImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline NonTypeTemplateArgument::NonTypeTemplateArgumentImpl::NonTypeTemplateArgumentImpl(Archetype const* valueArchetype, void const* valuePtr) noexcept: 9 | TemplateArgumentImpl(ETemplateParameterKind::NonTypeTemplateParameter), 10 | _valueArchetype{valueArchetype}, 11 | _valuePtr{valuePtr} 12 | { 13 | } 14 | 15 | inline Archetype const* NonTypeTemplateArgument::NonTypeTemplateArgumentImpl::getArchetype() const noexcept 16 | { 17 | return _valueArchetype; 18 | } 19 | 20 | inline void const* NonTypeTemplateArgument::NonTypeTemplateArgumentImpl::getValuePtr() const noexcept 21 | { 22 | return _valuePtr; 23 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateParameterImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateParameter.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateParameterImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class NonTypeTemplateParameter::NonTypeTemplateParameterImpl final : public TemplateParameter::TemplateParameterImpl 16 | { 17 | private: 18 | /** Archetype of the non-type parameter. */ 19 | Archetype const* _archetype; 20 | 21 | public: 22 | inline NonTypeTemplateParameterImpl(char const* name, 23 | Archetype const* archetype) noexcept; 24 | 25 | /** 26 | * @brief Getter for the field _archetype. 27 | * 28 | * @return _archetype. 29 | */ 30 | RFK_NODISCARD inline Archetype const* getArchetype() const noexcept; 31 | }; 32 | 33 | #include "Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateParameterImpl.inl" 34 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateParameterImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline NonTypeTemplateParameter::NonTypeTemplateParameterImpl::NonTypeTemplateParameterImpl(char const* name, Archetype const* archetype) noexcept: 9 | TemplateParameterImpl(name, ETemplateParameterKind::NonTypeTemplateParameter), 10 | _archetype{archetype} 11 | { 12 | } 13 | 14 | inline Archetype const* NonTypeTemplateParameter::NonTypeTemplateParameterImpl::getArchetype() const noexcept 15 | { 16 | return _archetype; 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateArgumentImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateArgument.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/ETemplateParameterKind.h" 12 | 13 | namespace rfk 14 | { 15 | class TemplateArgument::TemplateArgumentImpl 16 | { 17 | private: 18 | /** Template parameter this argument is a value of. */ 19 | ETemplateParameterKind _templateKind; 20 | 21 | public: 22 | inline TemplateArgumentImpl(ETemplateParameterKind templateKind) noexcept; 23 | virtual ~TemplateArgumentImpl() = default; 24 | 25 | /** 26 | * @brief Getter for the field _boundParameter. 27 | * 28 | * @return _boundParameter. 29 | */ 30 | RFK_NODISCARD inline ETemplateParameterKind getKind() const noexcept; 31 | }; 32 | 33 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateArgumentImpl.inl" 34 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateArgumentImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TemplateArgument::TemplateArgumentImpl::TemplateArgumentImpl(ETemplateParameterKind templateKind) noexcept: 9 | _templateKind{templateKind} 10 | { 11 | } 12 | 13 | inline ETemplateParameterKind TemplateArgument::TemplateArgumentImpl::getKind() const noexcept 14 | { 15 | return _templateKind; 16 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateParameterImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateParameter.h" 13 | 14 | namespace rfk 15 | { 16 | class TemplateParameter::TemplateParameterImpl 17 | { 18 | private: 19 | /** Name of the template parameter. */ 20 | std::string _name; 21 | 22 | /** Kind of template parameter. */ 23 | ETemplateParameterKind _kind; 24 | 25 | public: 26 | inline TemplateParameterImpl(char const* name, 27 | ETemplateParameterKind kind) noexcept; 28 | virtual ~TemplateParameterImpl() = default; 29 | 30 | /** 31 | * @brief Getter for the field _name. 32 | * 33 | * @return _name. 34 | */ 35 | RFK_NODISCARD inline std::string const& getName() const noexcept; 36 | 37 | /** 38 | * @brief Getter for the field _kind. 39 | * 40 | * @return _kind. 41 | */ 42 | RFK_NODISCARD inline ETemplateParameterKind getKind() const noexcept; 43 | }; 44 | 45 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateParameterImpl.inl" 46 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateParameterImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TemplateParameter::TemplateParameterImpl::TemplateParameterImpl(char const* name, ETemplateParameterKind kind) noexcept: 9 | _name(name), 10 | _kind{kind} 11 | { 12 | } 13 | 14 | inline std::string const& TemplateParameter::TemplateParameterImpl::getName() const noexcept 15 | { 16 | return _name; 17 | } 18 | 19 | inline ETemplateParameterKind TemplateParameter::TemplateParameterImpl::getKind() const noexcept 20 | { 21 | return _kind; 22 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateTemplateArgumentImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateTemplateArgument.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateArgumentImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class TemplateTemplateArgument::TemplateTemplateArgumentImpl : public TemplateArgument::TemplateArgumentImpl 16 | { 17 | private: 18 | /** Pointer to the argument template class archetype. Can be nullptr if the provided template class is not reflected. */ 19 | ClassTemplate const* _value; 20 | 21 | public: 22 | inline TemplateTemplateArgumentImpl(ClassTemplate const* value) noexcept; 23 | 24 | /** 25 | * @brief Getter for the field _value. 26 | * 27 | * @return _value. 28 | */ 29 | RFK_NODISCARD inline ClassTemplate const* getValue() const noexcept; 30 | }; 31 | 32 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateTemplateArgumentImpl.inl" 33 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateTemplateArgumentImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TemplateTemplateArgument::TemplateTemplateArgumentImpl::TemplateTemplateArgumentImpl(ClassTemplate const* value) noexcept: 9 | TemplateArgumentImpl(ETemplateParameterKind::TemplateTemplateParameter), 10 | _value{value} 11 | { 12 | } 13 | 14 | inline ClassTemplate const* TemplateTemplateArgument::TemplateTemplateArgumentImpl::getValue() const noexcept 15 | { 16 | return _value; 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateTemplateParameterImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateTemplateParameter.h" 13 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateParameterImpl.h" 14 | 15 | namespace rfk 16 | { 17 | class TemplateTemplateParameter::TemplateTemplateParameterImpl final : public TemplateParameter::TemplateParameterImpl 18 | { 19 | private: 20 | /** Collection of all template parameters. */ 21 | std::vector _templateParams; 22 | 23 | public: 24 | inline TemplateTemplateParameterImpl(char const* name) noexcept; 25 | 26 | /** 27 | * @brief Add a parameter to _templateParams. 28 | * 29 | * @param param Template parameter to add. 30 | */ 31 | inline void addTemplateParameter(TemplateParameter const& param) noexcept; 32 | 33 | /** 34 | * @brief Getter for the field _templateParams. 35 | * 36 | * @return _templateParams. 37 | */ 38 | inline std::vector const& getTemplateParameters() const noexcept; 39 | }; 40 | 41 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateTemplateParameterImpl.inl" 42 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TemplateTemplateParameterImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TemplateTemplateParameter::TemplateTemplateParameterImpl::TemplateTemplateParameterImpl(char const* name) noexcept: 9 | TemplateParameterImpl(name, ETemplateParameterKind::TemplateTemplateParameter) 10 | { 11 | } 12 | 13 | inline void TemplateTemplateParameter::TemplateTemplateParameterImpl::addTemplateParameter(TemplateParameter const& param) noexcept 14 | { 15 | _templateParams.push_back(¶m); 16 | } 17 | 18 | inline std::vector const& TemplateTemplateParameter::TemplateTemplateParameterImpl::getTemplateParameters() const noexcept 19 | { 20 | return _templateParams; 21 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TypeTemplateArgumentImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/TypeTemplateArgument.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateArgumentImpl.h" 12 | #include "Refureku/TypeInfo/Type.h" 13 | 14 | namespace rfk 15 | { 16 | class TypeTemplateArgument::TypeTemplateArgumentImpl : public TemplateArgument::TemplateArgumentImpl 17 | { 18 | private: 19 | /** Archetype of the template argument. */ 20 | Type const& _type; 21 | 22 | public: 23 | inline TypeTemplateArgumentImpl(Type const& type) noexcept; 24 | 25 | /** 26 | * @brief Getter for the field _archetype. 27 | * 28 | * @return _archetype. 29 | */ 30 | RFK_NODISCARD inline Type const& getType() const noexcept; 31 | }; 32 | 33 | #include "Refureku/TypeInfo/Archetypes/Template/TypeTemplateArgumentImpl.inl" 34 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TypeTemplateArgumentImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TypeTemplateArgument::TypeTemplateArgumentImpl::TypeTemplateArgumentImpl(Type const& type) noexcept: 9 | TemplateArgumentImpl(ETemplateParameterKind::TypeTemplateParameter), 10 | _type{type} 11 | { 12 | } 13 | 14 | inline Type const& TypeTemplateArgument::TypeTemplateArgumentImpl::getType() const noexcept 15 | { 16 | return _type; 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TypeTemplateParameterImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Template/TypeTemplateParameter.h" 11 | #include "Refureku/TypeInfo/Archetypes/Template/TemplateParameterImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class TypeTemplateParameter::TypeTemplateParameterImpl final : public TemplateParameter::TemplateParameterImpl 16 | { 17 | private: 18 | 19 | 20 | public: 21 | inline TypeTemplateParameterImpl(char const* name) noexcept; 22 | }; 23 | 24 | #include "Refureku/TypeInfo/Archetypes/Template/TypeTemplateParameterImpl.inl" 25 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Archetypes/Template/TypeTemplateParameterImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TypeTemplateParameter::TypeTemplateParameterImpl::TypeTemplateParameterImpl(char const* name) noexcept: 9 | TemplateParameterImpl(name, ETemplateParameterKind::TypeTemplateParameter) 10 | { 11 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Entity/DefaultEntityRegistererImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "Refureku/TypeInfo/Entity/DefaultEntityRegisterer.h" 13 | #include "Refureku/TypeInfo/Entity/Entity.h" 14 | #include "Refureku/TypeInfo/DatabaseImpl.h" 15 | 16 | namespace rfk 17 | { 18 | class internal::DefaultEntityRegistererImpl final 19 | { 20 | private: 21 | Entity const& _registeredEntity; 22 | 23 | public: 24 | inline DefaultEntityRegistererImpl(Entity const& entity) noexcept; 25 | inline ~DefaultEntityRegistererImpl() noexcept; 26 | 27 | /** 28 | * @brief Getter for the field _registeredEntity. 29 | * 30 | * @return _registeredEntity. 31 | */ 32 | inline Entity const& getRegisteredEntity() const noexcept; 33 | }; 34 | 35 | #include "Refureku/TypeInfo/Entity/DefaultEntityRegistererImpl.inl" 36 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Entity/DefaultEntityRegistererImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline internal::DefaultEntityRegistererImpl::DefaultEntityRegistererImpl(Entity const& entity) noexcept: 9 | _registeredEntity{entity} 10 | { 11 | //Entities which are not at file level should not be registered 12 | assert(entity.getOuterEntity() == nullptr); 13 | 14 | //Register to database 15 | Database::getInstance()._pimpl->registerFileLevelEntityRecursive(_registeredEntity); 16 | } 17 | 18 | inline internal::DefaultEntityRegistererImpl::~DefaultEntityRegistererImpl() noexcept 19 | { 20 | //Unregister from database 21 | Database::getInstance()._pimpl->unregisterEntityRecursive(_registeredEntity); 22 | } 23 | 24 | inline Entity const& internal::DefaultEntityRegistererImpl::getRegisteredEntity() const noexcept 25 | { 26 | return _registeredEntity; 27 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Entity/EntityCastInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Entity/Entity.h" 11 | 12 | namespace rfk::internal 13 | { 14 | /** 15 | * @brief Helper function to cast simple entity types. 16 | * 17 | * @tparam T Concrete type to cast to. 18 | * 19 | * @param entity The entity to cast. 20 | * 21 | * @return The casted entity if the entity concrete type was correct, else nullptr. 22 | */ 23 | template 24 | T const* entityCast(Entity const* entity) noexcept; 25 | 26 | #include "Refureku/TypeInfo/Entity/EntityCastInternal.inl" 27 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Entity/EntityCastInternal.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | T const* entityCast(Entity const* entity) noexcept 10 | { 11 | return (entity != nullptr && entity->getKind() == CheckKind) ? reinterpret_cast(entity) : nullptr; 12 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Entity/EntityHash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include //std::size_t 11 | 12 | namespace rfk 13 | { 14 | //Forward declaration 15 | class Entity; 16 | 17 | struct EntityNameHash 18 | { 19 | std::size_t operator()(Entity const& entity) const; 20 | }; 21 | 22 | struct EntityIdHash 23 | { 24 | std::size_t operator()(Entity const& entity) const; 25 | }; 26 | 27 | struct EntityNameEqual 28 | { 29 | bool operator()(Entity const& lhs, 30 | Entity const& rhs) const; 31 | }; 32 | 33 | struct EntityIdEqual 34 | { 35 | bool operator()(Entity const& lhs, 36 | Entity const& rhs) const; 37 | }; 38 | 39 | struct EntityPtrNameHash 40 | { 41 | std::size_t operator()(Entity const* entity) const; 42 | }; 43 | 44 | struct EntityPtrIdHash 45 | { 46 | std::size_t operator()(Entity const* entity) const; 47 | }; 48 | 49 | struct EntityPtrNameEqual 50 | { 51 | bool operator()(Entity const* lhs, 52 | Entity const* rhs) const; 53 | }; 54 | 55 | struct EntityPtrIdEqual 56 | { 57 | bool operator()(Entity const* lhs, 58 | Entity const* rhs) const; 59 | }; 60 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/FunctionBaseImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline FunctionBase::FunctionBaseImpl::FunctionBaseImpl(char const* name, std::size_t id, EEntityKind kind, 9 | Type const& returnType, ICallable* internalFunction, Entity const* outerEntity) noexcept: 10 | EntityImpl(name, id, kind, outerEntity), 11 | _returnType{returnType}, 12 | _internalFunction{internalFunction} 13 | { 14 | } 15 | 16 | inline FunctionParameter& FunctionBase::FunctionBaseImpl::addParameter(char const* name, std::size_t id, Type const& type, FunctionBase const* outerEntity) noexcept 17 | { 18 | return _parameters.emplace_back(name, id, type, outerEntity); 19 | } 20 | 21 | inline Type const& FunctionBase::FunctionBaseImpl::getReturnType() const noexcept 22 | { 23 | return _returnType; 24 | } 25 | 26 | inline ICallable* FunctionBase::FunctionBaseImpl::getInternalFunction() const noexcept 27 | { 28 | return _internalFunction.get(); 29 | } 30 | 31 | inline std::vector const& FunctionBase::FunctionBaseImpl::getParameters() const noexcept 32 | { 33 | return _parameters; 34 | } 35 | 36 | inline void FunctionBase::FunctionBaseImpl::setParametersCapacity(std::size_t capacity) noexcept 37 | { 38 | _parameters.reserve(capacity); 39 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/FunctionImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Functions/Function.h" 11 | #include "Refureku/TypeInfo/Functions/FunctionBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class Function::FunctionImpl final : public FunctionBase::FunctionBaseImpl 16 | { 17 | private: 18 | /** Flags describing this function. */ 19 | EFunctionFlags _flags = EFunctionFlags::Default; 20 | 21 | public: 22 | inline FunctionImpl(char const* name, 23 | std::size_t id, 24 | Type const& returnType, 25 | ICallable* internalFunction, 26 | EFunctionFlags flags) noexcept; 27 | 28 | /** 29 | * @brief Getter for the field _flags. 30 | * 31 | * @return _flags. 32 | */ 33 | RFK_NODISCARD inline EFunctionFlags getFlags() const noexcept; 34 | }; 35 | 36 | #include "Refureku/TypeInfo/Functions/FunctionImpl.inl" 37 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/FunctionImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline Function::FunctionImpl::FunctionImpl(char const* name, std::size_t id, 9 | Type const& returnType, ICallable* internalFunction, EFunctionFlags flags) noexcept: 10 | FunctionBaseImpl(name, id, EEntityKind::Function, returnType, internalFunction, nullptr), 11 | _flags{flags} 12 | { 13 | } 14 | 15 | inline EFunctionFlags Function::FunctionImpl::getFlags() const noexcept 16 | { 17 | return _flags; 18 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/FunctionParameterImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "Refureku/TypeInfo/Functions/FunctionParameter.h" 13 | #include "Refureku/TypeInfo/Entity/EntityImpl.h" 14 | 15 | namespace rfk 16 | { 17 | class FunctionParameter::FunctionParameterImpl : public Entity::EntityImpl 18 | { 19 | private: 20 | /** Type of this parameter. */ 21 | Type const& _type; 22 | 23 | public: 24 | FunctionParameterImpl(char const* name, 25 | std::size_t id, 26 | Type const& type, 27 | Entity const* outerEntity) noexcept; 28 | 29 | /** 30 | * @brief Getter for the field _type. 31 | * 32 | * @return _type; 33 | */ 34 | RFK_NODISCARD Type const& getType() const noexcept; 35 | }; 36 | 37 | #include "Refureku/TypeInfo/Functions/FunctionParameterImpl.inl" 38 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/FunctionParameterImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | FunctionParameter::FunctionParameterImpl::FunctionParameterImpl(char const* name, std::size_t id, Type const& type, Entity const* outerEntity) noexcept: 9 | EntityImpl(name, id, EEntityKind::Undefined /* TODO: Add new entity kind for parameters */, outerEntity), 10 | _type{type} 11 | { 12 | } 13 | 14 | Type const& FunctionParameter::FunctionParameterImpl::getType() const noexcept 15 | { 16 | return _type; 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/MethodBaseImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Functions/MethodBase.h" 11 | #include "Refureku/TypeInfo/Functions/FunctionBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class MethodBase::MethodBaseImpl : public FunctionBase::FunctionBaseImpl 16 | { 17 | private: 18 | /** Flags qualifying this method. */ 19 | EMethodFlags _flags = EMethodFlags::Default; 20 | 21 | public: 22 | inline MethodBaseImpl(char const* name, 23 | std::size_t id, 24 | Type const& returnType, 25 | ICallable* internalMethod, 26 | EMethodFlags flags, 27 | Entity const* outerEntity) noexcept; 28 | 29 | RFK_NODISCARD inline EMethodFlags getFlags() const noexcept; 30 | }; 31 | 32 | #include "Refureku/TypeInfo/Functions/MethodBaseImpl.inl" 33 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/MethodBaseImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline MethodBase::MethodBaseImpl::MethodBaseImpl(char const* name, std::size_t id, Type const& returnType, 9 | ICallable* internalMethod, EMethodFlags flags, Entity const* outerEntity) noexcept: 10 | FunctionBaseImpl(name, id, EEntityKind::Method, returnType, internalMethod, outerEntity), 11 | _flags{flags} 12 | { 13 | } 14 | 15 | inline EMethodFlags MethodBase::MethodBaseImpl::getFlags() const noexcept 16 | { 17 | return _flags; 18 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/MethodImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Functions/Method.h" 11 | #include "Refureku/TypeInfo/Functions/MethodBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class Method::MethodImpl final : public MethodBase::MethodBaseImpl 16 | { 17 | public: 18 | inline MethodImpl(char const* name, 19 | std::size_t id, 20 | Type const& returnType, 21 | ICallable* internalMethod, 22 | EMethodFlags flags, 23 | Entity const* outerEntity) noexcept; 24 | }; 25 | 26 | #include "Refureku/TypeInfo/Functions/MethodImpl.inl" 27 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/MethodImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline Method::MethodImpl::MethodImpl(char const* name, std::size_t id, Type const& returnType, 9 | ICallable* internalMethod, EMethodFlags flags, Entity const* outerEntity) noexcept: 10 | MethodBaseImpl(name, id, returnType, internalMethod, flags, outerEntity) 11 | { 12 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/StaticMethodImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Functions/StaticMethod.h" 11 | #include "Refureku/TypeInfo/Functions/MethodBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class StaticMethod::StaticMethodImpl final : public MethodBase::MethodBaseImpl 16 | { 17 | public: 18 | inline StaticMethodImpl(char const* name, 19 | std::size_t id, 20 | Type const& returnType, 21 | ICallable* internalMethod, 22 | EMethodFlags flags, 23 | Entity const* outerEntity) noexcept; 24 | }; 25 | 26 | #include "Refureku/TypeInfo/Functions/StaticMethodImpl.inl" 27 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Functions/StaticMethodImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline StaticMethod::StaticMethodImpl::StaticMethodImpl(char const* name, std::size_t id, Type const& returnType, 9 | ICallable* internalMethod, EMethodFlags flags, Entity const* outerEntity) noexcept: 10 | MethodBaseImpl(name, id, returnType, internalMethod, flags, outerEntity) 11 | { 12 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Namespace/NamespaceFragmentRegistererImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include //std::size_t 11 | #include 12 | 13 | #include "Refureku/TypeInfo/Namespace/NamespaceFragmentRegisterer.h" 14 | #include "Refureku/TypeInfo/Namespace/NamespaceFragment.h" 15 | #include "Refureku/TypeInfo/Namespace/Namespace.h" 16 | #include "Refureku/TypeInfo/DatabaseImpl.h" 17 | #include "Refureku/Properties/Property.h" 18 | 19 | namespace rfk 20 | { 21 | class internal::NamespaceFragmentRegistererImpl final 22 | { 23 | private: 24 | /** Fragment registered by this registerer. */ 25 | NamespaceFragment const& _registeredFragment; 26 | 27 | public: 28 | inline NamespaceFragmentRegistererImpl(NamespaceFragment const& namespaceFragment) noexcept; 29 | inline ~NamespaceFragmentRegistererImpl() noexcept; 30 | }; 31 | 32 | #include "Refureku/TypeInfo/Namespace/NamespaceFragmentRegistererImpl.inl" 33 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Namespace/NamespaceFragmentRegistererImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline internal::NamespaceFragmentRegistererImpl::NamespaceFragmentRegistererImpl(NamespaceFragment const& namespaceFragment) noexcept: 9 | _registeredFragment{namespaceFragment} 10 | { 11 | //Only register file level namespaces 12 | assert(namespaceFragment.getOuterEntity() == nullptr); 13 | 14 | Database::getInstance()._pimpl->registerFileLevelEntityRecursive(_registeredFragment); 15 | } 16 | 17 | inline internal::NamespaceFragmentRegistererImpl::~NamespaceFragmentRegistererImpl() noexcept 18 | { 19 | //Unregister namespace fragment from database 20 | Database::getInstance()._pimpl->unregisterEntityRecursive(_registeredFragment); 21 | 22 | /** 23 | * The registerer destructor is guaranteed to run before any of the nested entity destructor because 24 | * it completed its construction last, so we initiate the fragment unmerging from here. 25 | */ 26 | _registeredFragment.unmergeFragment(); 27 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/TypeImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "Refureku/TypeInfo/Type.h" 13 | #include "Refureku/TypeInfo/Archetypes/Archetype.h" 14 | 15 | namespace rfk 16 | { 17 | class Type::TypeImpl 18 | { 19 | private: 20 | /** Parts of this type. */ 21 | std::vector _parts; 22 | 23 | /** Archetype of this type. */ 24 | Archetype const* _archetype = nullptr; 25 | 26 | public: 27 | /** 28 | * @brief Add a default-constructed type part to this type. 29 | * 30 | * @return The newly constructed type part. 31 | */ 32 | inline TypePart& addTypePart() noexcept; 33 | 34 | 35 | /** 36 | * @brief Reallocate the underlying dynamic memory to use no more than needed. 37 | */ 38 | inline void optimizeMemory() noexcept; 39 | 40 | /** 41 | * @brief Getter for the field _parts. 42 | * 43 | * @return _parts. 44 | */ 45 | inline std::vector const& getParts() const noexcept; 46 | 47 | /** 48 | * @brief Getter for the field _archetype. 49 | * 50 | * @return _archetype. 51 | */ 52 | inline Archetype const* getArchetype() const noexcept; 53 | 54 | /** 55 | * @brief Setter for the field _archetype. 56 | * 57 | * @param archetype The archetype to set. 58 | */ 59 | inline void setArchetype(Archetype const* archetype) noexcept; 60 | }; 61 | 62 | #include "Refureku/TypeInfo/TypeImpl.inl" 63 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/TypeImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline TypePart& Type::TypeImpl::addTypePart() noexcept 9 | { 10 | return _parts.emplace_back(); 11 | } 12 | 13 | inline void Type::TypeImpl::optimizeMemory() noexcept 14 | { 15 | _parts.shrink_to_fit(); 16 | } 17 | 18 | inline std::vector const& Type::TypeImpl::getParts() const noexcept 19 | { 20 | return _parts; 21 | } 22 | 23 | inline Archetype const* Type::TypeImpl::getArchetype() const noexcept 24 | { 25 | return _archetype; 26 | } 27 | 28 | inline void Type::TypeImpl::setArchetype(Archetype const* archetype) noexcept 29 | { 30 | _archetype = archetype; 31 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/FieldBaseImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Variables/FieldBase.h" 11 | #include "Refureku/TypeInfo/Variables/VariableBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class FieldBase::FieldBaseImpl : public VariableBase::VariableBaseImpl 16 | { 17 | private: 18 | /** Flags describing this field. */ 19 | EFieldFlags _flags = EFieldFlags::Default; 20 | 21 | /** Struct owning this field. */ 22 | Struct const* _owner = nullptr; 23 | 24 | public: 25 | inline FieldBaseImpl(char const* name, 26 | std::size_t id, 27 | Type const& type, 28 | EFieldFlags flags, 29 | Struct const* owner, 30 | Entity const* outerEntity = nullptr) noexcept; 31 | 32 | /** 33 | * @brief Getter for the field _flags. 34 | * 35 | * @return _flags. 36 | */ 37 | inline EFieldFlags getFlags() const noexcept; 38 | 39 | /** 40 | * @brief Getter for the field _owner. 41 | * 42 | * @return _owner. 43 | */ 44 | inline Struct const* getOwner() const noexcept; 45 | }; 46 | 47 | #include "Refureku/TypeInfo/Variables/FieldBaseImpl.inl" 48 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/FieldBaseImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline FieldBase::FieldBaseImpl::FieldBaseImpl(char const* name, std::size_t id, Type const& type, EFieldFlags flags, Struct const* owner, Entity const* outerEntity) noexcept: 9 | VariableBaseImpl(name, id, EEntityKind::Field, type, outerEntity), 10 | _flags{flags}, 11 | _owner{owner} 12 | { 13 | } 14 | 15 | inline EFieldFlags FieldBase::FieldBaseImpl::getFlags() const noexcept 16 | { 17 | return _flags; 18 | } 19 | 20 | inline Struct const* FieldBase::FieldBaseImpl::getOwner() const noexcept 21 | { 22 | return _owner; 23 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/FieldImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Variables/Field.h" 11 | #include "Refureku/TypeInfo/Variables/FieldBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class Field::FieldImpl final : public FieldBase::FieldBaseImpl 16 | { 17 | private: 18 | /** Memory offset in bytes of this field in its owner class. */ 19 | std::size_t _memoryOffset = 0u; 20 | 21 | public: 22 | inline FieldImpl(char const* name, 23 | std::size_t id, 24 | Type const& type, 25 | EFieldFlags flags, 26 | Struct const* owner, 27 | std::size_t memoryOffset, 28 | Entity const* outerEntity = nullptr) noexcept; 29 | 30 | /** 31 | * @brief Getter for the field _memoryOffset. 32 | * 33 | * @return _memoryOffset. 34 | */ 35 | inline std::size_t getMemoryOffset() const noexcept; 36 | }; 37 | 38 | #include "Refureku/TypeInfo/Variables/FieldImpl.inl" 39 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/FieldImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline Field::FieldImpl::FieldImpl(char const* name, std::size_t id, Type const& type, EFieldFlags flags, 9 | Struct const* owner, std::size_t memoryOffset, Entity const* outerEntity) noexcept: 10 | FieldBaseImpl(name, id, type, flags, owner, outerEntity), 11 | _memoryOffset{memoryOffset} 12 | { 13 | } 14 | 15 | inline std::size_t Field::FieldImpl::getMemoryOffset() const noexcept 16 | { 17 | return _memoryOffset; 18 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/StaticFieldImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Variables/StaticField.h" 11 | #include "Refureku/TypeInfo/Variables/FieldBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class StaticField::StaticFieldImpl : public FieldBase::FieldBaseImpl 16 | { 17 | private: 18 | /** Ptr to the static field. */ 19 | union 20 | { 21 | void* _ptr = nullptr; 22 | void const* _constPtr; 23 | }; 24 | 25 | public: 26 | inline StaticFieldImpl(char const* name, 27 | std::size_t id, 28 | Type const& type, 29 | EFieldFlags flags, 30 | Struct const* owner, 31 | void* ptr, 32 | Entity const* outerEntity) noexcept; 33 | inline StaticFieldImpl(char const* name, 34 | std::size_t id, 35 | Type const& type, 36 | EFieldFlags flags, 37 | Struct const* owner, 38 | void const* constPtr, 39 | Entity const* outerEntity) noexcept; 40 | 41 | /** 42 | * @brief Getter for the field _ptr. 43 | * 44 | * @return _ptr. 45 | */ 46 | RFK_NODISCARD inline void* getPtr() const noexcept; 47 | 48 | /** 49 | * @brief Getter for the field _constPtr. 50 | * 51 | * @return _constPtr. 52 | */ 53 | RFK_NODISCARD inline void const* getConstPtr() const noexcept; 54 | }; 55 | 56 | #include "Refureku/TypeInfo/Variables/StaticFieldImpl.inl" 57 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/StaticFieldImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | 9 | inline StaticField::StaticFieldImpl::StaticFieldImpl(char const* name, std::size_t id, Type const& type, EFieldFlags flags, 10 | Struct const* owner, void* ptr, Entity const* outerEntity) noexcept: 11 | FieldBaseImpl(name, id, type, flags, owner, outerEntity), 12 | _ptr{ptr} 13 | { 14 | } 15 | 16 | inline StaticField::StaticFieldImpl::StaticFieldImpl(char const* name, std::size_t id, Type const& type, EFieldFlags flags, 17 | Struct const* owner, void const* constPtr, Entity const* outerEntity) noexcept: 18 | FieldBaseImpl(name, id, type, flags, owner, outerEntity), 19 | _constPtr{constPtr} 20 | { 21 | } 22 | 23 | inline void* StaticField::StaticFieldImpl::getPtr() const noexcept 24 | { 25 | return _ptr; 26 | } 27 | 28 | inline void const* StaticField::StaticFieldImpl::getConstPtr() const noexcept 29 | { 30 | return _constPtr; 31 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/VariableBaseImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Variables/VariableBase.h" 11 | #include "Refureku/TypeInfo/Entity/EntityImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class VariableBase::VariableBaseImpl : public Entity::EntityImpl 16 | { 17 | private: 18 | /** Type of this variable. */ 19 | Type const& _type; 20 | 21 | public: 22 | inline VariableBaseImpl(char const* name, 23 | std::size_t id, 24 | EEntityKind kind, 25 | Type const& type, 26 | Entity const* outerEntity) noexcept; 27 | 28 | /** 29 | * @brief Getter for the field _type. 30 | * 31 | * @return _type. 32 | */ 33 | inline Type const& getType() const noexcept; 34 | }; 35 | 36 | #include "Refureku/TypeInfo/Variables/VariableBaseImpl.inl" 37 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/VariableBaseImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline VariableBase::VariableBaseImpl::VariableBaseImpl(char const* name, std::size_t id, EEntityKind kind, Type const& type, Entity const* outerEntity) noexcept: 9 | EntityImpl(name, id, kind, outerEntity), 10 | _type{type} 11 | { 12 | } 13 | 14 | inline Type const& VariableBase::VariableBaseImpl::getType() const noexcept 15 | { 16 | return _type; 17 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/VariableImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Variables/Variable.h" 11 | #include "Refureku/TypeInfo/Variables/VariableBaseImpl.h" 12 | 13 | namespace rfk 14 | { 15 | class Variable::VariableImpl : public VariableBase::VariableBaseImpl 16 | { 17 | private: 18 | /** Flags describing this variable. */ 19 | EVarFlags _flags = EVarFlags::Default; 20 | 21 | /** Pointer to the variable. */ 22 | union 23 | { 24 | void* _ptr = nullptr; 25 | void const* _constPtr; 26 | }; 27 | 28 | public: 29 | inline VariableImpl(char const* name, 30 | std::size_t id, 31 | Type const& type, 32 | void* ptr, 33 | EVarFlags flags) noexcept; 34 | inline VariableImpl(char const* name, 35 | std::size_t id, 36 | Type const& type, 37 | void const* constPtr, 38 | EVarFlags flags) noexcept; 39 | 40 | /** 41 | * @brief Getter for the field _flags. 42 | * 43 | * @return _flags. 44 | */ 45 | RFK_NODISCARD inline EVarFlags getFlags() const noexcept; 46 | 47 | /** 48 | * @brief Getter for the field _ptr. 49 | * 50 | * @return _ptr. 51 | */ 52 | RFK_NODISCARD inline void* getPtr() const noexcept; 53 | 54 | /** 55 | * @brief Getter for the field _constPtr. 56 | * 57 | * @return _constPtr. 58 | */ 59 | RFK_NODISCARD inline void const* getConstPtr() const noexcept; 60 | }; 61 | 62 | #include "Refureku/TypeInfo/Variables/VariableImpl.inl" 63 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Internal/Refureku/TypeInfo/Variables/VariableImpl.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | inline Variable::VariableImpl::VariableImpl(char const* name, std::size_t id, Type const& type, void* ptr, EVarFlags flags) noexcept: 9 | VariableBaseImpl(name, id, EEntityKind::Variable, type, nullptr), 10 | _flags{flags}, 11 | _ptr{ptr} 12 | { 13 | } 14 | 15 | inline Variable::VariableImpl::VariableImpl(char const* name, std::size_t id, Type const& type, void const* constPtr, EVarFlags flags) noexcept: 16 | VariableBaseImpl(name, id, EEntityKind::Variable, type, nullptr), 17 | _flags{flags}, 18 | _constPtr{constPtr} 19 | { 20 | } 21 | 22 | inline EVarFlags Variable::VariableImpl::getFlags() const noexcept 23 | { 24 | return _flags; 25 | } 26 | 27 | inline void* Variable::VariableImpl::getPtr() const noexcept 28 | { 29 | return _ptr; 30 | } 31 | 32 | inline void const* Variable::VariableImpl::getConstPtr() const noexcept 33 | { 34 | return _constPtr; 35 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Containers/Allocator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include //std::size_t, std::ptrdiff_t 11 | #include //operator new, align_val_t 12 | 13 | #include "Refureku/Config.h" 14 | 15 | namespace rfk 16 | { 17 | template 18 | class Allocator 19 | { 20 | public: 21 | using value_type = T; 22 | using pointer = T*; 23 | using const_pointer = T const*; 24 | using reference = T&; 25 | using const_reference = T const&; 26 | 27 | /** 28 | * @brief Allocate count * sizeof(T) bytes. 29 | * 30 | * @param count Number of elements T needed to fit in the allocated memory. 31 | * 32 | * @return A pointer to the allocated memory. 33 | */ 34 | RFK_NODISCARD constexpr T* allocate(std::size_t count); 35 | 36 | /** 37 | * @brief Deallocate count * sizeof(T) bytes at the specified memory. 38 | * 39 | * @param allocatedMemory Pointer to the allocated memory to deallocate. 40 | * @param count Number of T elements to deallocate. 41 | */ 42 | constexpr void deallocate(T* allocatedMemory, 43 | std::size_t count); 44 | }; 45 | 46 | #include "Refureku/Containers/Allocator.inl" 47 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Containers/Allocator.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | constexpr T* Allocator::allocate(std::size_t count) 10 | { 11 | if constexpr (alignof(T) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) 12 | { 13 | return static_cast(::operator new(count * sizeof(T), std::align_val_t{alignof(T)})); 14 | } 15 | else 16 | { 17 | return static_cast(::operator new(count * sizeof(T))); 18 | } 19 | } 20 | 21 | template 22 | constexpr void Allocator::deallocate(T* allocatedMemory, [[maybe_unused]] std::size_t count) 23 | { 24 | //For some reasons clang can't find the delete overload with count * sizeof(T) as second parameter 25 | 26 | if constexpr (alignof(T) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) 27 | { 28 | ::operator delete(allocatedMemory, std::align_val_t{alignof(T)}); 29 | } 30 | else 31 | { 32 | ::operator delete(allocatedMemory); 33 | } 34 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/ArgCountMismatch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | class ArgCountMismatch : public std::logic_error 15 | { 16 | public: 17 | using std::logic_error::logic_error; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/ArgTypeMismatch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Exceptions/TypeMismatch.h" 11 | 12 | namespace rfk 13 | { 14 | class ArgTypeMismatch : public TypeMismatch 15 | { 16 | public: 17 | using TypeMismatch::TypeMismatch; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/BadNamespaceFormat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | class BadNamespaceFormat : public std::invalid_argument 15 | { 16 | public: 17 | using std::invalid_argument::invalid_argument; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/ConstViolation.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | class ConstViolation : public std::logic_error 15 | { 16 | public: 17 | using std::logic_error::logic_error; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/InvalidArchetype.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | class InvalidArchetype : public std::logic_error 15 | { 16 | public: 17 | using std::logic_error::logic_error; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/ReturnTypeMismatch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Exceptions/TypeMismatch.h" 11 | 12 | namespace rfk 13 | { 14 | class ReturnTypeMismatch : public TypeMismatch 15 | { 16 | public: 17 | using TypeMismatch::TypeMismatch; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Exceptions/TypeMismatch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | class TypeMismatch : public std::logic_error 15 | { 16 | public: 17 | using std::logic_error::logic_error; 18 | }; 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Generated/EntityMacros.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef RFKNamespace 4 | #define RFKNamespace(...) 5 | #endif 6 | 7 | #ifndef RFKClass 8 | #define RFKClass(...) 9 | #endif 10 | 11 | #ifndef RFKStruct 12 | #define RFKStruct(...) 13 | #endif 14 | 15 | #ifndef RFKVariable 16 | #define RFKVariable(...) 17 | #endif 18 | 19 | #ifndef RFKField 20 | #define RFKField(...) 21 | #endif 22 | 23 | #ifndef RFKMethod 24 | #define RFKMethod(...) 25 | #endif 26 | 27 | #ifndef RFKEnum 28 | #define RFKEnum(...) 29 | #endif 30 | 31 | #ifndef RFKEnumVal 32 | #define RFKEnumVal(...) 33 | #endif 34 | 35 | #ifndef RFKFunction 36 | #define RFKFunction(...) 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Generated/Property.rfkh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "EntityMacros.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | #define File_Property_GENERATED \ 26 | 27 | 28 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/CopyConstness.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | namespace rfk 11 | { 12 | /** 13 | * @brief Helper type traits class that copy the constness of a type to a target type. 14 | * ex: CopyConstness::Type yields float 15 | * CopyConstness::Type yields float const 16 | */ 17 | template 18 | struct CopyConstness 19 | { 20 | using Type = Target; 21 | }; 22 | 23 | template 24 | struct CopyConstness 25 | { 26 | using Type = Target const; 27 | }; 28 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/EnumMacros.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #define RFK_GENERATE_ENUM_OPERATORS(EnumName) \ 13 | constexpr EnumName operator|(EnumName flags1, EnumName flags2) noexcept \ 14 | { \ 15 | using UnderlyingType = std::underlying_type_t; \ 16 | \ 17 | return static_cast(static_cast(flags1) | static_cast(flags2)); \ 18 | } \ 19 | \ 20 | constexpr EnumName operator&(EnumName flags1, EnumName flags2) noexcept \ 21 | { \ 22 | using UnderlyingType = std::underlying_type_t; \ 23 | \ 24 | return static_cast(static_cast(flags1) & static_cast(flags2)); \ 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/FundamentalTypes.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace rfk 13 | { 14 | using uint8 = uint8_t; 15 | using uint16 = uint16_t; 16 | using uint32 = uint32_t; 17 | using uint64 = uint64_t; 18 | 19 | using int8 = int8_t; 20 | using int16 = int16_t; 21 | using int32 = int32_t; 22 | using int64 = int64_t; 23 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/GetPimplMacro.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | 12 | #if defined(REFUREKU_EXPORT) 13 | 14 | #include "Refureku/Misc/GetPimplMacroImpl.h" 15 | 16 | #else 17 | 18 | #define RFK_GEN_GET_PIMPL(type, source) 19 | 20 | #endif -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/Predicate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | namespace rfk 11 | { 12 | /** 13 | * @brief Predicate defining if a value is valid or not. 14 | * 15 | * @param value The tested value. 16 | * @param userData Data received from the user. 17 | * 18 | * @return true if the tested value is valid, else false. 19 | */ 20 | template 21 | using Predicate = bool (*)(T const& value, void* userData); 22 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/SharedPtr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include //std::shared_ptr 11 | #include //std::forward 12 | 13 | namespace rfk 14 | { 15 | //Use std implementation for now, might have a custom implementation someday if necessary 16 | template 17 | using SharedPtr = std::shared_ptr; 18 | 19 | template 20 | SharedPtr makeShared(Args&&... args); 21 | 22 | #include "Refureku/Misc/SharedPtr.inl" 23 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/SharedPtr.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | SharedPtr makeShared(Args&&... args) 10 | { 11 | return std::make_shared(std::forward(args)...); 12 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/TypeTraits.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020-2022 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Misc/TypeTraitsMacros.h" 11 | 12 | namespace rfk::internal 13 | { 14 | RFK_GENERATE_IS_CALLABLE_METHOD_TRAITS(getArchetype); 15 | RFK_GENERATE_IS_CALLABLE_STATIC_METHOD_TRAITS(staticGetArchetype); 16 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/UniquePtr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include //std::unique_ptr 11 | #include //std::forward 12 | 13 | namespace rfk 14 | { 15 | //Use std implementation for now, might have a custom implementation someday if necessary 16 | template > 17 | using UniquePtr = std::unique_ptr; 18 | 19 | template 20 | UniquePtr makeUnique(Args&&... args); 21 | 22 | #include "Refureku/Misc/UniquePtr.inl" 23 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/UniquePtr.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | UniquePtr makeUnique(Args&&... args) 10 | { 11 | return std::make_unique(std::forward(args)...); 12 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Misc/Visitor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | namespace rfk 11 | { 12 | /** 13 | * @brief Visitor function. 14 | * 15 | * @param value The visited value. 16 | * @param userData Data received from the user. 17 | * 18 | * @return true to make the visitor continue to the next value, else false (abort). 19 | */ 20 | template 21 | using Visitor = bool (*)(T const& value, void* userData); 22 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/NativeProperties.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Properties/ParseAllNested.h" 11 | #include "Refureku/Properties/Instantiator.h" -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Object.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | 12 | namespace rfk 13 | { 14 | //Forward declaration 15 | class Struct; 16 | 17 | /** 18 | * Base class which implements the virtual getArchetype method. 19 | */ 20 | class REFUREKU_API Object 21 | { 22 | public: 23 | Object() = default; 24 | Object(Object const&) = default; 25 | Object(Object&&) = default; 26 | virtual ~Object() = default; 27 | 28 | virtual Struct const& getArchetype() const noexcept = 0; 29 | 30 | Object& operator=(Object const&) = default; 31 | Object& operator=(Object&&) = default; 32 | }; 33 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Properties/Instantiator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | #include "Refureku/Properties/Property.h" 12 | #include "Refureku/Properties/PropertySettings.h" 13 | 14 | #include "Refureku/Generated/Instantiator.rfkh.h" 15 | 16 | namespace rfk RFKNamespace() 17 | { 18 | /** 19 | * @brief Property used to add a new instantiator to a struct or class through the rfk::Struct::makeSharedInstance method. 20 | * This property can only be attached to static methods returning a shared pointer to the class (rfk::SharedPtr). 21 | */ 22 | class REFUREKU_API RFKClass(rfk::PropertySettings(rfk::EEntityKind::Method)) Instantiator : public rfk::Property 23 | { 24 | rfk_Instantiator_GENERATED 25 | }; 26 | } 27 | 28 | File_Instantiator_GENERATED -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Properties/ParseAllNested.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | #include "Refureku/Properties/Property.h" 12 | #include "Refureku/Properties/PropertySettings.h" 13 | 14 | #include "Refureku/Generated/ParseAllNested.rfkh.h" 15 | 16 | namespace kodgen RFKNamespace() 17 | { 18 | /** 19 | * @brief Property used to automatically reflect all directly nested entities. 20 | * This property can only be attached to namespaces, structs and classes. 21 | */ 22 | class REFUREKU_API RFKClass(rfk::PropertySettings(rfk::EEntityKind::Namespace | rfk::EEntityKind::Class | rfk::EEntityKind::Struct)) ParseAllNested : public rfk::Property 23 | { 24 | kodgen_ParseAllNested_GENERATED 25 | }; 26 | } 27 | 28 | File_ParseAllNested_GENERATED -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/Properties/PropertySettings.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | #include "Refureku/Properties/Property.h" 12 | 13 | #include "Refureku/Generated/PropertySettings.rfkh.h" 14 | 15 | namespace rfk RFKNamespace() 16 | { 17 | /** 18 | * @brief Property used to define basic settings of a property. Can't be used on structs or classes not inheriting from rfk::Property. 19 | */ 20 | class REFUREKU_API RFKClass(rfk::PropertySettings(rfk::EEntityKind::Struct | rfk::EEntityKind::Class)) PropertySettings : public rfk::Property 21 | { 22 | public: 23 | /** 24 | * @param targetEntityKind_ Kind of entities the property can be attached to. Use the | operator to specify multiple entity kinds. 25 | * @param allowMultiple_ Is this property allowed to be attached multiple times to the same entity? 26 | * @param shouldInherit_ Should this property be inherited by children when used on structs/classes or virtual methods. 27 | */ 28 | PropertySettings(rfk::EEntityKind targetEntityKind_, 29 | bool allowMultiple_ = false, 30 | bool shouldInherit_ = true) noexcept; 31 | 32 | rfk_PropertySettings_GENERATED 33 | }; 34 | } 35 | 36 | File_PropertySettings_GENERATED -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/ArchetypeRegisterer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | #include "Refureku/Misc/Pimpl.h" 12 | 13 | namespace rfk 14 | { 15 | //Forward declarations 16 | class Archetype; 17 | 18 | namespace internal 19 | { 20 | class ArchetypeRegistererImpl; 21 | } 22 | 23 | class ArchetypeRegisterer final 24 | { 25 | public: 26 | REFUREKU_API ArchetypeRegisterer(Archetype const& archetype) noexcept; 27 | ArchetypeRegisterer(ArchetypeRegisterer const&) = delete; 28 | ArchetypeRegisterer(ArchetypeRegisterer&&) = delete; 29 | REFUREKU_API ~ArchetypeRegisterer() noexcept; 30 | 31 | private: 32 | /** Pointer to ArchetypeRegisterer implementation. */ 33 | Pimpl _pimpl; 34 | }; 35 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/EClassKind.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | namespace rfk 11 | { 12 | /** 13 | * @brief Defines the kind of a rfk::Class or a rfk::Struct instance: 14 | * - Standard: The rfk::Class can't be cast to any more concrete type. 15 | * - Template: The rfk::Class can be safely cast to rfk::ClassTemplate. 16 | * - TemplateInstantiation: The rfk::Class can be safely cast to rfk::ClassTemplateInstantiation. 17 | */ 18 | enum class EClassKind 19 | { 20 | Standard, 21 | Template, 22 | TemplateInstantiation 23 | }; 24 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Enum.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | rfk::Enum const* getEnum() noexcept 10 | { 11 | return nullptr; 12 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/EnumValue.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | T EnumValue::getValue() const noexcept 10 | { 11 | static_assert(std::is_integral_v || std::is_enum_v, "EnumValue::getValue can only be called with integral / enum types."); 12 | 13 | return static_cast(getValue()); 14 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/FundamentalArchetype.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/TypeInfo/Archetypes/Archetype.h" 11 | 12 | namespace rfk 13 | { 14 | class FundamentalArchetype final : public Archetype 15 | { 16 | public: 17 | REFUREKU_INTERNAL FundamentalArchetype(char const* name, 18 | std::size_t id, 19 | std::size_t memorySize) noexcept; 20 | REFUREKU_INTERNAL ~FundamentalArchetype() noexcept; 21 | 22 | private: 23 | //Forward declaration 24 | class FundamentalArchetypeImpl; 25 | }; 26 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Template/ClassTemplate.inl: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | template 9 | ClassTemplateInstantiation const* ClassTemplate::getTemplateInstantiation(TemplateArgument const* (&args)[ArgsCount]) const noexcept 10 | { 11 | if constexpr (ArgsCount > 0) 12 | { 13 | return getTemplateInstantiation(&args[0], ArgsCount); 14 | } 15 | else 16 | { 17 | return nullptr; 18 | } 19 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Template/ClassTemplateInstantiationRegisterer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "Refureku/Config.h" 11 | #include "Refureku/Misc/Pimpl.h" 12 | 13 | namespace rfk 14 | { 15 | //Forward declarations 16 | class ClassTemplateInstantiation; 17 | 18 | namespace internal 19 | { 20 | class ClassTemplateInstantiationRegistererImpl; 21 | } 22 | 23 | class ClassTemplateInstantiationRegisterer final 24 | { 25 | public: 26 | REFUREKU_API ClassTemplateInstantiationRegisterer(ClassTemplateInstantiation const& instantiation) noexcept; 27 | ClassTemplateInstantiationRegisterer(ClassTemplateInstantiationRegisterer const&) = delete; 28 | ClassTemplateInstantiationRegisterer(ClassTemplateInstantiationRegisterer&&) = delete; 29 | REFUREKU_API ~ClassTemplateInstantiationRegisterer() noexcept; 30 | 31 | private: 32 | /** Pointer to the concrete ClassTemplateInstantiationRegisterer implementation. */ 33 | Pimpl _pimpl; 34 | }; 35 | } -------------------------------------------------------------------------------- /Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Template/ETemplateParameterKind.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved 3 | * 4 | * This file is part of the Refureku library project which is released under the MIT License. 5 | * See the LICENSE.md file for full license details. 6 | */ 7 | 8 | #pragma once 9 | 10 | namespace rfk 11 | { 12 | /** 13 | * @brief Defines the kind of a template parameter. 14 | */ 15 | enum class ETemplateParameterKind 16 | { 17 | /** 18 | * The template parameter is a non-type template parameter, like: 19 | * template or template 20 | */ 21 | NonTypeTemplateParameter, 22 | 23 | /** 24 | * The template parameter is a type template parameter, like: 25 | * template 26 | */ 27 | TypeTemplateParameter, 28 | 29 | /** 30 | * The template parameter is a template template parameter, like: 31 | * template