File indexing completed on 2025-04-20 11:02:16
0001 /* 0002 SPDX-FileCopyrightText: 2018 Bruce Anderson <banderson19com@san.rr.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef SIMPLEIPLISTVALIDATOR_H 0008 #define SIMPLEIPLISTVALIDATOR_H 0009 0010 #include "simpleipv4addressvalidator.h" 0011 #include "simpleipv6addressvalidator.h" 0012 #include <QValidator> 0013 0014 class Q_DECL_EXPORT SimpleIpListValidator : public QValidator 0015 { 0016 Q_OBJECT 0017 public: 0018 enum AddressType { Ipv4, Ipv6, Both }; 0019 enum AddressStyle { Base, WithCidr, WithPort }; 0020 0021 explicit SimpleIpListValidator(AddressStyle style = AddressStyle::Base, AddressType allow = AddressType::Both, QObject *parent = nullptr); 0022 ~SimpleIpListValidator() override; 0023 0024 State validate(QString &, int &) const override; 0025 0026 private: 0027 SimpleIpV6AddressValidator *m_ipv6Validator = nullptr; 0028 SimpleIpV4AddressValidator *m_ipv4Validator = nullptr; 0029 }; 0030 0031 #endif // SIMPLEIPV4ADDRESSVALIDATOR_H