Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
APIDataBase.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 /**
21  *
22  * This file is part of Tulip (www.tulip-software.org)
23  *
24  * Authors: David Auber and the Tulip development Team
25  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
26  *
27  * Tulip is free software; you can redistribute it and/or modify
28  * it under the terms of the GNU Lesser General Public License
29  * as published by the Free Software Foundation, either version 3
30  * of the License, or (at your option) any later version.
31  *
32  * Tulip is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35  * See the GNU General Public License for more details.
36  *
37  */
38 
39 #ifndef APIDATABASE_H_
40 #define APIDATABASE_H_
41 
42 #include <QSet>
43 #include <QVector>
44 #include <QHash>
45 #include <QString>
46 
47 #include <tulip/tulipconf.h>
48 
49 namespace tlp {
50 
51 class TLP_PYTHON_SCOPE APIDataBase {
52 
53  APIDataBase();
54 
55  QHash<QString, QSet<QString> > _dictContent;
56  QHash<QString, QString> _returnType;
57  QHash<QString, QVector<QVector<QString> > > _paramTypes;
58 
59  static APIDataBase _instance;
60 
61 public :
62 
63  static APIDataBase *getInstance() {
64  return &_instance;
65  }
66 
67  void loadApiFile(const QString &apiFilePath);
68 
69  void addApiEntry(const QString &apiEntry);
70 
71  QSet<QString> getTypesList() const;
72  QSet<QString> getDictContentForType(const QString &type, const QString &prefix = "") const;
73  QString getReturnTypeForMethodOrFunction(const QString &funcName) const;
74  QVector<QVector<QString> > getParamTypesForMethodOrFunction(const QString &funcName) const;
75  bool functionExists(const QString &funcName) const;
76  QVector<QString> findTypesContainingDictEntry(const QString &dictEntry) const;
77  QSet<QString> getAllDictEntriesStartingWithPrefix(const QString &prefix) const;
78 
79  bool typeExists(const QString &type) const;
80  QString getFullTypeName(const QString &type) const;
81  bool dictEntryExists(const QString &type, const QString &dictEntry) const;
82 
83 };
84 
85 }
86 
87 #endif /* APIDATABASE_H_ */