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 | #include "kuitsetup.h" |
13 | |
14 | class KuitFormatter; |
15 | class KuitFormatterPrivate; |
16 | |
17 | namespace Kuit |
18 | { |
19 | /*! |
20 | * Convert &, ", ', <, > characters into XML entities |
21 | * &, <, >, ', ", respectively. |
22 | */ |
23 | QString escape(const QString &text); |
24 | } |
25 | |
26 | /*! |
27 | * \internal |
28 | * (used by KLocalizedString) |
29 | * |
30 | * Class for formatting KUIT markup in UI messages |
31 | * |
32 | * KuitFormatter resolves KUIT markup in user interface text |
33 | * into appropriate visual formatting. |
34 | */ |
35 | class KuitFormatter |
36 | { |
37 | public: |
38 | /*! |
39 | * Constructor. |
40 | * |
41 | * \a language language to create the formatter for |
42 | */ |
43 | KuitFormatter(const QString &language); |
44 | |
45 | /*! |
46 | * Transforms KUIT markup in the given text into visual formatting. |
47 | * The appropriate visual formatting is decided based on |
48 | * the context marker provided in the context string. |
49 | * |
50 | * \a domain translation domain from which the text was fetched |
51 | * |
52 | * \a context context of the text (used if \a format == UndefinedFormat) |
53 | * |
54 | * \a text text containing the KUIT markup |
55 | * |
56 | * \a format target visual format |
57 | * |
58 | * \a isArgument whether this text is inserted into an outer text |
59 | */ |
60 | QString format(const QByteArray &domain, const QString &context, const QString &text, Kuit::VisualFormat format) const; |
61 | |
62 | /*! |
63 | * Destructor. |
64 | */ |
65 | ~KuitFormatter(); |
66 | |
67 | private: |
68 | KuitFormatter(const KuitFormatter &t); |
69 | KuitFormatter &operator=(const KuitFormatter &t); |
70 | |
71 | KuitFormatterPrivate *d; |
72 | }; |
73 | |
74 | #endif |
75 | |