File indexing completed on 2024-12-22 03:46:51
0001 /* 0002 This file is part of the KTextTemplate library 0003 0004 SPDX-FileCopyrightText: 2011 Stephen Kelly <steveire@gmail.com> 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 0008 */ 0009 0010 #ifndef RSS_FEED_H 0011 #define RSS_FEED_H 0012 0013 #include <KTextTemplate/Filter> 0014 #include <KTextTemplate/Node> 0015 0016 namespace KTextTemplate 0017 { 0018 class Parser; 0019 class OutputStream; 0020 class Context; 0021 } 0022 0023 class RssFeedNodeFactory : public KTextTemplate::AbstractNodeFactory 0024 { 0025 Q_OBJECT 0026 public: 0027 RssFeedNodeFactory(QObject *parent = 0); 0028 0029 virtual KTextTemplate::Node *getNode(const QString &tagContent, KTextTemplate::Parser *p) const; 0030 }; 0031 0032 class RssFeedNode : public KTextTemplate::Node 0033 { 0034 Q_OBJECT 0035 public: 0036 RssFeedNode(const KTextTemplate::FilterExpression &url, const KTextTemplate::FilterExpression &query, QObject *parent = 0); 0037 0038 void setChildNodes(QList<Node *> childNodes); 0039 0040 virtual void render(KTextTemplate::OutputStream *stream, KTextTemplate::Context *c) const; 0041 0042 private: 0043 KTextTemplate::FilterExpression m_url; 0044 KTextTemplate::FilterExpression m_query; 0045 QList<Node *> m_childNodes; 0046 }; 0047 0048 class XmlRoleNodeFactory : public KTextTemplate::AbstractNodeFactory 0049 { 0050 Q_OBJECT 0051 public: 0052 XmlRoleNodeFactory(QObject *parent = 0); 0053 0054 virtual KTextTemplate::Node *getNode(const QString &tagContent, KTextTemplate::Parser *p) const; 0055 }; 0056 0057 class XmlRoleNode : public KTextTemplate::Node 0058 { 0059 Q_OBJECT 0060 public: 0061 XmlRoleNode(const KTextTemplate::FilterExpression &query, QObject *parent = 0); 0062 0063 virtual void render(KTextTemplate::OutputStream *stream, KTextTemplate::Context *c) const; 0064 0065 private: 0066 KTextTemplate::FilterExpression m_name; 0067 KTextTemplate::FilterExpression m_query; 0068 int m_count; 0069 }; 0070 0071 class XmlNamespaceNodeFactory : public KTextTemplate::AbstractNodeFactory 0072 { 0073 Q_OBJECT 0074 public: 0075 XmlNamespaceNodeFactory(QObject *parent = 0); 0076 0077 virtual KTextTemplate::Node *getNode(const QString &tagContent, KTextTemplate::Parser *p) const; 0078 }; 0079 0080 class XmlNamespaceNode : public KTextTemplate::Node 0081 { 0082 Q_OBJECT 0083 public: 0084 XmlNamespaceNode(const KTextTemplate::FilterExpression &query, const QString &name, QObject *parent = 0); 0085 0086 virtual void render(KTextTemplate::OutputStream *stream, KTextTemplate::Context *c) const; 0087 0088 private: 0089 QString m_name; 0090 KTextTemplate::FilterExpression m_query; 0091 }; 0092 0093 class ResizeFilter : public KTextTemplate::Filter 0094 { 0095 public: 0096 QVariant doFilter(const QVariant &input, const QVariant &argument = QVariant(), bool autoescape = false) const; 0097 }; 0098 0099 #endif