NCL Composer  0.1.5
 All Classes Functions Variables Pages
QsciNCLAPIs.h
1 /*
2  * Copyright 2011 TeleMidia/PUC-Rio.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18 #ifndef QSCINCLAPIS_H
19 #define QSCINCLAPIS_H
20 
21 #include <NCLStructure.h>
22 using namespace composer::language;
23 
24 #include <Qsci/qsciapis.h>
25 #include <QtDebug>
26 
27 #include "QsciLexerNCL.h"
28 
29 class QsciNCLAPIs : public QsciAPIs
30 {
31  Q_OBJECT
32 
33 private:
34  NCLStructure *nclStructure;
35  int suggesting;
36  enum {
37  SUGGESTING_ELEMENTS = 0,
38  SUGGESTING_ATTRIBUTES,
39  SUGGESTING_ATTRIBUTE_VALUES,
40  SUGGESTING_OTHER
41  };
42 
43  QString getRequiredAttributesAsStr (const QString &selection);
44  bool isElement (int pos);
45  bool isAttribute (int pos);
46  bool isAttributeValue (int pos);
47  QString getCurrentTagName (int pos);
48  QString getCurrentAttribute (int pos);
49  int getParentOffset(int pos);
50  QString getParentTagName (int pos);
51  void getAttributesTyped(int pos, QStringList &attrs);
52  QString getAttributeValueFromCurrentElement(int pos, QString attr);
53  int getStartTagBegin(int pos);
54  int getStartTagLength(int pos);
55 
56  // \todo this function must be moved from here.
57  QString relativePath( QString absolutePath, QString relativeTo,
58  bool bIsFile = false);
59 
60 public:
61  QsciNCLAPIs(QsciLexer *lexer = 0);
62  virtual ~QsciNCLAPIs();
63 
69  void updateAutoCompletionList(const QStringList &context,
70  QStringList &list);
71 
76  void autoCompletionSelected(const QString &selection);
77 
87  QStringList callTips(const QStringList &context, int commas,
88  QsciScintilla::CallTipsStyle style,
89  QList<int> &shifts);
90 
91 
92  bool event(QEvent *e);
93 
94 signals:
95 
96 public slots:
97 
98 };
99 
100 #endif // QSCINCLAPIS_H