KMime
kmime_content.cpp
Go to the documentation of this file.
131 if (ct->isEmpty()) { //Set default content-type as defined in https://tools.ietf.org/html/rfc2045#page-10 (5.2. Content-Type Defaults)
955 // uup.binaryParts().at(i) does no longer have the uuencode header, which makes KCodecs fail since 5c66308c4786ef7fbf77b0e306e73f7d4ac3431b
virtual qsizetype maxEncodedSizeFor(qsizetype insize, NewlineType newline=NewlineLF) const=0
static Codec * codecForName(QByteArrayView name)
virtual Decoder * makeDecoder(NewlineType newline=NewlineLF) const=0
virtual qsizetype maxDecodedSizeFor(qsizetype insize, NewlineType newline=NewlineLF) const=0
A class to uniquely identify message parts (Content) in a hierarchy.
Definition kmime_contentindex.h:41
bool isValid() const
Returns true if this index is non-empty (valid).
Definition kmime_contentindex.cpp:58
bool hasContent() const
Returns true if this Content object is not empty.
Definition kmime_content.cpp:57
bool removeHeader()
Searches for the first header of type T, and deletes it, removing it from this Content.
Definition kmime_content.h:730
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:364
void setHeader(Headers::Base *h)
Sets the specified header to this Content.
Definition kmime_content.cpp:669
QByteArray encodedBody()
Like encodedContent(), with the difference that only the body will be returned, i....
Definition kmime_content.cpp:252
Content * topLevel() const
Returns the toplevel content object, 0 if there is no such object.
Definition kmime_content.cpp:838
void clearContents(bool del=true)
Removes all sub-Contents from this content.
Definition kmime_content.cpp:219
int storageSize() const
Returns the size of this Content and all sub-Contents.
Definition kmime_content.cpp:718
Content * takeContent(Content *content)
Removes the given sub-Content and, if that actually was a sub-content returns that.
Definition kmime_content.cpp:595
ContentIndex index() const
Returns the index of this Content based on the topLevel() object.
Definition kmime_content.cpp:850
void removeContent(Content *content, bool del=false)
Removes the given sub-Content.
Definition kmime_content.cpp:556
Headers::ContentTransferEncoding * contentTransferEncoding(bool create=true)
Returns the Content-Transfer-Encoding header.
Content * parent() const
Returns the parent content object, or 0 if the content doesn't have a parent.
Definition kmime_content.cpp:833
QSharedPointer< Message > bodyAsMessage() const
If this content is an encapsulated message, in which case bodyIsMessage() will return true,...
Definition kmime_content.cpp:860
void addContent(Content *content, bool prepend=false)
Adds a new sub-Content.
Definition kmime_content.cpp:473
Content * textContent()
Returns the first Content with mimetype text/.
Definition kmime_content.cpp:416
Content * content(const ContentIndex &index) const
Returns the Content specified by the given index.
Definition kmime_content.cpp:776
bool isTopLevel() const
Returns true if this is the top-level node in the MIME tree.
Definition kmime_content.cpp:810
QByteArray encodedContent(bool useCrLf=false)
Returns a QByteArray containing the encoded Content, including the Content header and all sub-Content...
Definition kmime_content.cpp:229
static QByteArray defaultCharset()
Returns the charset that is used to decode RFC2047 strings in all headers and to decode the body if t...
Definition kmime_content.cpp:771
T * header(bool create=false)
Returns the first header of type T, if it exists.
Definition kmime_content.h:717
QList< Headers::Base * > headersByType(const char *type) const
Returns all type headers in the Content.
Definition kmime_content.cpp:655
Content(Content *parent=nullptr)
Creates an empty Content object with a specified parent.
Definition kmime_content.cpp:42
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:790
void setContent(const QByteArray &s)
Sets the Content to the given raw data, containing the Content head and body separated by two linefee...
Definition kmime_content.cpp:62
Headers::Base * headerByType(const char *type) const
Returns the first header of type type, if it exists.
Definition kmime_content.cpp:642
virtual QByteArray assembleHeaders()
Reimplement this method if you need to assemble additional headers in a derived class.
Definition kmime_content.cpp:196
void setFrozen(bool frozen=true)
Freezes this Content if frozen is true; otherwise unfreezes it.
Definition kmime_content.cpp:177
void clear()
Clears the content, deleting all headers and sub-Contents.
Definition kmime_content.cpp:209
QList< Content * > contents() const
For multipart contents, this will return a list of all multipart child contents.
Definition kmime_content.cpp:454
void setParent(Content *parent)
Sets a new parent to the Content and add to its contents list.
Definition kmime_content.cpp:815
QList< Content * > attachments()
Returns all attachments below this node, recursively.
Definition kmime_content.cpp:434
void changeEncoding(Headers::contentEncoding e)
Changes the encoding of this Content to e.
Definition kmime_content.cpp:611
void fromUnicodeString(const QString &s)
Sets the Content body to the given string using charset of the content type.
Definition kmime_content.cpp:402
void setHead(const QByteArray &head)
Sets the Content header raw data.
Definition kmime_content.cpp:73
void appendHeader(Headers::Base *h)
Appends the specified header to the headers of this Content.
Definition kmime_content.cpp:676
virtual const char * type() const
Returns the type of this header (e.g.
Definition kmime_headers.cpp:127
Represents a "Content-Transfer-Encoding" header.
Definition kmime_headers.h:838
bool needToEncode() const
Returns whether the Content containing this header needs to be encoded (i.e., if decoded() is true an...
Definition kmime_headers.cpp:1972
void setDecoded(bool isDecoded=true)
Set whether the Content containing this header is already decoded.
Definition kmime_headers.cpp:1967
bool isDecoded() const
Returns whether the Content containing this header is already decoded.
Definition kmime_headers.cpp:1963
contentEncoding encoding() const
Returns the encoding specified in this header.
Definition kmime_headers.cpp:1947
bool isText() const
Returns true if the associated MIME entity is a text.
Definition kmime_headers.cpp:1705
void setPartialParams(int total, int number)
Sets parameters of a partial MIME entity.
Definition kmime_headers.cpp:1786
bool isEmpty() const override
Checks if this header contains any data.
Definition kmime_headers.cpp:1623
bool isMultipart() const
Returns true if the associated MIME entity is a multipart container.
Definition kmime_headers.cpp:1721
QByteArray boundary() const
Returns the boundary (for multipart containers).
Definition kmime_headers.cpp:1742
void setBoundary(const QByteArray &s)
Sets the multipart container boundary.
Definition kmime_headers.cpp:1746
This file is part of the API for handling MIME data and defines the Content class.
contentEncoding
Various possible values for the "Content-Transfer-Encoding" header.
Definition kmime_headers.h:52
KCODECS_EXPORT QByteArray uudecode(QByteArrayView in)
KCODECS_EXPORT QByteArray base64Encode(QByteArrayView in)
KCODECS_EXPORT QByteArray quotedPrintableDecode(QByteArrayView in)
KCODECS_EXPORT QByteArray base64Decode(QByteArrayView in)
KCODECS_EXPORT QByteArray quotedPrintableEncode(QByteArrayView in, bool useCRLF=true)
iterator begin()
const_iterator constEnd() const const
typedef const_iterator
bool endsWith(QByteArrayView bv) const const
bool isEmpty() const const
typedef iterator
void resize(qsizetype newSize, char c)
qsizetype size() const const
bool startsWith(QByteArrayView bv) const const
void truncate(qsizetype pos)
qsizetype count() const const
pointer data()
void push_back(parameter_type value)
void reserve(qsizetype size)
void chop(qsizetype n)
qsizetype length() const const
QString right(qsizetype n) const const
void truncate(qsizetype position)
System
bool isValid() const const
const char * name() const const
EncodedData< QByteArrayView > decode(QByteArrayView ba)
DecodedData< QStringView > encode(QStringView in)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.