SectionPairValueArgumentEvaluator.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-10
  6. * Changed: 2023-02-23
  7. *
  8. * */
  9. #include <ls-std/core/exception/IllegalArgumentException.hpp>
  10. #include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
  11. #include <ls-std/io/section-pair/evaluator/SectionPairValueArgumentEvaluator.hpp>
  12. #include <ls-std/io/section-pair/validator/SectionPairValueValidator.hpp>
  13. using ls::std::core::Class;
  14. using ls::std::core::IllegalArgumentException;
  15. using ls::std::io::section_pair_row_value;
  16. using ls::std::io::SectionPairMessageFormatter;
  17. using ls::std::io::SectionPairValueArgumentEvaluator;
  18. using ls::std::io::SectionPairValueValidator;
  19. using std::move;
  20. using std::string;
  21. SectionPairValueArgumentEvaluator::SectionPairValueArgumentEvaluator(section_pair_row_value _value) : Class("SectionPairValueArgumentEvaluator"), value(::move(_value))
  22. {}
  23. SectionPairValueArgumentEvaluator::~SectionPairValueArgumentEvaluator() noexcept = default;
  24. void SectionPairValueArgumentEvaluator::evaluate()
  25. {
  26. if (!SectionPairValueValidator(this->value).isValid())
  27. {
  28. string message = "\"" + this->value + "\" is not a valid value!";
  29. throw IllegalArgumentException{SectionPairMessageFormatter::getFormattedMessage(message)};
  30. }
  31. }