Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
output.h
Go to the documentation of this file.
1 #ifndef OUTPUT_H
2 #define OUTPUT_H
3 
4 #include "parameters.h"
5 #include <QTextStream>
6 #include <QObject>
7 #include <QFile>
8 
14 QTextStream & newline(QTextStream& s);
15 
21 QTextStream & space(QTextStream& s);
22 
23 namespace LangmuirCore
24 {
25 
39 void backupFile(const QString& name);
40 
44 class OutputInfo : public QFileInfo
45 {
46 public:
60  OutputInfo(const QString &name, const SimulationParameters *par = 0);
61 };
62 
69 class OutputStream : public QObject, public QTextStream
70 {
71  Q_OBJECT
72 public:
73 
75 
94  OutputStream(const QString &name, const SimulationParameters *par = 0, QObject *parent = 0);
95 
99  ~OutputStream();
100 
105  const OutputInfo& info();
106 
111  const QFile& file();
112 
113 private:
116 
118  QFile m_file;
119 };
120 
121 }
122 #endif // OUTPUT_H
brief A class to generate file names using the SimulationParameters
Definition: output.h:44
QTextStream & space(QTextStream &s)
put a space in the stream that ignores the streams current FieldWidth
const OutputInfo & info()
Get the info object to get things like file name and path.
QTextStream & newline(QTextStream &s)
put a newline character in the stream that ignores the streams current FieldWidth ...
OutputInfo m_info
< OutputInfo object that generated file name
Definition: output.h:115
QFile m_file
Definition: output.h:118
A struct to store all simulation options.
Definition: parameters.h:46
void backupFile(const QString &name)
Back up a file.
Definition: agent.h:12
const QFile & file()
Get the file object, though you probably have no need for it.
OutputInfo(const QString &name, const SimulationParameters *par=0)
Generate file name according to SimulationParameters.
OutputStream(const QString &name, const SimulationParameters *par=0, QObject *parent=0)
Setup the QTextStream, QFile, and OutputInfo.
~OutputStream()
flush the stream and close the file
A class to combine QFile, QTextStream and OutputInfo (QFileInfo).
Definition: output.h:69