Syndication
13 #include <QDomElement>
14 #include <QStringList>
20 class SYNDICATION_NO_EXPORT Content::ContentPrivate
24 : formatIdentified(false)
28 mutable bool formatIdentified;
33 , d(new ContentPrivate)
38 : ElementWrapper(element)
39 , d(new ContentPrivate)
43 Content::Content(
const Content &other)
44 : ElementWrapper(other)
53 Content &Content::operator=(
const Content &other)
55 ElementWrapper::operator=(other);
62 return attribute(QStringLiteral(
"type"));
67 return completeURI(attribute(QStringLiteral(
"src")));
78 Content::Format Content::mapTypeToFormat(
const QString &typep,
const QString &src)
85 type = QStringLiteral(
"text");
102 xmltypes.
append(QStringLiteral(
"xhtml"));
103 xmltypes.
append(QStringLiteral(
"application/xhtml+xml"));
105 xmltypes.
append(QStringLiteral(
"text/xml"));
106 xmltypes.
append(QStringLiteral(
"application/xml"));
107 xmltypes.
append(QStringLiteral(
"text/xml-external-parsed-entity"));
108 xmltypes.
append(QStringLiteral(
"application/xml-external-parsed-entity"));
109 xmltypes.
append(QStringLiteral(
"application/xml-dtd"));
110 xmltypes.
append(QStringLiteral(
"text/x-dtd"));
123 Content::Format Content::format()
const
125 if (d->formatIdentified ==
false) {
126 d->format = mapTypeToFormat(
type(), src());
127 d->formatIdentified =
true;
132 bool Content::isBinary()
const
134 return format() ==
Binary;
137 bool Content::isContained()
const
142 bool Content::isPlainText()
const
147 bool Content::isEscapedHTML()
const
149 return format() == EscapedHTML;
152 bool Content::isXML()
const
154 return format() == XML;
157 QString Content::asString()
const
161 if (f == PlainText) {
162 return plainTextToHtml(text()).
trimmed();
163 }
else if (f == EscapedHTML) {
165 }
else if (f == XML) {
166 return childNodesAsXML().
trimmed();
172 QString Content::debugInfo()
const
176 if (!src().isNull()) {
void append(const T &value)
QString number(int n, int base)
Type type(const QSqlDatabase &db)
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
QString trimmed() const const
bool isEmpty() const const
QByteArray fromBase64(const QByteArray &base64, QByteArray::Base64Options options)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:57:11 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.