Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef REPORTER_H
00018 #define REPORTER_H REPORTER_H
00019
00020 #include <QtCore/QCoreApplication>
00021 #include <QtCore/QSharedPointer>
00022 #include <QtCore/QString>
00023 #include <QtCore/QTextStream>
00024
00025 class DataType;
00026 class Block;
00027
00028 class Reporter {
00029 Q_DECLARE_TR_FUNCTIONS(Reporter)
00030 public:
00031 virtual void tagValuePair(const QString& tag, const QString& value) = 0;
00032 virtual void tagValuePair(const QString& tag, int value);
00033 virtual void writeBlock(const Block& value, const QString& tag = "");
00035 virtual QByteArray toQByteArray() const = 0;
00036 virtual void setTitle(const QString& newtitle);
00037 virtual bool allowSvg() const = 0;
00038 void flush();
00039 Reporter();
00040 template <typename Arraytype>
00041 void writeArray(const Arraytype& ray, const QString& title = "", bool defaultShown = true){
00042 arrayStart(ray.numberOfBlocks(), title, defaultShown);
00043 ++nestLevel;
00044 for(int j = 0; j < ray.numberOfBlocks(); ++j){
00045 this->writeBlock(ray[j]);
00046 }
00047 --nestLevel;
00048 arrayEnd(ray.numberOfBlocks());
00049 }
00050 protected:
00051 int nestLevel;
00052 QByteArray collected;
00053 mutable QTextStream collector;
00054 QString title;
00055 virtual void subBlock(const Block& value, const QString& tag) = 0;
00056 virtual void arrayStart(int count, const QString& title, bool defaultShown){}
00057 virtual void arrayEnd(int count){}
00058 };
00059
00060 #endif