File indexing completed on 2025-02-09 04:28:36

0001 /*
0002   This file is part of the KTextTemplate library
0003 
0004   SPDX-FileCopyrightText: 2010 Stephen Kelly <steveire@gmail.com>
0005 
0006   SPDX-License-Identifier: LGPL-2.0-or-later
0007 
0008 */
0009 
0010 #ifndef I18NPNODE_H
0011 #define I18NPNODE_H
0012 
0013 #include "node.h"
0014 
0015 namespace KTextTemplate
0016 {
0017 class Parser;
0018 }
0019 
0020 using namespace KTextTemplate;
0021 
0022 class I18npNodeFactory : public AbstractNodeFactory
0023 {
0024     Q_OBJECT
0025 public:
0026     I18npNodeFactory();
0027 
0028     Node *getNode(const QString &tagContent, Parser *p) const override;
0029 };
0030 
0031 class I18npVarNodeFactory : public AbstractNodeFactory
0032 {
0033     Q_OBJECT
0034 public:
0035     I18npVarNodeFactory();
0036 
0037     Node *getNode(const QString &tagContent, Parser *p) const override;
0038 };
0039 
0040 class I18npNode : public Node
0041 {
0042     Q_OBJECT
0043 public:
0044     I18npNode(const QString &sourceText, const QString &pluralText, const QList<FilterExpression> &feList, QObject *parent = {});
0045     void render(OutputStream *stream, Context *c) const override;
0046 
0047 private:
0048     QString m_sourceText;
0049     QString m_pluralText;
0050     QList<FilterExpression> m_filterExpressionList;
0051 };
0052 
0053 class I18npVarNode : public Node
0054 {
0055     Q_OBJECT
0056 public:
0057     I18npVarNode(const QString &sourceText, const QString &pluralText, const QList<FilterExpression> &feList, const QString &resultName, QObject *parent = {});
0058     void render(OutputStream *stream, Context *c) const override;
0059 
0060 private:
0061     QString m_sourceText;
0062     QString m_pluralText;
0063     QList<FilterExpression> m_filterExpressionList;
0064     QString m_resultName;
0065 };
0066 
0067 #endif