File indexing completed on 2024-05-19 05:05:21
0001 /*************************************************************************** 0002 * SPDX-License-Identifier: GPL-2.0-or-later 0003 * * 0004 * SPDX-FileCopyrightText: 2004-2023 Thomas Fischer <fischer@unix-ag.uni-kl.de> 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, see <https://www.gnu.org/licenses/>. * 0018 ***************************************************************************/ 0019 0020 #ifndef KBIBTEX_GLOBAL_KBIBTEX_H 0021 #define KBIBTEX_GLOBAL_KBIBTEX_H 0022 0023 #include <QMap> 0024 #include <QUrl> 0025 0026 #ifdef HAVE_KF 0027 #include "kbibtexglobal_export.h" 0028 #endif // HAVE_KF 0029 0030 #define squeeze_text(text, n) ((text).length()<=(n)?(text):(text).left((n)/2-1)+QStringLiteral("...")+(text).right((n)/2-2)) 0031 0032 /** 0033 @author Thomas Fischer <fischer@unix-ag.uni-kl.de> 0034 */ 0035 class KBIBTEXGLOBAL_EXPORT KBibTeX { 0036 public: 0037 static const QString extensionTeX; 0038 static const QString extensionAux; 0039 static const QString extensionBBL; 0040 static const QString extensionBLG; 0041 static const QString extensionBibTeX; 0042 static const QString extensionPDF; 0043 static const QString extensionPostScript; 0044 static const QString extensionRTF; 0045 0046 enum class Casing { LowerCase, InitialCapital, UpperCamelCase, LowerCamelCase, UpperCase }; 0047 0048 enum class FieldInputType { SingleLine, MultiLine, List, Url, Month, Color, PersonList, UrlList, KeywordList, CrossRef, StarRating, Edition }; 0049 0050 enum class TypeFlag { 0051 Invalid = 0x0, 0052 PlainText = 0x1, 0053 Reference = 0x2, 0054 Person = 0x4, 0055 Keyword = 0x8, 0056 Verbatim = 0x10, 0057 Source = 0x100 0058 }; 0059 Q_DECLARE_FLAGS(TypeFlags, TypeFlag) 0060 0061 static const QString Months[]; 0062 static const QString MonthsTriple[]; 0063 0064 static const QRegularExpression fileListSeparatorRegExp; 0065 static const QRegularExpression fileRegExp; 0066 static const QRegularExpression urlRegExp; 0067 static const QRegularExpression doiRegExp; 0068 static const QRegularExpression arXivRegExp; 0069 static const QRegularExpression domainNameRegExp; 0070 static const QRegularExpression htmlRegExp; 0071 static const QString doiUrlPrefix; ///< use FileInfo::doiUrlPrefix() instead 0072 }; 0073 0074 Q_DECLARE_OPERATORS_FOR_FLAGS(KBibTeX::TypeFlags) 0075 0076 KBIBTEXGLOBAL_EXPORT QDebug operator<<(QDebug dbg, const KBibTeX::TypeFlag &typeFlag); 0077 KBIBTEXGLOBAL_EXPORT QDebug operator<<(QDebug dbg, const KBibTeX::TypeFlags &typeFlags); 0078 0079 #endif // KBIBTEX_GLOBAL_KBIBTEX_H