itom  3.0.0
qsciApiManager.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2016, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef QSCIAPIMANAGER_H
24 #define QSCIAPIMANAGER_H
25 
26 // Under Windows, define QSCINTILLA_MAKE_DLL to create a Scintilla DLL, or
27 // define QSCINTILLA_DLL to link against a Scintilla DLL, or define neither
28 // to either build or link against a static Scintilla library.
30 #define QSCINTILLA_DLL //http://www.riverbankcomputing.com/pipermail/qscintilla/2007-March/000034.html
31 
32 #include <Qsci/qsciscintilla.h>
33 #include <Qsci/qscilexerpython.h>
34 #include "Qsci/qsciapis.h"
35 
36 #include <qstringlist.h>
37 #include <qdatetime.h>
38 
39 namespace ito
40 {
41 
42  class QsciApiManager : public QObject
43  {
44  Q_OBJECT
45 
46  public:
47  static QsciApiManager * getInstance(void);
48 
49  inline QsciAPIs *getQsciAPIs() const { qDebug("return m_pApi"); return m_pApi; }
50  inline bool isPreparing() const { return m_isPreparing; }
51 
52  int updateAPI(QStringList files, bool forcePreparation = false);
53 
54  struct APIFileInfo
55  {
56  APIFileInfo() : absoluteFilename(""), checksum(0), exists(0) {}
57  public:
58  QString absoluteFilename;
59  quint16 checksum;
60  bool exists;
61  QDateTime lastModified;
62 
63  //sorting depends on filename only
64  bool operator < (const APIFileInfo &rhs) const
65  {
66  return absoluteFilename < rhs.absoluteFilename;
67  }
68  };
69 
70  protected:
71 
72  private:
73  QsciApiManager(void);
74  inline QsciApiManager(QsciApiManager &/*copyConstr*/) : QObject(), m_isPreparing(0) {}
75  ~QsciApiManager(void);
76 
77  QsciAPIs* m_pApi;
78  QsciLexerPython* m_qSciLex;
79 
80  bool m_isPreparing;
81  QList<APIFileInfo> m_preparingAPIFiles;
82  QString m_preparingFileInfo;
83 
84  bool m_loaded;
85 
87 
90  {
91  public:
93  {
94  #pragma omp critical
95  {
97  {
100  }
101  }
102  }
103  };
104  friend class QsciApiSingleton;
105 
106  signals:
107 
108  public slots:
109 
110  private slots:
111  void apiPreparationFinished();
113  void apiPreparationStarted();
114  };
115 } //namespace ito
116 
117 #endif
Definition: qsciApiManager.h:42
void apiPreparationFinished()
shortdesc
Definition: qsciApiManager.cpp:298
void apiPreparationStarted()
shortdesc
Definition: qsciApiManager.cpp:366
void apiPreparationCancelled()
shortdesc
Definition: qsciApiManager.cpp:345
Definition: apiFunctionsGraph.cpp:39
int updateAPI(QStringList files, bool forcePreparation=false)
shortdesc
Definition: qsciApiManager.cpp:106
static QsciApiManager * m_pQsciApiManager
singleton nach: http://www.oop-trainer.de/Themen/Singleton.html
Definition: qsciApiManager.h:86
Definition: qsciApiManager.h:89
static QsciApiManager * getInstance(void)
shortdesc
Definition: qsciApiManager.cpp:49
Definition: qsciApiManager.h:54