KTnef

ktnefproperty.h
Go to the documentation of this file.
1/*
2 ktnefproperty.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 KTNEFProperty class.
14 *
15 * @author Michael Goffioul
16 */
17
18#pragma once
19
20#include "ktnef_export.h"
21#include <QString>
22#include <QVariant>
23#include <memory>
24class KTNEFPropertyPrivate;
25namespace KTnef
26{
27/**
28 * @brief
29 * Interface for setting @acronym MAPI properties.
30 */
31class KTNEF_EXPORT KTNEFProperty
32{
33public:
34 /**
35 * The different @acronym MAPI types.
36 */
37 enum MAPIType {
38 UInt16 = 0x0002, /**< 16-bit unsigned integer */
39 ULong = 0x0003, /**< unsigned long integer */
40 Float = 0x0004, /**< single precision floating point */
41 Double = 0x0005, /**< double precision floating point */
42 Boolean = 0x000B, /**< a boolean value */
43 Object = 0x000D, /**< an object */
44 Time = 0x0040, /**< a time value */
45 String8 = 0x001E, /**< a string of 8 characters */
46 UString = 0x001F, /**< a string of characters */
47 Binary = 0x0102 /**< a binary value */
48 };
49
50 /**
51 * Constructs a @acronym TNEF property.
52 */
54
55 /**
56 * Constructs a @acronym TNEF property initialized with specified settings.
57 *
58 * @param key_ is the property key.
59 * @param type_ is the property type.
60 * @param value_ is the property value.
61 * @param name_ is the property name.
62 */
63 KTNEFProperty(int key_, int type_, const QVariant &value_, const QVariant &name_ = QVariant());
64
65 /**
66 * Constructs a @acronym TNEF property with settings from another property.
67 *
68 * @param p is a #KTNEFProperty.
69 */
71
72 /**
73 * Destroys the property.
74 */
76
77 KTNEFProperty &operator=(const KTNEFProperty &other);
78
79 /**
80 * Returns the key string of the property.
81 *
82 * @return the key string.
83 */
84 [[nodiscard]] QString keyString() const;
85
86 /**
87 * Returns the value string of the property.
88 *
89 * @return the value string.
90 */
91 [[nodiscard]] QString valueString() const;
92
93 /**
94 * Creates a formatted string from the value of the property.
95 *
96 * @param v is the property value.
97 * @param beautify if true uses a prettier format
98 *
99 * @return the formatted value string.
100 */
101 [[nodiscard]] static QString formatValue(const QVariant &v, bool beautify = true);
102
103 /**
104 * Returns the integer key of the property.
105 *
106 * @return the property key.
107 */
108 [[nodiscard]] int key() const;
109
110 /**
111 * Returns the integer type of the property.
112 *
113 * @return the property type.
114 */
115 [[nodiscard]] int type() const;
116
117 /**
118 * Returns the value of the property.
119 *
120 * @return the property value.
121 */
122 [[nodiscard]] QVariant value() const;
123
124 /**
125 * Returns the name of the property.
126 *
127 * @return the property name.
128 */
129 [[nodiscard]] QVariant name() const;
130
131 /**
132 * Determines if the property is a vector type.
133 *
134 * @returns true if the property is a vector type; otherwise false.
135 */
136 [[nodiscard]] bool isVector() const;
137
138private:
139 //@cond PRIVATE
140 std::unique_ptr<KTNEFPropertyPrivate> const d;
141 //@endcond
142};
143
144}
Interface for setting MAPI properties.
int type() const
Returns the integer type of the property.
QString valueString() const
Returns the value string of the property.
int key() const
Returns the integer key of the property.
bool isVector() const
Determines if the property is a vector type.
MAPIType
The different MAPI types.
@ UString
a string of characters
@ UInt16
16-bit unsigned integer
@ Float
single precision floating point
@ Boolean
a boolean value
@ String8
a string of 8 characters
@ Double
double precision floating point
@ Binary
a binary value
@ ULong
unsigned long integer
QVariant name() const
Returns the name of the property.
QVariant value() const
Returns the value of the property.
KTNEFProperty()
Constructs a TNEF property.
~KTNEFProperty()
Destroys the property.
static QString formatValue(const QVariant &v, bool beautify=true)
Creates a formatted string from the value of the property.
QString keyString() const
Returns the key string of the property.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:50:48 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.