OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
37  TextLogger();
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);
46  bool GetCodeLogging();
47  bool GetOutputLogging();
48  bool GetErrorLogging();
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_*/
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_GUI