#pragma once /* MIT License Copyright (c) 2024 - 2025 René Amthor (tobid7) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include // Requires C++ 17 or later #include // Requires C++ 20 or later #include #include #include #include #include #include #include #include #include namespace PD { /** * SmartCtor (std::shared_ptr) Template class for Smart Pointers * * - Just add : public PD::SmartCtor to your class * @tparam T Your Class */ template class SmartCtor { public: /** Reference alias for std::shared_ptr */ using Ref = std::shared_ptr; /** * static Function to Create a New Reference * @param args Additional Arguments (Depends on your classes Constructors) * @return New Reference Object */ template static Ref New(Args&&... args) { return std::make_shared(std::forward(args)...); } }; /** * Wrapper for SmartCtor::New(Args) * @tparam T Class Type * @param args Arguments * @return Type Reference (SmartPointer) */ template SmartCtor::Ref New(Args&&... args) { return SmartCtor::New(std::forward(args)...); } // Defines /** alias for 64 Bit unsigned integer */ using u64 = unsigned long long; /** alias for 32 Bit unsigned integer */ using u32 = unsigned int; /** alias for 16 Bit unsigned integer */ using u16 = unsigned short; /** alias for 8 Bit unsigned integer */ using u8 = unsigned char; /** * LinInfo Compile Information */ namespace LibInfo { /** * Get the Compiler Name and Version the lib got Compiled with * @return Compiler Name / Version */ const std::string CompiledWith(); /** * Get the C++ Version used to compile the lib * @return C++ Version (__cplusplus) */ const std::string CxxVersion(); /** * Get the Buildtime of the Library * @return Build Time */ const std::string BuildTime(); /** * Get the Library Version * @return Library Version String */ const std::string Version(); /** * Get the Git Commit the Lib got compiled in * @return Git Commit 7digit short hash */ const std::string Commit(); /** * Get the Git Branch which was active when compiling the lib * @return Git Branch */ const std::string Branch(); } // namespace LibInfo } // namespace PD