SectionPairRowSingleValueArgumentEvaluator.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-19
  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/SectionPairRowSingleValueArgumentEvaluator.hpp>
  12. #include <ls-std/io/section-pair/validator/SectionPairRowSingleValueValidator.hpp>
  13. using ls::std::core::Class;
  14. using ls::std::core::IllegalArgumentException;
  15. using ls::std::io::SectionPairMessageFormatter;
  16. using ls::std::io::SectionPairRowSingleValueArgumentEvaluator;
  17. using ls::std::io::SectionPairRowSingleValueValidator;
  18. using std::move;
  19. using std::string;
  20. SectionPairRowSingleValueArgumentEvaluator::SectionPairRowSingleValueArgumentEvaluator(string _singleValueRow) : Class("SectionPairRowSingleValueArgumentEvaluator"), singleValueRow(::move(_singleValueRow))
  21. {}
  22. SectionPairRowSingleValueArgumentEvaluator::~SectionPairRowSingleValueArgumentEvaluator() noexcept = default;
  23. void SectionPairRowSingleValueArgumentEvaluator::evaluate()
  24. {
  25. if (!SectionPairRowSingleValueValidator{this->singleValueRow}.isValid())
  26. {
  27. string message = "\"" + this->singleValueRow + "\" is not a valid section pair single value row!";
  28. throw IllegalArgumentException{SectionPairMessageFormatter::getFormattedMessage(message)};
  29. }
  30. }