SectionPairSectionArgumentEvaluator.cpp 1.3 KB

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