12345678910111213141516171819202122232425262728293031323334353637 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2023-02-10
- * Changed: 2024-05-31
- *
- * */
- #include <ls-std/core/evaluator/IndexOutOfBoundsEvaluator.hpp>
- #include <ls-std/core/exception/IndexOutOfBoundsException.hpp>
- using ls::std::core::IndexOutOfBoundsEvaluator;
- using ls::std::core::IndexOutOfBoundsException;
- using std::move;
- using std::string;
- IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size) : index(_index), size(_size)
- {}
- IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size, string _message) : index(_index), message(::move(_message)), size(_size)
- {}
- IndexOutOfBoundsEvaluator::~IndexOutOfBoundsEvaluator() noexcept = default;
- void IndexOutOfBoundsEvaluator::evaluate()
- {
- if (this->index >= this->size)
- {
- if (this->message.empty())
- {
- throw IndexOutOfBoundsException{};
- }
- throw IndexOutOfBoundsException{this->message};
- }
- }
|