OpenStructure
text_logger.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef TEXT_LOGGER_HH_
20 #define TEXT_LOGGER_HH_
21 
22 /*
23  Author: Andreas Schenk
24  */
25 
26 #include "python_interpreter.hh"
27 
28 #include <QObject>
29 #include <QTextStream>
30 
31 namespace ost{namespace gui{
32 
33 class DLLEXPORT_OST_GUI TextLogger:public QObject,public QTextStream
34 {
35  Q_OBJECT
36 public:
38  TextLogger( QIODevice * device );
39  TextLogger( FILE * fileHandle, QIODevice::OpenMode openMode = QIODevice::ReadWrite );
40  TextLogger( QString * String, QIODevice::OpenMode openMode = QIODevice::ReadWrite );
41  TextLogger( const QByteArray & array, QIODevice::OpenMode openMode = QIODevice::ReadOnly );
42  virtual ~TextLogger();
43  void SetCodeLogging(bool flag);
44  void SetOutputLogging(bool flag);
45  void SetErrorLogging(bool flag);
49 
50 public slots:
51  void AppendCode(const QString& text);
52  void AppendOutput(unsigned int id,const QString& text);
53 
54 protected:
55  bool log_code_;
57  bool log_error_;
58 };
59 
60 }}//ns
61 
62 #endif /*TEXT_LOGGER_HH_*/
TextLogger(const QByteArray &array, QIODevice::OpenMode openMode=QIODevice::ReadOnly)
void AppendCode(const QString &text)
TextLogger(QString *String, QIODevice::OpenMode openMode=QIODevice::ReadWrite)
void SetErrorLogging(bool flag)
void AppendOutput(unsigned int id, const QString &text)
void SetOutputLogging(bool flag)
TextLogger(QIODevice *device)
void SetCodeLogging(bool flag)
TextLogger(FILE *fileHandle, QIODevice::OpenMode openMode=QIODevice::ReadWrite)
#define DLLEXPORT_OST_GUI
std::string String
Definition: base.hh:54
Definition: base.dox:1