KMIME Library
kmime_content.h
Go to the documentation of this file.
A class to uniquely identify message parts (Content) in a hierarchy.
Definition kmime_contentindex.h:55
Headers::ContentDescription * contentDescription(bool create=true)
Returns the Content-Description header.
bool hasContent() const
Returns true if this Content object is not empty.
Definition kmime_content.cpp:100
Headers::ContentType * contentType(bool create=true)
Returns the Content-Type header.
QString decodedText(bool trimText=false, bool removeTrailingNewlines=false)
Returns the decoded text.
Definition kmime_content.cpp:433
virtual void setHeader(Headers::Base *h)
Sets the specified header to this Content.
Definition kmime_content.cpp:748
QByteArray encodedBody()
Like encodedContent(), with the difference that only the body will be returned, i....
Definition kmime_content.cpp:322
Content * topLevel() const
Returns the toplevel content object, 0 if there is no such object.
Definition kmime_content.cpp:979
virtual Headers::Base * headerByType(const char *type)
Returns the first header of type type, if it exists.
Definition kmime_content.cpp:720
KMIME_DEPRECATED QByteArray rawHeader(const char *name) const
Returns the raw string representing the header of type name.
Definition kmime_content.cpp:836
void clearContents(bool del=true)
Removes all sub-Contents from this content.
Definition kmime_content.cpp:289
int storageSize() const
Returns the size of this Content and all sub-Contents.
Definition kmime_content.cpp:801
virtual KMIME_DEPRECATED Headers::Base * getHeaderByType(const char *type)
Tries to find a type header in the Content and returns it.
Definition kmime_content.cpp:715
KMIME_DEPRECATED Headers::Generic * getNextHeader(QByteArray &head)
Extracts and removes the next header from head.
Definition kmime_content.cpp:693
ContentIndex index() const
Returns the index of this Content based on the topLevel() object.
Definition kmime_content.cpp:991
virtual QList< Headers::Base * > headersByType(const char *type)
Returns all type headers in the Content.
Definition kmime_content.cpp:733
void removeContent(Content *content, bool del=false)
Removes the given sub-Content.
Definition kmime_content.cpp:611
Headers::ContentTransferEncoding * contentTransferEncoding(bool create=true)
Returns the Content-Transfer-Encoding header.
List attachments(bool incAlternatives=false)
Returns a list of attachments.
Definition kmime_content.cpp:507
Content * parent() const
Returns the parent content object, or 0 if the content doesn't have a parent.
Definition kmime_content.cpp:974
void setDefaultCharset(const QByteArray &cs)
Sets the default charset.
Definition kmime_content.cpp:886
boost::shared_ptr< Message > bodyAsMessage() const
If this content is an encapsulated message, in which case bodyIsMessage() will return true,...
Definition kmime_content.cpp:1001
KMIME_DEPRECATED Headers::Generic * nextHeader(QByteArray &head)
Extracts and removes the next header from head.
Definition kmime_content.cpp:698
Headers::ContentDisposition * contentDisposition(bool create=true)
Returns the Content-Disposition header.
void setContent(const QList< QByteArray > &l)
Sets the Content to the given raw data, containing the Content head and body separated by two linefee...
Definition kmime_content.cpp:105
void addContent(Content *content, bool prepend=false)
Adds a new sub-Content.
Definition kmime_content.cpp:537
Content * textContent()
Returns the first Content with mimetype text/.
Definition kmime_content.cpp:490
KMIME_DEPRECATED T * headerInstance(T *ptr, bool create)
Returns the first header of type T, if it exists.
Content * content(const ContentIndex &index) const
Returns the Content specified by the given index.
Definition kmime_content.cpp:917
virtual bool removeHeader(const char *type)
Searches for the first header of type type, and deletes it, removing it from this Content.
Definition kmime_content.cpp:767
void prependHeader(Headers::Base *h)
Prepends the specified header to the headers of this Content.
Definition kmime_content.cpp:761
virtual bool isTopLevel() const
Returns true if this is the top-level node in the MIME tree.
Definition kmime_content.cpp:951
QByteArray encodedContent(bool useCrLf=false)
Returns a QByteArray containing the encoded Content, including the Content header and all sub-Content...
Definition kmime_content.cpp:299
void toStream(QTextStream &ts, bool scrambleFromLines=false)
Saves the encoded Content to the given textstream.
Definition kmime_content.cpp:680
int lineCount() const
Line count of this Content and all sub-Contents.
Definition kmime_content.cpp:820
T * header(bool create=false)
Returns the first header of type T, if it exists.
Definition kmime_content.h:836
QByteArray defaultCharset() const
Returns the charset that is used to decode RFC2047 strings in all headers and to decode the body if t...
Definition kmime_content.cpp:881
KMIME_DEPRECATED QList< QByteArray > rawHeaders(const char *name) const
Returns a list of raw strings representing all header of type name.
Definition kmime_content.cpp:841
ContentIndex indexForContent(Content *content) const
Returns the ContentIndex for the given Content, or an invalid index if the Content is not found withi...
Definition kmime_content.cpp:931
virtual void setForceDefaultCharset(bool b)
Enables/disables the force mode, housekeeping.
Definition kmime_content.cpp:904
Headers::ContentID * contentID(bool create=true)
Returns the Content-ID header.
virtual QByteArray assembleHeaders()
Reimplement this method if you need to assemble additional headers in a derived class.
Definition kmime_content.cpp:267
void setFrozen(bool frozen=true)
Freezes this Content if frozen is true; otherwise unfreezes it.
Definition kmime_content.cpp:249
virtual void clear()
Clears the content, deleting all headers and sub-Contents.
Definition kmime_content.cpp:279
List contents() const
For multipart contents, this will return a list of all multipart child contents.
Definition kmime_content.cpp:532
Headers::ContentLocation * contentLocation(bool create=true)
Returns the Content-Location header.
bool forceDefaultCharset() const
Use the default charset even if a different charset is declared in the article.
Definition kmime_content.cpp:899
void setParent(Content *parent)
Sets a new parent to the Content and add to its contents list.
Definition kmime_content.cpp:956
void changeEncoding(Headers::contentEncoding e)
Changes the encoding of this Content to e.
Definition kmime_content.cpp:650
void fromUnicodeString(const QString &s)
Sets the Content body to the given string using charset of the content type.
Definition kmime_content.cpp:474
void setHead(const QByteArray &head)
Sets the Content header raw data.
Definition kmime_content.cpp:145
void appendHeader(Headers::Base *h)
Appends the specified header to the headers of this Content.
Definition kmime_content.cpp:755
Represents a "Content-Description" header.
Definition kmime_headers.h:1287
Represents a "Content-Disposition" header.
Definition kmime_headers.h:1183
Represents a "Content-Location" header.
Definition kmime_headers.h:1296
Represents a "Content-Transfer-Encoding" header.
Definition kmime_headers.h:891
Represents an arbitrary header, that can contain any header-field.
Definition kmime_headers.h:1240
This file is part of the API for handling MIME data and defines the ContentIndex class.
This file is part of the API for handling MIME data and defines the various header classes:
contentEncoding
Various possible values for the "Content-Transfer-Encoding" header.
Definition kmime_headers.h:74
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.