1 | /* This file is part of the KDE libraries |
2 | SPDX-FileCopyrightText: 2007, 2013 Chusslove Illich <caslav.ilic@gmx.net> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #ifndef KUITSETUP_P_H |
8 | #define KUITSETUP_P_H |
9 | |
10 | #include <QString> |
11 | |
12 | class KuitFormatter; |
13 | class KuitFormatterPrivate; |
14 | |
15 | namespace Kuit |
16 | { |
17 | /** |
18 | * Convert &, ", ', <, > characters into XML entities |
19 | * &, <, >, ', ", respectively. |
20 | */ |
21 | QString escape(const QString &text); |
22 | } |
23 | |
24 | /** |
25 | * @internal |
26 | * (used by KLocalizedString) |
27 | * |
28 | * KuitFormatter resolves KUIT markup in user interface text |
29 | * into appropriate visual formatting. |
30 | * |
31 | * @author Chusslove Illich <caslav.ilic@gmx.net> |
32 | * @short class for formatting KUIT markup in UI messages |
33 | */ |
34 | class KuitFormatter |
35 | { |
36 | public: |
37 | /** |
38 | * Constructor. |
39 | * |
40 | * @param language language to create the formatter for |
41 | */ |
42 | KuitFormatter(const QString &language); |
43 | |
44 | /** |
45 | * Transforms KUIT markup in the given text into visual formatting. |
46 | * The appropriate visual formatting is decided based on |
47 | * the context marker provided in the context string. |
48 | * |
49 | * @param domain translation domain from which the text was fetched |
50 | * @param context context of the text (used if \p format == UndefinedFormat) |
51 | * @param text text containing the KUIT markup |
52 | * @param format target visual format |
53 | * @param isArgument whether this text is inserted into an outer text |
54 | */ |
55 | QString format(const QByteArray &domain, const QString &context, const QString &text, Kuit::VisualFormat format) const; |
56 | |
57 | /** |
58 | * Destructor. |
59 | */ |
60 | ~KuitFormatter(); |
61 | |
62 | private: |
63 | KuitFormatter(const KuitFormatter &t); |
64 | KuitFormatter &operator=(const KuitFormatter &t); |
65 | |
66 | KuitFormatterPrivate *d; |
67 | }; |
68 | |
69 | #endif |
70 | |