1 /* 2 This file is part of the Grantlee template system. 3 4 Copyright (c) 2011 Stephen Kelly <steveire@gmail.com> 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either version 9 2.1 of the Licence, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library. If not, see <http://www.gnu.org/licenses/>. 18 19 */ 20 21 #ifndef RSS_FEED_H 22 #define RSS_FEED_H 23 24 #include <grantlee/filter.h> 25 #include <grantlee/node.h> 26 27 namespace Grantlee 28 { 29 class Parser; 30 class OutputStream; 31 class Context; 32 } 33 34 class RssFeedNodeFactory : public Grantlee::AbstractNodeFactory 35 { 36 Q_OBJECT 37 public: 38 RssFeedNodeFactory(QObject *parent = 0); 39 40 virtual Grantlee::Node *getNode(const QString &tagContent, 41 Grantlee::Parser *p) const; 42 }; 43 44 class RssFeedNode : public Grantlee::Node 45 { 46 Q_OBJECT 47 public: 48 RssFeedNode(const Grantlee::FilterExpression &url, 49 const Grantlee::FilterExpression &query, QObject *parent = 0); 50 51 void setChildNodes(QList<Node *> childNodes); 52 53 virtual void render(Grantlee::OutputStream *stream, 54 Grantlee::Context *c) const; 55 56 private: 57 Grantlee::FilterExpression m_url; 58 Grantlee::FilterExpression m_query; 59 QList<Node *> m_childNodes; 60 }; 61 62 class XmlRoleNodeFactory : public Grantlee::AbstractNodeFactory 63 { 64 Q_OBJECT 65 public: 66 XmlRoleNodeFactory(QObject *parent = 0); 67 68 virtual Grantlee::Node *getNode(const QString &tagContent, 69 Grantlee::Parser *p) const; 70 }; 71 72 class XmlRoleNode : public Grantlee::Node 73 { 74 Q_OBJECT 75 public: 76 XmlRoleNode(const Grantlee::FilterExpression &query, QObject *parent = 0); 77 78 virtual void render(Grantlee::OutputStream *stream, 79 Grantlee::Context *c) const; 80 81 private: 82 Grantlee::FilterExpression m_name; 83 Grantlee::FilterExpression m_query; 84 int m_count; 85 }; 86 87 class XmlNamespaceNodeFactory : public Grantlee::AbstractNodeFactory 88 { 89 Q_OBJECT 90 public: 91 XmlNamespaceNodeFactory(QObject *parent = 0); 92 93 virtual Grantlee::Node *getNode(const QString &tagContent, 94 Grantlee::Parser *p) const; 95 }; 96 97 class XmlNamespaceNode : public Grantlee::Node 98 { 99 Q_OBJECT 100 public: 101 XmlNamespaceNode(const Grantlee::FilterExpression &query, const QString &name, 102 QObject *parent = 0); 103 104 virtual void render(Grantlee::OutputStream *stream, 105 Grantlee::Context *c) const; 106 107 private: 108 QString m_name; 109 Grantlee::FilterExpression m_query; 110 }; 111 112 class ResizeFilter : public Grantlee::Filter 113 { 114 public: 115 QVariant doFilter(const QVariant &input, 116 const QVariant &argument = QVariant(), 117 bool autoescape = false) const; 118 }; 119 120 #endif 121