File indexing completed on 2024-04-21 14:56:37

0001 /*  -*- C++ -*-
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 1997 Tim D. Gilman <tdgilman@best.org>
0004     SPDX-FileCopyrightText: 1998-2001 Mirko Boehm <mirko@kde.org>
0005     SPDX-FileCopyrightText: 2007 John Layt <john@layt.net>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef KDATEVALIDATOR_H
0011 #define KDATEVALIDATOR_H
0012 
0013 #include <kguiaddons_export.h>
0014 
0015 #include <QValidator>
0016 
0017 /**
0018  * @class KDateValidator kdatevalidator.h KDateValidator
0019  *
0020  * Validates user-entered dates.
0021  */
0022 class KGUIADDONS_EXPORT KDateValidator : public QValidator
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit KDateValidator(QObject *parent = nullptr);
0027     State validate(QString &text, int &e) const override;
0028     void fixup(QString &input) const override;
0029     State date(const QString &text, QDate &date) const;
0030 
0031 private:
0032     // KF6 TODO: add explicit destructor, use std::unique_ptr
0033     friend class KDateValidatorPrivate;
0034     class KDateValidatorPrivate *const d;
0035 };
0036 
0037 #endif // KDATEVALIDATOR_H