File indexing completed on 2024-05-19 07:43:27
0001 /* This file is part of the KDE libraries 0002 SPDX-FileCopyrightText: 2007, 2013 Chusslove Illich <caslav.ilic@gmx.net> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KUITSETUP_P_H 0008 #define KUITSETUP_P_H 0009 0010 #include <QString> 0011 0012 class KuitFormatter; 0013 class KuitFormatterPrivate; 0014 0015 namespace Kuit 0016 { 0017 /** 0018 * Convert &, ", ', <, > characters into XML entities 0019 * &, <, >, ', ", respectively. 0020 */ 0021 QString escape(const QString &text); 0022 } 0023 0024 /** 0025 * @internal 0026 * (used by KLocalizedString) 0027 * 0028 * KuitFormatter resolves KUIT markup in user interface text 0029 * into appropriate visual formatting. 0030 * 0031 * @author Chusslove Illich <caslav.ilic@gmx.net> 0032 * @short class for formatting KUIT markup in UI messages 0033 */ 0034 class KuitFormatter 0035 { 0036 public: 0037 /** 0038 * Constructor. 0039 * 0040 * @param language language to create the formatter for 0041 */ 0042 KuitFormatter(const QString &language); 0043 0044 /** 0045 * Transforms KUIT markup in the given text into visual formatting. 0046 * The appropriate visual formatting is decided based on 0047 * the context marker provided in the context string. 0048 * 0049 * @param domain translation domain from which the text was fetched 0050 * @param context context of the text (used if \p format == UndefinedFormat) 0051 * @param text text containing the KUIT markup 0052 * @param format target visual format 0053 * @param isArgument whether this text is inserted into an outer text 0054 */ 0055 QString format(const QByteArray &domain, const QString &context, const QString &text, Kuit::VisualFormat format) const; 0056 0057 /** 0058 * Destructor. 0059 */ 0060 ~KuitFormatter(); 0061 0062 private: 0063 KuitFormatter(const KuitFormatter &t); 0064 KuitFormatter &operator=(const KuitFormatter &t); 0065 0066 KuitFormatterPrivate *d; 0067 }; 0068 0069 #endif