EmptyStringArgumentEvaluator.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2023-02-08
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
  11. #include <ls-std/core/exception/IllegalArgumentException.hpp>
  12. using ls::standard::core::EmptyStringArgumentEvaluator;
  13. using ls::standard::core::IllegalArgumentException;
  14. using std::move;
  15. using std::string;
  16. EmptyStringArgumentEvaluator::EmptyStringArgumentEvaluator(string _argument) : argument(::move(_argument))
  17. {}
  18. EmptyStringArgumentEvaluator::EmptyStringArgumentEvaluator(string _argument, string _message) : argument(::move(_argument)), message(::move(_message))
  19. {}
  20. EmptyStringArgumentEvaluator::~EmptyStringArgumentEvaluator() noexcept = default;
  21. void EmptyStringArgumentEvaluator::evaluate()
  22. {
  23. if (this->argument.empty())
  24. {
  25. if (this->message.empty())
  26. {
  27. throw IllegalArgumentException{"passed argument is empty!"};
  28. }
  29. throw IllegalArgumentException{this->message};
  30. }
  31. }