File indexing completed on 2025-01-19 04:46:30

0001 /*
0002   This file is part of KAddressBook.
0003   SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
0004 
0005   SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QDateTime>
0011 #include <QString>
0012 
0013 /**
0014   This class parses the datetime out of a given string with the
0015   help of a pattern.
0016 
0017   The pattern can contain the following place holders:
0018     y = year (e.g. 82)
0019     Y = year (e.g. 1982)
0020     m = month (e.g. 7, 07 or 12)
0021     M = month (e.g. 07 or 12)
0022     d = day (e.g. 3, 03 or 17)
0023     D = day (e.g. 03 or 17)
0024     H = hour (e.g. 12)
0025     I = minute (e.g. 56)
0026     S = second (e.g. 30)
0027  */
0028 class DateParser
0029 {
0030 public:
0031     explicit DateParser(const QString &pattern);
0032     ~DateParser();
0033 
0034     QDateTime parse(const QString &dateStr) const;
0035 
0036 private:
0037     QString mPattern;
0038 };