AddressValidator.hpp
1 #pragma once
2 #include <State/Expression.hpp>
3 
4 #include <QValidator>
5 
6 namespace State
7 {
17 class SCORE_LIB_STATE_EXPORT AddressValidator final : public QValidator
18 {
19 public:
20  virtual ~AddressValidator();
21  QValidator::State validate(QString& s, int& pos) const override
22  {
23  return ::State::Address::validateString(s) ? State::Acceptable : State::Intermediate;
24  }
25 };
26 
27 class SCORE_LIB_STATE_EXPORT AddressAccessorValidator final : public QValidator
28 {
29 public:
30  virtual ~AddressAccessorValidator();
31  QValidator::State validate(QString& s, int& pos) const override
32  {
33  auto res = ::State::parseAddressAccessor(s);
34  return bool(res) ? State::Acceptable : State::Intermediate;
35  }
36 };
37 
38 class SCORE_LIB_STATE_EXPORT AddressFragmentValidator : public QValidator
39 {
40 public:
41  using QValidator::QValidator;
42  virtual ~AddressFragmentValidator();
43  QValidator::State validate(QString& s, int& pos) const override
44  {
45  return ::State::Address::validateFragment(s) ? QValidator::State::Acceptable
46  : QValidator::State::Invalid;
47  }
48 };
49 }
Definition: AddressValidator.hpp:28
Definition: AddressValidator.hpp:39
The AddressValidator class.
Definition: AddressValidator.hpp:18
Utilities for OSSIA data structures.
Definition: DeviceInterface.hpp:33