KTnef

ktnefpropertyset.h
Go to the documentation of this file.
1/*
2 ktnefpropertyset.h
3
4 SPDX-FileCopyrightText: 2002 Michael Goffioul <kdeprint@swing.be>
5
6 This file is part of KTNEF, the KDE TNEF support library/program.
7
8 SPDX-License-Identifier: LGPL-2.0-or-later
9 */
10/**
11 * @file
12 * This file is part of the API for handling TNEF data and
13 * defines the KTNEFPropertySet class.
14 *
15 * @author Michael Goffioul
16 */
17
18#pragma once
19
20#include "ktnef_export.h"
21#include <QMap>
22#include <QVariant>
23#include <memory>
24class KTNEFPropertySetPrivate;
25namespace KTnef
26{
27class KTNEFProperty;
28}
29
30namespace KTnef
31{
32/**
33 * @brief
34 * Interface for setting @acronym MAPI properties and @acronym TNEF attributes.
35 */
36class KTNEF_EXPORT KTNEFPropertySet
37{
38public:
39 /**
40 Constructor.
41 */
43
44 /**
45 Destructor.
46 */
48
49 /**
50 Adds a @acronym MAPI property.
51
52 @param key is the property key.
53 @param type is the property type.
54 @param value is the property value.
55 @param name is the property name.
56 @param overwrite if true, then remove the property if it already exists.
57 */
58 void addProperty(int key, int type, const QVariant &value, const QVariant &name = QVariant(), bool overwrite = false);
59
60 /**
61 Finds a property by @p key, returning a formatted value.
62
63 @param key is the property key.
64 @param fallback is the fallback formatted value to use if the @p key
65 is not found.
66 @param convertToUpper if true, then return the formatted value in all
67 upper case characters.
68
69 @return a formatted value string.
70 */
71 [[nodiscard]] QString findProp(int key, const QString &fallback = QString(), bool convertToUpper = false) const;
72
73 /**
74 Finds a property by @p name, returning a formatted value.
75
76 @param name is the property name.
77 @param fallback is the fallback formatted value to use if the @p name
78 is not found.
79 @param convertToUpper if true, then return the formatted value in all
80 upper case characters.
81
82 @return a formatted value string.
83 */
84 [[nodiscard]] QString findNamedProp(const QString &name, const QString &fallback = QString(), bool convertToUpper = false) const;
85
86 /**
87 Returns a #QMap of all (key,@acronym MAPI) properties
88 */
89 QMap<int, KTNEFProperty *> &properties();
90
91 /**
92 Returns a #QMap of all (key,@acronym MAPI) properties
93 */
94 const QMap<int, KTNEFProperty *> &properties() const; // krazy:exclude=constref
95
96 /**
97 Returns the property associated with the specified @p key.
98
99 @param key is the property key.
100
101 @return the property.q
102 */
103 [[nodiscard]] QVariant property(int key) const;
104
105 /**
106 Adds a @acronym TNEF attribute.
107
108 @param key is the attribute key.
109 @param type is the attribute type.
110 @param value is the attribute value.
111 @param overwrite if true, then remove the attribute if it already exists.
112 */
113 void addAttribute(int key, int type, const QVariant &value, bool overwrite = false);
114
115 /**
116 Returns a #QMap of all (key,@acronym TNEF) attributes.
117 */
118 [[nodiscard]] QMap<int, KTNEFProperty *> &attributes();
119
120 /**
121 Returns a #QMap of all (key,@acronym TNEF) attributes.
122 */
123 const QMap<int, KTNEFProperty *> &attributes() const; // krazy:exclude=constref
124
125 /**
126 Returns the attribute associated with the specified @p key.
127
128 @param key is the @acronym TNEF key.
129
130 @return the attribute associated with the key.
131 */
132 [[nodiscard]] QVariant attribute(int key) const;
133
134 /**
135 Clears the @acronym MAPI and @acronym TNEF maps.
136
137 @param deleteAll if true, delete the map memory as well.
138 */
139 void clear(bool deleteAll = false);
140
141private:
142 //@cond PRIVATE
143 std::unique_ptr<KTNEFPropertySetPrivate> const d;
144 //@endcond
145
146 Q_DISABLE_COPY(KTNEFPropertySet)
147};
148
149}
Interface for setting MAPI properties and TNEF attributes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:57:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.