Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*
43 location.h
44*/
45
46#ifndef LOCATION_H
47#define LOCATION_H
48
49#include <qstack.h>
50
51#include "tr.h"
52
53#define QDOC_QML
54
55QT_BEGIN_NAMESPACE
56
57class Config;
58class QRegExp;
59
60class Location
61{
62 public:
63 Location();
64 Location(const QString& filePath);
65 Location(const Location& other);
66 ~Location() { delete stk; }
67
68 Location& operator=(const Location& other);
69
70 void start();
71 void advance(QChar ch);
72 void advanceLines(int n) { stkTop->lineNo += n; stkTop->columnNo = 1; }
73
74 void push(const QString& filePath);
75 void pop();
76 void setEtc(bool etc) { etcetera = etc; }
77 void setLineNo(int no) { stkTop->lineNo = no; }
78 void setColumnNo(int no) { stkTop->columnNo = no; }
79
80 bool isEmpty() const { return stkDepth == 0; }
81 int depth() const { return stkDepth; }
82 const QString& filePath() const { return stkTop->filePath; }
83 QString fileName() const;
84 int lineNo() const { return stkTop->lineNo; }
85 int columnNo() const { return stkTop->columnNo; }
86 bool etc() const { return etcetera; }
87 void warning(const QString& message,
88 const QString& details = QString()) const;
89 void error(const QString& message,
90 const QString& details = QString()) const;
91 void fatal(const QString& message,
92 const QString& details = QString()) const;
93
94 QT_STATIC_CONST Location null;
95
96 static void initialize(const Config& config);
97 static void terminate();
98 static void information(const QString& message);
99 static void internalError(const QString& hint);
100
101 private:
102 enum MessageType { Warning, Error };
103
104 struct StackEntry
105 {
106 QString filePath;
107 int lineNo;
108 int columnNo;
109 };
110
111 void emitMessage(MessageType type,
112 const QString& message,
113 const QString& details) const;
114 QString toString() const;
115 QString top() const;
116
117 private:
118 StackEntry stkBottom;
119 QStack<StackEntry> *stk;
120 StackEntry *stkTop;
121 int stkDepth;
122 bool etcetera;
123
124 static int tabSize;
125 static QString programName;
126 static QRegExp *spuriousRegExp;
127};
128
129QT_END_NAMESPACE
130
131#endif
132

Warning: That file was not part of the compilation database. It may have many parsing errors.