/* * Author: Patrick-Christopher Mattulat * Co-Author: Claude Sonnet 4.6 (LLM) * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2023-05-24 * Changed: 2026-06-23 * * */ #ifndef LS_STD_RAW_NULL_POINTER_EVALUATOR_HPP #define LS_STD_RAW_NULL_POINTER_EVALUATOR_HPP #include #include #include #include /* * @doc: class(name: 'RawNullPointerEvaluator', package: 'core') * @doc: core.RawNullPointerEvaluator.description('This class evaluates whether a passed raw pointer reference is null.') * */ namespace ls::standard::core { template class RawNullPointerEvaluator : public ls::standard::core::interface_type::IEvaluator { public: explicit RawNullPointerEvaluator(const ls::standard::core::type::RawPointer &_argument) : argument(_argument) {} RawNullPointerEvaluator(const ls::standard::core::type::RawPointer &_argument, const ::std::string &_message) : argument(_argument), message(_message) {} ~RawNullPointerEvaluator() noexcept override = default; void evaluate() override { if (this->argument.get() == nullptr) { if (this->message.empty()) { throw ls::standard::core::NullPointerException{"reference in use is null!"}; } else { throw ls::standard::core::NullPointerException{this->message}; } } } private: ls::standard::core::type::RawPointer argument{}; ::std::string message{}; }; } #endif