• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KHolidays Library

  • kholidays
  • parsers
  • plan2
location.hh
Go to the documentation of this file.
1
2/* A Bison parser, made by GNU Bison 2.4.1. */
3
4/* Locations for Bison parsers in C++
5
6 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program 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. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
39#ifndef BISON_LOCATION_HH
40# define BISON_LOCATION_HH
41
42# include <iostream>
43# include <string>
44# include "position.hh"
45
46
47/* Line 162 of location.cc */
48#line 1 "[Bison:b4_percent_define_default]"
49
50namespace KHolidays {
51
52/* Line 162 of location.cc */
53#line 54 "location.hh"
54
56 class location
57 {
58 public:
59
61 location ()
62 : begin (), end ()
63 {
64 }
65
66
68 inline void initialize (std::string* fn)
69 {
70 begin.initialize (fn);
71 end = begin;
72 }
73
76 public:
78 inline void step ()
79 {
80 begin = end;
81 }
82
84 inline void columns (unsigned int count = 1)
85 {
86 end += count;
87 }
88
90 inline void lines (unsigned int count = 1)
91 {
92 end.lines (count);
93 }
97 public:
99 position begin;
101 position end;
102 };
103
105 inline const location operator+ (const location& begin, const location& end)
106 {
107 location res = begin;
108 res.end = end.end;
109 return res;
110 }
111
113 inline const location operator+ (const location& begin, unsigned int width)
114 {
115 location res = begin;
116 res.columns (width);
117 return res;
118 }
119
121 inline location& operator+= (location& res, unsigned int width)
122 {
123 res.columns (width);
124 return res;
125 }
126
128 inline bool
129 operator== (const location& loc1, const location& loc2)
130 {
131 return loc1.begin == loc2.begin && loc1.end == loc2.end;
132 }
133
135 inline bool
136 operator!= (const location& loc1, const location& loc2)
137 {
138 return !(loc1 == loc2);
139 }
140
147 inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
148 {
149 position last = loc.end - 1;
150 ostr << loc.begin;
151 if (last.filename
152 && (!loc.begin.filename
153 || *loc.begin.filename != *last.filename))
154 ostr << '-' << last;
155 else if (loc.begin.line != last.line)
156 ostr << '-' << last.line << '.' << last.column;
157 else if (loc.begin.column != last.column)
158 ostr << '-' << last.column;
159 return ostr;
160 }
161
162
163/* Line 271 of location.cc */
164#line 1 "[Bison:b4_percent_define_default]"
165
166} // KHolidays
167
168/* Line 271 of location.cc */
169#line 170 "location.hh"
170
171#endif // not BISON_LOCATION_HH
KHolidays::location
Abstract a location.
Definition: location.hh:57
KHolidays::location::begin
position begin
Beginning of the located region.
Definition: location.hh:99
KHolidays::location::step
void step()
Reset initial location to final location.
Definition: location.hh:78
KHolidays::location::location
location()
Construct a location.
Definition: location.hh:61
KHolidays::location::columns
void columns(unsigned int count=1)
Extend the current location to the COUNT next columns.
Definition: location.hh:84
KHolidays::location::initialize
void initialize(std::string *fn)
Initialization.
Definition: location.hh:68
KHolidays::location::end
position end
End of the located region.
Definition: location.hh:101
KHolidays::location::lines
void lines(unsigned int count=1)
Extend the current location to the COUNT next lines.
Definition: location.hh:90
KHolidays::position
Abstract a position.
Definition: position.hh:56
KHolidays::position::column
unsigned int column
Current column number.
Definition: position.hh:97
KHolidays::position::line
unsigned int line
Current line number.
Definition: position.hh:95
KHolidays::position::filename
std::string * filename
File name to which this position refers.
Definition: position.hh:93
KHolidays::position::lines
void lines(int count=1)
(line related) Advance to the COUNT next lines.
Definition: position.hh:78
KHolidays::position::initialize
void initialize(std::string *fn)
Initialization.
Definition: position.hh:67
position.hh
Define the KHolidays::position class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHolidays Library

Skip menu "KHolidays Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal