SectionPairIdentifierArgumentEvaluator.cpp 1.2 KB

12345678910111213141516171819202122232425262728
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-09
  6. * Changed: 2023-02-22
  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/SectionPairIdentifierArgumentEvaluator.hpp>
  12. #include <ls-std/io/section-pair/validator/SectionPairIdentifierValidator.hpp>
  13. #include <string>
  14. ls::std::io::SectionPairIdentifierArgumentEvaluator::SectionPairIdentifierArgumentEvaluator(ls::std::io::section_pair_identifier _identifier) : ls::std::core::Class("SectionPairIdentifierArgumentEvaluator"), identifier(::std::move(_identifier))
  15. {}
  16. ls::std::io::SectionPairIdentifierArgumentEvaluator::~SectionPairIdentifierArgumentEvaluator() noexcept = default;
  17. void ls::std::io::SectionPairIdentifierArgumentEvaluator::evaluate()
  18. {
  19. if (!ls::std::io::SectionPairIdentifierValidator{this->identifier}.isValid())
  20. {
  21. ::std::string message = "\"" + this->identifier + "\" is not a valid identifier!";
  22. throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
  23. }
  24. }