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

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2019 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_DATA_PREAMBLE_H
0021 #define KBIBTEX_DATA_PREAMBLE_H
0022 
0023 #include <Element>
0024 #include <Value>
0025 
0026 /**
0027  * This class represents a preamble in a BibTeX file. Preables contain
0028  * LaTeX commands required for the bibliography, such as hyphenation commands.
0029  * @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
0030  */
0031 class KBIBTEXDATA_EXPORT Preamble : public Element
0032 {
0033 public:
0034     explicit Preamble(const Value &value = Value());
0035     Preamble(const Preamble &other);
0036     ~Preamble() override;
0037 
0038     bool operator==(const Preamble &other) const;
0039     bool operator!=(const Preamble &other) const;
0040 
0041     /**
0042      * Assignment operator, working similar to a copy constructor,
0043      * but overwrites the current object's values.
0044      */
0045     Preamble &operator= (const Preamble &other);
0046 
0047     Value &value();
0048     const Value &value() const;
0049     void setValue(const Value &value);
0050 
0051     // bool containsPattern(const QString& pattern, Field::FieldType fieldType = Field::ftUnknown, FilterType filterType = Element::ftExact, Qt::CaseSensitivity caseSensitive = Qt::CaseInsensitive) const; // FIXME: Rewrite filtering code
0052 
0053     /**
0054      * Cheap and fast test if another Element is a Preamble object.
0055      * @param other another Element object to test
0056      * @return true if Element is actually a Preamble
0057      */
0058     static bool isPreamble(const Element &other);
0059 
0060 private:
0061     class PreamblePrivate;
0062     PreamblePrivate *const d;
0063 };
0064 
0065 KBIBTEXDATA_EXPORT QDebug operator<<(QDebug dbg, const Preamble &preamble);
0066 
0067 #endif // KBIBTEX_DATA_PREAMBLE_H