Browse Source

Move variables to the proper scope

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
ca44b40222
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 26
      src/base/rss/private/rss_parser.cpp

26
src/base/rss/private/rss_parser.cpp

@ -44,12 +44,16 @@ @@ -44,12 +44,16 @@
namespace
{
class XmlStreamEntityResolver : public QXmlStreamEntityResolver
{
public:
QString resolveUndeclaredEntity(const QString &name) override
{
// (X)HTML entities declared in:
// http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
// http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
// http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
using StringHash = QHash<QString, QString>;
Q_GLOBAL_STATIC_WITH_ARGS(StringHash, HTML_ENTITIES, ({
static const QHash<QString, QString> HTMLEntities {
{"nbsp", "&#160;"}, // no-break space = non-breaking space, U+00A0 ISOnum
{"iexcl", "&#161;"}, // inverted exclamation mark, U+00A1 ISOnum
{"cent", "&#162;"}, // cent sign, U+00A2 ISOnum
@ -347,38 +351,30 @@ namespace @@ -347,38 +351,30 @@ namespace
{"clubs", "&#9827;"}, // black club suit = shamrock, U+2663 ISOpub
{"hearts", "&#9829;"}, // black heart suit = valentine, U+2665 ISOpub
{"diams", "&#9830;"} // black diamond suit, U+2666 ISOpub
}))
class XmlStreamEntityResolver : public QXmlStreamEntityResolver
{
public:
QString resolveUndeclaredEntity(const QString &name) override
{
return HTML_ENTITIES->value(name);
};
return HTMLEntities.value(name);
}
};
// Ported to Qt from KDElibs4
QDateTime parseDate(const QString &string)
{
const char shortDay[][4] = {
"Mon", "Tue", "Wed",
"Thu", "Fri", "Sat",
"Sun"
};
const char longDay[][10] = {
"Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
"Sunday"
};
const char shortMonth[][4] = {
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
};
// Ported to Qt from KDElibs4
QDateTime parseDate(const QString &string)
{
const QString str = string.trimmed();
if (str.isEmpty())
return QDateTime::currentDateTime();

Loading…
Cancel
Save