<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Flex Bison C++ Example: src/location.hh Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<h1>src/location.hh</h1><a href="location_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00002"></a>00002 <span class="comment">/* A Bison parser, made by GNU Bison 2.4.1. */</span>
<a name="l00003"></a>00003
<a name="l00004"></a>00004 <span class="comment">/* Locations for Bison parsers in C++</span>
<a name="l00005"></a>00005 <span class="comment"> </span>
<a name="l00006"></a>00006 <span class="comment"> Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.</span>
<a name="l00007"></a>00007 <span class="comment"> </span>
<a name="l00008"></a>00008 <span class="comment"> This program is free software: you can redistribute it and/or modify</span>
<a name="l00009"></a>00009 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
<a name="l00010"></a>00010 <span class="comment"> the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00011"></a>00011 <span class="comment"> (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> </span>
<a name="l00013"></a>00013 <span class="comment"> This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00016"></a>00016 <span class="comment"> GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> </span>
<a name="l00018"></a>00018 <span class="comment"> You should have received a copy of the GNU General Public License</span>
<a name="l00019"></a>00019 <span class="comment"> along with this program. If not, see <http://www.gnu.org/licenses/>. */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/* As a special exception, you may create a larger work that contains</span>
<a name="l00022"></a>00022 <span class="comment"> part or all of the Bison parser skeleton and distribute that work</span>
<a name="l00023"></a>00023 <span class="comment"> under terms of your choice, so long as that work isn't itself a</span>
<a name="l00024"></a>00024 <span class="comment"> parser generator using the skeleton or a modified version thereof</span>
<a name="l00025"></a>00025 <span class="comment"> as a parser skeleton. Alternatively, if you modify or redistribute</span>
<a name="l00026"></a>00026 <span class="comment"> the parser skeleton itself, you may (at your option) remove this</span>
<a name="l00027"></a>00027 <span class="comment"> special exception, which will cause the skeleton and the resulting</span>
<a name="l00028"></a>00028 <span class="comment"> Bison output files to be licensed under the GNU General Public</span>
<a name="l00029"></a>00029 <span class="comment"> License without this special exception.</span>
<a name="l00030"></a>00030 <span class="comment"> </span>
<a name="l00031"></a>00031 <span class="comment"> This special exception was added by the Free Software Foundation in</span>
<a name="l00032"></a>00032 <span class="comment"> version 2.2 of Bison. */</span>
<a name="l00033"></a>00033
<a name="l00039"></a>00039 <span class="preprocessor">#ifndef BISON_LOCATION_HH</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor"># define BISON_LOCATION_HH</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a>00042 <span class="preprocessor"># include <iostream></span>
<a name="l00043"></a>00043 <span class="preprocessor"># include <string></span>
<a name="l00044"></a>00044 <span class="preprocessor"># include "<a class="code" href="position_8hh.html" title="Define the example::position class.">position.hh</a>"</span>
<a name="l00045"></a>00045
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="comment">/* Line 162 of location.cc */</span>
<a name="l00048"></a>00048 <span class="preprocessor">#line 1 "[Bison:b4_percent_define_default]"</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00050"></a>00050 <span class="keyword">namespace </span>example {
<a name="l00051"></a>00051
<a name="l00052"></a>00052 <span class="comment">/* Line 162 of location.cc */</span>
<a name="l00053"></a>00053 <span class="preprocessor">#line 54 "location.hh"</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00056"></a><a class="code" href="classexample_1_1location.html">00056</a> <span class="keyword">class </span><a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058 <span class="keyword">public</span>:
<a name="l00059"></a>00059
<a name="l00061"></a><a class="code" href="classexample_1_1location.html#b3f57c371b16635436d16489be26b986">00061</a> <a class="code" href="classexample_1_1location.html#b3f57c371b16635436d16489be26b986" title="Construct a location.">location</a> ()
<a name="l00062"></a>00062 : <a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a> (), <a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a> ()
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065
<a name="l00066"></a>00066
<a name="l00068"></a><a class="code" href="classexample_1_1location.html#b7074f6e05a6e1351b4d25ca037a5fb8">00068</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classexample_1_1location.html#b7074f6e05a6e1351b4d25ca037a5fb8" title="Initialization.">initialize</a> (std::string* fn)
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070 <a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>.<a class="code" href="classexample_1_1position.html#0b2927172dad066cdb0f2c0c8b9b0a96" title="Initialization.">initialize</a> (fn);
<a name="l00071"></a>00071 <a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a> = <a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>;
<a name="l00072"></a>00072 }
<a name="l00073"></a>00073
<a name="l00076"></a>00076 <span class="keyword">public</span>:
<a name="l00078"></a><a class="code" href="classexample_1_1location.html#74a557e8f19d99d90b21e41e1ad17ef8">00078</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classexample_1_1location.html#74a557e8f19d99d90b21e41e1ad17ef8" title="Reset initial location to final location.">step</a> ()
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080 <a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a> = <a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a>;
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082
<a name="l00084"></a><a class="code" href="classexample_1_1location.html#748182845768b78d9ee3a0cd0c05e942">00084</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classexample_1_1location.html#748182845768b78d9ee3a0cd0c05e942" title="Extend the current location to the COUNT next columns.">columns</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count = 1)
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086 <a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a> += count;
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088
<a name="l00090"></a><a class="code" href="classexample_1_1location.html#037422ac20ec3d9a2dd14c8841439dea">00090</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classexample_1_1location.html#037422ac20ec3d9a2dd14c8841439dea" title="Extend the current location to the COUNT next lines.">lines</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count = 1)
<a name="l00091"></a>00091 {
<a name="l00092"></a>00092 <a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a>.<a class="code" href="classexample_1_1position.html#5bf9ea88111fc15a2be19d118c66a95d" title="(line related) Advance to the COUNT next lines.">lines</a> (count);
<a name="l00093"></a>00093 }
<a name="l00097"></a>00097 <span class="keyword">public</span>:
<a name="l00099"></a><a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8">00099</a> <a class="code" href="classexample_1_1position.html" title="Abstract a position.">position</a> <a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>;
<a name="l00101"></a><a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834">00101</a> <a class="code" href="classexample_1_1position.html" title="Abstract a position.">position</a> <a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a>;
<a name="l00102"></a>00102 };
<a name="l00103"></a>00103
<a name="l00105"></a><a class="code" href="namespaceexample.html#89372a147befefadf885a49e91bf178a">00105</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a> <a class="code" href="namespaceexample.html#89372a147befefadf885a49e91bf178a" title="Join two location objects to create a location.">operator+ </a>(<span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& begin, <span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& end)
<a name="l00106"></a>00106 {
<a name="l00107"></a>00107 <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a> res = begin;
<a name="l00108"></a>00108 res.<a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a> = end.<a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a>;
<a name="l00109"></a>00109 <span class="keywordflow">return</span> res;
<a name="l00110"></a>00110 }
<a name="l00111"></a>00111
<a name="l00113"></a><a class="code" href="namespaceexample.html#59d98eb533706b8a9236ee6bf6db53ca">00113</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a> <a class="code" href="namespaceexample.html#89372a147befefadf885a49e91bf178a" title="Join two location objects to create a location.">operator+ </a>(<span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& begin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width)
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115 <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a> res = begin;
<a name="l00116"></a>00116 res.<a class="code" href="classexample_1_1location.html#748182845768b78d9ee3a0cd0c05e942" title="Extend the current location to the COUNT next columns.">columns</a> (width);
<a name="l00117"></a>00117 <span class="keywordflow">return</span> res;
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119
<a name="l00121"></a><a class="code" href="namespaceexample.html#6a1a320eb30117289a70be3cc20fcba0">00121</a> <span class="keyword">inline</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& <a class="code" href="namespaceexample.html#6a1a320eb30117289a70be3cc20fcba0" title="Add and assign a location.">operator+= </a>(<a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& res, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width)
<a name="l00122"></a>00122 {
<a name="l00123"></a>00123 res.<a class="code" href="classexample_1_1location.html#748182845768b78d9ee3a0cd0c05e942" title="Extend the current location to the COUNT next columns.">columns</a> (width);
<a name="l00124"></a>00124 <span class="keywordflow">return</span> res;
<a name="l00125"></a>00125 }
<a name="l00126"></a>00126
<a name="l00128"></a>00128 <span class="keyword">inline</span> <span class="keywordtype">bool</span>
<a name="l00129"></a><a class="code" href="namespaceexample.html#a68799a72a42f5df1011f26ae428a16f">00129</a> <a class="code" href="namespaceexample.html#a68799a72a42f5df1011f26ae428a16f" title="Compare two location objects.">operator== </a>(<span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& loc1, <span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& loc2)
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131 <span class="keywordflow">return</span> loc1.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a> == loc2.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a> && loc1.<a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a> == loc2.<a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a>;
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133
<a name="l00135"></a>00135 <span class="keyword">inline</span> <span class="keywordtype">bool</span>
<a name="l00136"></a><a class="code" href="namespaceexample.html#2d1471a6dd6cdfb75001fb44df444110">00136</a> <a class="code" href="namespaceexample.html#2d1471a6dd6cdfb75001fb44df444110" title="Compare two location objects.">operator!= </a>(<span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& loc1, <span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& loc2)
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138 <span class="keywordflow">return</span> !(loc1 == loc2);
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140
<a name="l00147"></a><a class="code" href="namespaceexample.html#42e9c113ddb6666d26c0ad11d8950bf6">00147</a> <span class="keyword">inline</span> std::ostream& <a class="code" href="namespaceexample.html#42e9c113ddb6666d26c0ad11d8950bf6" title="Intercept output stream redirection.">operator<< </a>(std::ostream& ostr, <span class="keyword">const</span> <a class="code" href="classexample_1_1location.html" title="Abstract a location.">location</a>& loc)
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149 <a class="code" href="classexample_1_1position.html" title="Abstract a position.">position</a> last = loc.<a class="code" href="classexample_1_1location.html#bb35eb88b69378acd734b0cf83925834" title="End of the located region.">end</a> - 1;
<a name="l00150"></a>00150 ostr << loc.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>;
<a name="l00151"></a>00151 <span class="keywordflow">if</span> (last.<a class="code" href="classexample_1_1position.html#f0bddee6cb090d7d8796d0226d2a41f1" title="File name to which this position refers.">filename</a>
<a name="l00152"></a>00152 && (!loc.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>.<a class="code" href="classexample_1_1position.html#f0bddee6cb090d7d8796d0226d2a41f1" title="File name to which this position refers.">filename</a>
<a name="l00153"></a>00153 || *loc.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>.<a class="code" href="classexample_1_1position.html#f0bddee6cb090d7d8796d0226d2a41f1" title="File name to which this position refers.">filename</a> != *last.<a class="code" href="classexample_1_1position.html#f0bddee6cb090d7d8796d0226d2a41f1" title="File name to which this position refers.">filename</a>))
<a name="l00154"></a>00154 ostr << <span class="charliteral">'-'</span> << last;
<a name="l00155"></a>00155 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (loc.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>.<a class="code" href="classexample_1_1position.html#0a0bcaae3b937c8fbe2dcc2aa206beec" title="Current line number.">line</a> != last.line)
<a name="l00156"></a>00156 ostr << <span class="charliteral">'-'</span> << last.<a class="code" href="classexample_1_1position.html#0a0bcaae3b937c8fbe2dcc2aa206beec" title="Current line number.">line</a> << <span class="charliteral">'.'</span> << last.column;
<a name="l00157"></a>00157 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (loc.<a class="code" href="classexample_1_1location.html#9be5886f1afbd7d8c824c01d61f625d8" title="Beginning of the located region.">begin</a>.<a class="code" href="classexample_1_1position.html#cdab5c856e97fc74613117a8304340dd" title="Current column number.">column</a> != last.column)
<a name="l00158"></a>00158 ostr << <span class="charliteral">'-'</span> << last.column;
<a name="l00159"></a>00159 <span class="keywordflow">return</span> ostr;
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161
<a name="l00162"></a>00162
<a name="l00163"></a>00163 <span class="comment">/* Line 271 of location.cc */</span>
<a name="l00164"></a>00164 <span class="preprocessor">#line 1 "[Bison:b4_percent_define_default]"</span>
<a name="l00165"></a>00165 <span class="preprocessor"></span>
<a name="l00166"></a>00166 } <span class="comment">// example</span>
<a name="l00167"></a>00167
<a name="l00168"></a>00168 <span class="comment">/* Line 271 of location.cc */</span>
<a name="l00169"></a>00169 <span class="preprocessor">#line 170 "location.hh"</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span>
<a name="l00171"></a>00171 <span class="preprocessor">#endif // not BISON_LOCATION_HH</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Sep 5 10:26:25 2009 for Flex Bison C++ Example by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>