SectionPairRowArgumentEvaluator.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-20
  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/SectionPairRowArgumentEvaluator.hpp>
  12. #include <ls-std/io/section-pair/validator/SectionPairRowValidator.hpp>
  13. #include <string>
  14. using ls::std::core::Class;
  15. using ls::std::core::IllegalArgumentException;
  16. using ls::std::io::SectionPairMessageFormatter;
  17. using ls::std::io::SectionPairRowArgumentEvaluator;
  18. using ls::std::io::SectionPairRowValidator;
  19. using std::move;
  20. using std::string;
  21. SectionPairRowArgumentEvaluator::SectionPairRowArgumentEvaluator(string _sectionPairRow) : Class("SectionPairRowArgumentEvaluator"), sectionPairRow(::move(_sectionPairRow))
  22. {}
  23. SectionPairRowArgumentEvaluator::~SectionPairRowArgumentEvaluator() noexcept = default;
  24. void SectionPairRowArgumentEvaluator::evaluate()
  25. {
  26. if (!SectionPairRowValidator{this->sectionPairRow}.isValid())
  27. {
  28. string message = "\"" + this->sectionPairRow + "\" is not a valid section pair row!";
  29. throw IllegalArgumentException{SectionPairMessageFormatter::getFormattedMessage(message)};
  30. }
  31. }