File indexing completed on 2024-05-19 05:05:35

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_IO_FILEEXPORTERXML_H
0021 #define KBIBTEX_IO_FILEEXPORTERXML_H
0022 
0023 #include <QTextStream>
0024 
0025 #include <Element>
0026 #include <Value>
0027 #include <FileExporter>
0028 
0029 #ifdef HAVE_KF
0030 #include "kbibtexio_export.h"
0031 #endif // HAVE_KF
0032 
0033 class Entry;
0034 class Macro;
0035 class Comment;
0036 
0037 /**
0038  * @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
0039  */
0040 class KBIBTEXIO_EXPORT FileExporterXML : public FileExporter
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     explicit FileExporterXML(QObject *parent);
0046     ~FileExporterXML() override;
0047 
0048     enum class OutputStyle {XML_KBibTeX, HTML_Standard, HTML_AbstractOnly, Plain_WikipediaCite};
0049     void setOutputStyle(OutputStyle outputStyle);
0050 
0051     bool save(QIODevice *iodevice, const File *bibtexfile) override;
0052     bool save(QIODevice *iodevice, const QSharedPointer<const Element> &element, const File *bibtexfile) override;
0053 
0054 private:
0055     class Private;
0056     Private *d;
0057 };
0058 
0059 Q_DECLARE_METATYPE(FileExporterXML::OutputStyle);
0060 
0061 inline size_t qHash(FileExporterXML::OutputStyle outputStyle, size_t seed = 0) {
0062     return ::qHash(static_cast<uint>(outputStyle), seed);
0063 }
0064 
0065 KBIBTEXIO_EXPORT QDebug operator<<(QDebug dbg, FileExporterXML::OutputStyle outputStyle);
0066 
0067 #endif // KBIBTEX_IO_FILEEXPORTERXML_H