alkimia  8.0.2
alkdateformat.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2004 Ace Jones <acejones@users.sourceforge.net> *
3  * *
4  * This file is part of libalkimia. *
5  * *
6  * libalkimia is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License *
8  * as published by the Free Software Foundation; either version 2.1 of *
9  * the License or (at your option) version 3 or any later version. *
10  * *
11  * libalkimia is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program. If not, see <http://www.gnu.org/licenses/> *
18  ***************************************************************************/
19 
20 #ifndef ALKDATEFORMAT_H
21 #define ALKDATEFORMAT_H
22 
23 #include "alkexception.h"
24 
25 #include <QDate>
26 #include <QRegExp>
27 #include <QString>
28 #include <QStringList>
29 
39 class ALK_NO_EXPORT AlkDateFormat
40 {
41 public:
42  explicit AlkDateFormat(const QString &format);
43  ~AlkDateFormat();
44 
45  AlkDateFormat& operator=(const AlkDateFormat&);
46 
47  typedef enum {
48  NoError = 0,
49  InvalidFormatString,
50  InvalidFormatCharacter,
51  InvalidDate,
52  InvalidDay,
53  InvalidMonth,
54  InvalidYear,
55  InvalidYearLength,
56  } ErrorCode;
57 
58  QString convertDate(const QDate &date);
59  QDate convertString(const QString &date, bool strict = true,
60  unsigned centuryMidPoint = QDate::currentDate().year());
61  const QString &format() const;
62 
63  QString lastErrorMessage() const;
64  ErrorCode lastError() const;
65 
66 private:
67  class Private;
68  Private* const d;
69 };
70 
71 #endif // ALKDATEFORMAT_H
alkexception.h
AlkDateFormat::Private
Definition: alkdateformat.cpp:36
AlkDateFormat::ErrorCode
ErrorCode
Definition: alkdateformat.h:64
AlkDateFormat
Definition: alkdateformat.h:39