1/*
2 ktnefproperty.h
3
4 Copyright (C) 2002 Michael Goffioul <kdeprint@swing.be>
5
6 This file is part of KTNEF, the KDE TNEF support library/program.
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22 */
23/**
24 * @file
25 * This file is part of the API for handling TNEF data and
26 * defines the KTNEFProperty class.
27 *
28 * @author Michael Goffioul
29 */
30
31#ifndef KTNEFPROPERTY_H
32#define KTNEFPROPERTY_H
33
34#include <QtCore/QVariant>
35#include <QtCore/QString>
36#include "ktnef_export.h"
37
38namespace KTnef {
39
40/**
41 * @brief
42 * Interface for setting @acronym MAPI properties.
43 */
44class KTNEF_EXPORT KTNEFProperty
45{
46 public:
47 /**
48 * The different @acronym MAPI types.
49 */
50 enum MAPIType {
51 UInt16 = 0x0002, /**< 16-bit unsigned integer */
52 ULong = 0x0003, /**< unsigned long integer */
53 Float = 0x0004, /**< single precision floating point */
54 Double = 0x0005, /**< double precision floating point */
55 Boolean = 0x000B, /**< a boolean value */
56 Object = 0x000D, /**< an object */
57 Time = 0x0040, /**< a time value */
58 String8 = 0x001E, /**< a string of 8 characters */
59 UString = 0x001F, /**< a string of characters */
60 Binary = 0x0102 /**< a binary value */
61 };
62
63 /**
64 * Constructs a @acronym TNEF property.
65 */
66 KTNEFProperty();
67
68 /**
69 * Constructs a @acronym TNEF property initialized with specified settings.
70 *
71 * @param key_ is the property key.
72 * @param type_ is the property type.
73 * @param value_ is the property value.
74 * @param name_ is the property name.
75 */
76 KTNEFProperty( int key_, int type_, const QVariant &value_,
77 const QVariant &name_ = QVariant() );
78
79 /**
80 * Constructs a @acronym TNEF property with settings from another property.
81 *
82 * @param p is a #KTNEFProperty.
83 */
84 KTNEFProperty( const KTNEFProperty &p );
85
86 /**
87 * Destroys the property.
88 */
89 ~KTNEFProperty();
90
91 KTNEFProperty &operator=( const KTNEFProperty &other );
92
93 /**
94 * Returns the key string of the property.
95 *
96 * @return the key string.
97 */
98 QString keyString() const;
99
100 /**
101 * Returns the value string of the property.
102 *
103 * @return the value string.
104 */
105 QString valueString() const;
106
107 /**
108 * Creates a formatted string from the value of the property.
109 *
110 * @param v is the property value.
111 * @param beautify if true uses a prettier format
112 *
113 * @return the formatted value string.
114 */
115 static QString formatValue( const QVariant &v, bool beautify=true );
116
117 /**
118 * Returns the integer key of the property.
119 *
120 * @return the property key.
121 */
122 int key() const;
123
124 /**
125 * Returns the integer type of the property.
126 *
127 * @return the property type.
128 */
129 int type() const;
130
131 /**
132 * Returns the value of the property.
133 *
134 * @return the property value.
135 */
136 QVariant value() const;
137
138 /**
139 * Returns the name of the property.
140 *
141 * @return the property name.
142 */
143 QVariant name() const;
144
145 /**
146 * Determines if the property is a vector type.
147 *
148 * @returns true if the property is a vector type; otherwise false.
149 */
150 bool isVector() const;
151
152 private:
153 //@cond PRIVATE
154 class Private;
155 Private *const d;
156 //@endcond
157};
158
159}
160#endif
161