Pages
API Documentation
On this page

Syndication::Atom::Content Class

The content element either contains or links the content of an entry. More...

  • Header: #include <Syndication/Atom/Content>
  • CMake: find_package(KF6 REQUIRED COMPONENTS Syndication)
    target_link_libraries(mytarget PRIVATE KF6::Syndication)
  • Inherits: Syndication::ElementWrapper

List of all members, including inherited members

Public Types

Public Functions

Static Public Members

Detailed Description

The content is usually plain text or HTML, but arbitrary XML or binary content are also possible. If isContained() is false, the content is not contained in the feed source, but linked.

Member Type Documentation

enum Content::Format

format of the content.

Constant Value Description
Syndication::Atom::Content::PlainText 0 the content is plain text (i.e. "<", ">" etc. are text, not markup
Syndication::Atom::Content::EscapedHTML 1 the content is escaped HTML, (i.e., "<", ">" etc. are markup)
Syndication::Atom::Content::XML 2 the content is embedded XML
Syndication::Atom::Content::Binary 3 the content is base64-encoded binary content

Member Function Documentation

Content::Content()

creates a null content object.

[explicit] Content::Content(const QDomElement &element)

creates a Content object wrapping an atom:content element.

element a DOM element, should be a atom:content element (although not enforced), otherwise this object will not parse anything useful

Content::Content(const Syndication::Atom::Content &other)

creates a copy of another Content object

other the content object to copy

QByteArray Content::asByteArray() const

Returns byte array containing the embedded binary data, or an empty array if the content is not in binary format

QString Content::asString() const

returns the content as string. If the content format is Text, the returned string contains the text as HTML. If the content is embedded XML, the XML is returned as string.

Returns a string representation of the content, or a null string if the content is either binary content or not contained but linked (see isContained())

QString Content::debugInfo() const

returns a description of the content object for debugging purposes

Syndication::Atom::Content::Format Content::format() const

returns the content format

bool Content::isBinary() const

returns whether the content is binary content or not. Use asByteArray() to access it.

bool Content::isContained() const

returns whether the content is contained in the feed source, or not. If it is not contained, src() provides a URL to the content.

bool Content::isEscapedHTML() const

returns whether the content is escaped HTML or not Use asString() to access it

bool Content::isPlainText() const

returns whether the content is plain text or not. Use asString() to access it.

bool Content::isXML() const

returns whether the content is embedded XML. Use element() to access the DOM tree, or asString() to get the XML as string.

[static] Syndication::Atom::Content::Format Content::mapTypeToFormat(const QString &type, const QString &src = QString())

maps a mimetype to Format enum according to the Atom 1.0 specification

type a valid mimetype, or one of "text", "html", "xhtml"

src content source, see src() for details.

QString Content::src() const

If src() is set, the content of this entry is not contained in the feed source, but available on the net. src() then contains a URL (more precise: IRI reference) linking to remote content. If src is provided, type() should contain a mimetype, instead of "text", "html" or "xhtml".

Returns a null string if the content is contained in the feed source, or a URL linking to the remote content

QString Content::type() const

the type of the content. This is either "text" (plain text), "html" (escaped HTML), "xhtml" (embedded XHTML) or a mime type

Returns the content type. If no type is specified, "text" (the default) is returned.

Syndication::Atom::Content &Content::operator=(const Syndication::Atom::Content &other)

assigns another content objecct

other the Content object to assign

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.