File indexing completed on 2024-12-08 04:35:10
0001 /* 0002 SPDX-FileCopyrightText: 2004 Ace Jones acejones @users.sourceforge.net 0003 0004 This file is part of libalkimia. 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef ALKDATEFORMAT_H 0010 #define ALKDATEFORMAT_H 0011 0012 #include "alkexception.h" 0013 0014 #include <QDate> 0015 #include <QString> 0016 #include <QStringList> 0017 0018 /** 0019 * 0020 * Universal date converter 0021 * 0022 * In 'strict' mode, this is designed to be compatible with the QIF profile date 0023 * converter. However, that converter deals with the concept of an apostrophe 0024 * format in a way I don't understand. So for the moment, they are 99% 0025 * compatible, waiting on that issue. (acejones) 0026 */ 0027 class ALK_NO_EXPORT AlkDateFormat 0028 { 0029 public: 0030 explicit AlkDateFormat(const QString &format); 0031 AlkDateFormat(const AlkDateFormat& right); 0032 ~AlkDateFormat(); 0033 0034 AlkDateFormat& operator=(const AlkDateFormat&); 0035 0036 typedef enum { 0037 NoError = 0, 0038 InvalidFormatString, 0039 InvalidFormatCharacter, 0040 InvalidDate, 0041 InvalidDay, 0042 InvalidMonth, 0043 InvalidYear, 0044 InvalidYearLength, 0045 } ErrorCode; 0046 0047 QString convertDate(const QDate &date); 0048 QDate convertString(const QString &date, bool strict = true, 0049 unsigned centuryMidPoint = QDate::currentDate().year()); 0050 const QString &format() const; 0051 0052 QString lastErrorMessage() const; 0053 ErrorCode lastError() const; 0054 0055 private: 0056 class Private; 0057 Private* const d; 0058 }; 0059 0060 #endif // ALKDATEFORMAT_H