RegExpValidator.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // RegExpValidator.h
  3. //
  4. // Library: Util
  5. // Package: Options
  6. // Module: RegExpValidator
  7. //
  8. // Definition of the RegExpValidator class.
  9. //
  10. // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef Util_RegExpValidator_INCLUDED
  16. #define Util_RegExpValidator_INCLUDED
  17. #include "Poco/Util/Util.h"
  18. #include "Poco/Util/Validator.h"
  19. namespace Poco {
  20. namespace Util {
  21. class Util_API RegExpValidator: public Validator
  22. /// This validator matches the option value against
  23. /// a regular expression.
  24. {
  25. public:
  26. RegExpValidator(const std::string& regexp);
  27. /// Creates the RegExpValidator, using the given regular expression.
  28. ~RegExpValidator();
  29. /// Destroys the RegExpValidator.
  30. void validate(const Option& option, const std::string& value);
  31. /// Validates the value for the given option by
  32. /// matching it with the regular expression.
  33. private:
  34. RegExpValidator();
  35. std::string _regexp;
  36. };
  37. } } // namespace Poco::Util
  38. #endif // Util_RegExpValidator_INCLUDED