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

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

Loading…
Cancel
Save