diff options
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/common/ipvalidator.h')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/common/ipvalidator.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/common/ipvalidator.h b/SQLiteStudio3/guiSQLiteStudio/common/ipvalidator.h new file mode 100644 index 0000000..1c9ca4d --- /dev/null +++ b/SQLiteStudio3/guiSQLiteStudio/common/ipvalidator.h @@ -0,0 +1,35 @@ +#ifndef IPVALIDATOR_H +#define IPVALIDATOR_H + +#include <QValidator> + +class IpValidator : public QValidator +{ + public: + IpValidator(QObject* parent = 0); + ~IpValidator(); + + State validate(QString& input, int&) const; + + bool getAcceptWhiteSpaces() const; + void setAcceptWhiteSpaces(bool value); + + bool getAcceptEmptyParts() const; + void setAcceptEmptyParts(bool value); + + QChar getWhitespaceCharacter() const; + void setWhitespaceCharacter(const QChar& value); + + static bool check(const QString& input, bool acceptWhiteSpaces = false); + + private: + static QString getPattern(bool acceptWhiteSpaces, bool requireFull, QChar whitespaceCharacter); + + bool acceptWhiteSpaces = false; + bool acceptEmptyParts = false; + QChar whitespaceCharacter = ' '; + + static QString reStr; +}; + +#endif // IPVALIDATOR_H |
