• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop QMake parser
 

KDevelop QMake parser

  • buildtools
  • lib
  • parsers
  • qmake
position.h
Go to the documentation of this file.
1/* A Bison parser, made by GNU Bison 2.3. */
2
3/* Positions for Bison parsers in C++
4
5 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
21
22/* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
39
40#ifndef BISON_POSITION_H
41# define BISON_POSITION_H
42
43# include <iostream>
44# include <string>
45
46namespace TQMake
47{
49 class position
50 {
51 public:
52
54 position ()
55 : filename (0), line (1), column (0)
56 {
57 }
58
59
61 inline void initialize (std::string* fn)
62 {
63 filename = fn;
64 line = 1;
65 column = 0;
66 }
67
70 public:
72 inline void lines (int count = 1)
73 {
74 column = 0;
75 line += count;
76 }
77
79 inline void columns (int count = 1)
80 {
81 int leftmost = 0;
82 int current = column;
83 if (leftmost <= current + count)
84 column += count;
85 else
86 column = 0;
87 }
88
89
90 public:
92 std::string* filename;
94 unsigned int line;
96 unsigned int column;
97 };
98
100 inline const position&
101 operator+= (position& res, const int width)
102 {
103 res.columns (width);
104 return res;
105 }
106
108 inline const position
109 operator+ (const position& begin, const int width)
110 {
111 position res = begin;
112 return res += width;
113 }
114
116 inline const position&
117 operator-= (position& res, const int width)
118 {
119 return res += -width;
120 }
121
123 inline const position
124 operator- (const position& begin, const int width)
125 {
126 return begin + -width;
127 }
128
133 inline std::ostream&
134 operator<< (std::ostream& ostr, const position& pos)
135 {
136 if (pos.filename)
137 ostr << *pos.filename << ':';
138 return ostr << pos.line << '.' << pos.column;
139 }
140
141}
142#endif // not BISON_POSITION_H
TQMake::position
Abstract a position.
Definition position.h:50
TQMake::position::column
unsigned int column
Current column number.
Definition position.h:96
TQMake::position::filename
std::string * filename
File name to which this position refers.
Definition position.h:92
TQMake::position::line
unsigned int line
Current line number.
Definition position.h:94
TQMake::position::position
position()
Construct a position.
Definition position.h:54
TQMake::position::initialize
void initialize(std::string *fn)
Initialization.
Definition position.h:61
TQMake::position::columns
void columns(int count=1)
(column related) Advance to the COUNT next columns.
Definition position.h:79
TQMake::position::lines
void lines(int count=1)
(line related) Advance to the COUNT next lines.
Definition position.h:72

KDevelop QMake parser

Skip menu "KDevelop QMake parser"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop QMake parser

Skip menu "KDevelop QMake parser"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop QMake parser by doxygen 1.15.0
This website is maintained by Timothy Pearson.