SectionPairRowValueValidator.cpp 997 B

123456789101112131415161718192021222324
  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-16
  7. *
  8. * */
  9. #include <ls-std/io/NewLine.hpp>
  10. #include <ls-std/io/section-pair/validator/SectionPairRowValueValidator.hpp>
  11. #include <regex>
  12. ls::std::io::SectionPairRowValueValidator::SectionPairRowValueValidator(ls::std::io::section_pair_row_value _value) : ls::std::core::Class("SectionPairRowValueValidator"), value(::std::move(_value))
  13. {}
  14. ls::std::io::SectionPairRowValueValidator::~SectionPairRowValueValidator() = default;
  15. bool ls::std::io::SectionPairRowValueValidator::isValid()
  16. {
  17. this->value = ::std::regex_replace(this->value, ::std::regex(ls::std::io::NewLine::get()), "");
  18. size_t foundPosition = this->value.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789_#![]{}()/$ۤ%?<>+:;., *\"");
  19. return foundPosition == ls::std::io::section_pair_row_value::npos;
  20. }