Stellarium 0.15.2
template.h
Go to the documentation of this file.
1 
6 #ifndef TEMPLATE_H
7 #define TEMPLATE_H
8 
9 #include <QString>
10 #include <QRegExp>
11 #include <QIODevice>
12 #include <QTextCodec>
13 #include <QFile>
14 #include <QString>
15 #include "templateglobal.h"
16 
22 {
23 public:
25  virtual QString getTranslation(const QString& key) = 0;
26 };
27 
28 
102 class DECLSPEC Template : public QString {
103 public:
104 
110  Template(QString source, QString sourceName);
111 
121  Template(QFile& file, QTextCodec* textCodec = NULL);
122 
123  virtual ~Template() { }
124 
138  int setVariable(QString name, QString value);
139 
152  int setCondition(QString name, bool value);
153 
165  int loop(QString name, int repetitions);
166 
171  void enableWarnings(bool enable=true);
172 
178  void translate(ITemplateTranslationProvider& provider);
179 
180 private:
181 
183  QString sourceName;
184 
186  bool warnings;
187 };
188 
189 #endif // TEMPLATE_H
Enhanced version of QString for template processing.
Definition: template.h:102
virtual QString getTranslation(const QString &key)=0
Implement this method to provide a translated string for a given key.
Interface for Template::translate calls.
Definition: template.h:21