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

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2018 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_ENCODERXML_H
0021 #define KBIBTEX_IO_ENCODERXML_H
0022 
0023 #include <Encoder>
0024 
0025 #ifdef HAVE_KF
0026 #include "kbibtexio_export.h"
0027 #endif // HAVE_KF
0028 
0029 class QString;
0030 
0031 /**
0032  * Base class for that convert between different textual representations
0033  * for non-ASCII characters, specialized for XML.
0034  * Example for a character to convert is &auml;.
0035  * @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
0036  */
0037 class KBIBTEXIO_EXPORT EncoderXML : public Encoder
0038 {
0039 public:
0040     ~EncoderXML() override;
0041 
0042     QString decode(const QString &text) const override;
0043     QString encode(const QString &text, const TargetEncoding targetEncoding) const override;
0044 
0045     static const EncoderXML &instance();
0046 
0047 protected:
0048     EncoderXML();
0049 
0050 private:
0051     Q_DISABLE_COPY(EncoderXML)
0052 
0053     class EncoderXMLPrivate;
0054     EncoderXMLPrivate *const d;
0055 };
0056 
0057 #endif // KBIBTEX_IO_ENCODERXML_H