FunctorValidator.cpp 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "FunctorValidator.h"
  9. namespace ProjectSettingsTool
  10. {
  11. FunctorValidator::FunctorValidator(FunctorType functor)
  12. : QValidator()
  13. , m_functor(functor)
  14. {
  15. }
  16. FunctorValidator::FunctorValidator()
  17. : QValidator()
  18. , m_functor(nullptr)
  19. {
  20. }
  21. QValidator::State FunctorValidator::validate(QString& input, [[maybe_unused]] int& pos) const
  22. {
  23. return m_functor(input).first;
  24. }
  25. FunctorValidator::ReturnType FunctorValidator::ValidateWithErrors(const QString& input) const
  26. {
  27. return m_functor(input);
  28. }
  29. FunctorValidator::FunctorType FunctorValidator::Functor() const
  30. {
  31. return m_functor;
  32. }
  33. } // namespace ProjectSettingsTool
  34. #include <moc_FunctorValidator.cpp>