KTnef

ktnefattach.cpp
Go to the documentation of this file.
1 /*
2  ktnefattach.cpp
3 
4  SPDX-FileCopyrightText: 2002 Michael Goffioul <[email protected]>
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  */
18 #include "ktnefattach.h"
19 #include "ktnefproperty.h"
20 
21 using namespace KTnef;
22 
27 //@cond PRIVATE
28 class KTnef::KTNEFAttach::AttachPrivate
29 {
30 public:
31  int state_;
32  int size_;
33  int offset_;
34  int displaysize_;
35  QString name_;
36  int index_;
37  QString filename_;
38  QString displayname_;
39  QString mimetag_;
40  QString extension_;
41 };
42 //@endcond
43 
44 KTNEFAttach::KTNEFAttach() : d(new KTnef::KTNEFAttach::AttachPrivate)
45 {
46  d->state_ = Unparsed;
47  d->offset_ = -1;
48  d->size_ = 0;
49  d->displaysize_ = 0;
50  d->index_ = -1;
51 }
52 
54 {
55  delete d;
56 }
57 
59 {
60  d->state_ |= TitleParsed;
61 }
62 
64 {
65  d->state_ |= DataParsed;
66 }
67 
69 {
70  d->state_ = (d->state_ & ~DataParsed);
71 }
72 
74 {
75  d->state_ |= InfoParsed;
76 }
77 
79 {
80  return d->state_ & TitleParsed;
81 }
82 
84 {
85  return d->state_ & DataParsed;
86 }
87 
89 {
90  return d->state_ & InfoParsed;
91 }
92 
93 bool KTNEFAttach::checkState(int state) const
94 {
95  return d->state_ & state;
96 }
97 
99 {
100  return d->offset_;
101 }
102 
104 {
105  setDataParsed();
106  d->offset_ = n;
107 }
108 
109 int KTNEFAttach::size() const
110 {
111  return d->size_;
112 }
113 
115 {
116  d->size_ = s;
117 }
118 
120 {
121  return d->displaysize_;
122 }
123 
125 {
126  d->displaysize_ = s;
127 }
128 
130 {
131  return d->name_;
132 }
133 
135 {
136  setTitleParsed();
137  d->name_ = str;
138 }
139 
141 {
142  return d->index_;
143 }
144 
146 {
147  setInfoParsed();
148  d->index_ = i;
149 }
150 
152 {
153  return d->filename_;
154 }
155 
157 {
158  d->filename_ = str;
159 }
160 
162 {
163  return d->displayname_;
164 }
165 
167 {
168  d->displayname_ = str;
169 }
170 
172 {
173  return d->mimetag_;
174 }
175 
177 {
178  d->mimetag_ = str;
179 }
180 
182 {
183  return d->extension_;
184 }
185 
187 {
188  d->extension_ = str;
189 }
int index() const
Returns the index of the attachment.
bool titleParsed() const
Returns true if the TitleParsed flag is set; else returns false.
Definition: ktnefattach.cpp:78
void setOffset(int offset)
Sets the offset value of this attachment to offset.
int displaySize() const
Returns the display size of the attachment.
void setDisplaySize(int size)
Sets the display size of the attachment to size.
bool infoParsed() const
Returns true if the InfoParsed flag is set; else returns false.
Definition: ktnefattach.cpp:88
void setInfoParsed()
Sets the InfoParsed flag for this attachment.
Definition: ktnefattach.cpp:73
bool dataParsed() const
Returns true if the ParseState::DataParsed flag is set; else returns false.
Definition: ktnefattach.cpp:83
void setExtension(const QString &str)
Sets the filename extension of this attachment to str.
bool checkState(int state) const
Sets/Unsets the attachment state according to the state flag must be a ParseState type...
Definition: ktnefattach.cpp:93
QString displayName() const
Returns the display name of the attachment.
int size() const
Returns the size of the attachment.
void setDataParsed()
Sets the DataParsed flag for this attachment.
Definition: ktnefattach.cpp:63
QString fileName() const
Returns the filename of the attachment.
void setMimeTag(const QString &str)
Sets the MIME tag of this attachment to str.
void setFileName(const QString &str)
Sets the filename of this attachment to str.
void unsetDataParser()
Unsets the DataParsed flag for this attachment.
Definition: ktnefattach.cpp:68
Represents a TNEF attachment.
Definition: ktnefattach.h:38
QString extension() const
Returns the filename extension of the attachment.
void setName(const QString &str)
Sets the name of this attachment to str.
The title is parsed.
Definition: ktnefattach.h:46
void setTitleParsed()
Sets the TitleParsed flag for this attachment.
Definition: ktnefattach.cpp:58
KTNEFAttach()
Constructs a TNEF attachment.
Definition: ktnefattach.cpp:44
This file is part of the API for handling TNEF data and defines the KTNEFProperty class...
void setSize(int size)
Sets the size of the attachment to size.
~KTNEFAttach()
Destroys the TNEF attachment.
Definition: ktnefattach.cpp:53
The info is parsed.
Definition: ktnefattach.h:48
int offset() const
Returns the offset value of the attachment.
Definition: ktnefattach.cpp:98
The data is parsed.
Definition: ktnefattach.h:47
This file is part of the API for handling TNEF data and defines the KTNEFAttach class.
void setIndex(int indx)
Sets the index of this attachment to indx.
QString name() const
Returns the name of the attachment.
void setDisplayName(const QString &str)
Sets the display name of this attachment to str.
QString mimeTag() const
Returns the MIME tag of the attachment.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:21:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.