File indexing completed on 2024-12-08 08:02:35
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 "plasmanm_editor_export.h" 0011 0012 #include "simpleipv4addressvalidator.h" 0013 #include "simpleipv6addressvalidator.h" 0014 #include <QValidator> 0015 0016 class PLASMANM_EDITOR_EXPORT SimpleIpListValidator : public QValidator 0017 { 0018 Q_OBJECT 0019 public: 0020 enum AddressType { Ipv4, Ipv6, Both }; 0021 enum AddressStyle { Base, WithCidr, WithPort }; 0022 0023 explicit SimpleIpListValidator(AddressStyle style = AddressStyle::Base, AddressType allow = AddressType::Both, QObject *parent = nullptr); 0024 ~SimpleIpListValidator() override; 0025 0026 State validate(QString &, int &) const override; 0027 0028 private: 0029 SimpleIpV6AddressValidator *m_ipv6Validator = nullptr; 0030 SimpleIpV4AddressValidator *m_ipv4Validator = nullptr; 0031 }; 0032 0033 #endif // SIMPLEIPV4ADDRESSVALIDATOR_H