]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <title>The File Position</title> | |
5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
6 | <link href="theme/style.css" rel="stylesheet" type="text/css"> | |
7 | </head> | |
8 | ||
9 | <body> | |
10 | <table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif"> | |
11 | <tr> | |
12 | <td width="21"> <h1></h1></td> | |
13 | <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">The | |
14 | File Position</font></b></font></td> | |
15 | <td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td> | |
16 | </tr> | |
17 | </table> | |
18 | <br> | |
19 | <table border="0"> | |
20 | <tr> | |
21 | <td width="10"></td> | |
22 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> | |
23 | <td width="30"><a href="token_ids.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> | |
24 | <td width="30"><a href="predefined_macros.html"><img src="theme/r_arr.gif" border="0"></a></td> | |
25 | </tr> | |
26 | </table> | |
27 | <blockquote> | |
28 | <p><a href="class_reference_filepos.html#introduction">Introduction</a><br> | |
29 | <a href="class_reference_filepos.html#header_synopsis">Header 'wave/util/file_position.hpp' | |
30 | synopsis</a><br> | |
31 | <a href="class_reference_filepos.html#template_parameters">Template parameters</a><br> | |
32 | <a href="class_reference_filepos.html#member_functions">Member functions</a></p> | |
33 | </blockquote> | |
34 | <h2><b><a name="introduction"></a>Introduction</b></h2> | |
35 | <p>The file position template is used to represent a concrete token position inside | |
36 | the underlying input stream. This token position contains the corresponding | |
37 | filename, the line number and the column number, where the token was recognized.</p> | |
38 | <h2><b><a name="header_synopsis"></a>Header <a href="http://svn.boost.org/trac/boost/browser/trunk/boost/wave/util/file_position.hpp">wave/util/file_position.hpp</a> | |
39 | synopsis</b></h2> | |
40 | <pre><span class="keyword">namespace</span> <span class="identifier">boost</span> { | |
41 | <span class="keyword">namespace</span> <span class="identifier">wave</span> { | |
42 | <span class="keyword">namespace</span> <span class="identifier">util</span> { | |
43 | ||
44 | <span class="keyword">template</span> <<span class="keyword">typename</span> String = <span class="keyword">std::string</span>> | |
45 | <span class="keyword">class</span> file_position { | |
46 | ||
47 | <span class="keyword">public</span>: | |
48 | <a href="class_reference_filepos.html#constructors">file_position</a>(); | |
49 | <span class="keyword">explicit</span> <a href="class_reference_filepos.html#constructors">file_position</a>(String const &file, | |
50 | <span class="keyword">unsigned int</span> line_ = 1, <span class="keyword">unsigned int </span>column_ = 1); | |
51 | ||
52 | // accessors | |
53 | String <span class="keyword">const</span> &<a href="class_reference_filepos.html#get_accessors">get_file</a>() <span class="keyword">const</span>; | |
54 | <span class="keyword">unsigned int</span> <a href="class_reference_filepos.html#get_accessors">get_line</a>() <span class="keyword">const</span>; | |
55 | <span class="keyword">unsigned int</span> <a href="class_reference_filepos.html#get_accessors">get_column</a>() <span class="keyword">const</span>; | |
56 | ||
57 | <span class="keyword">void</span> <a href="class_reference_filepos.html#set_accessors">set_file</a>(String <span class="keyword">const</span> &file); | |
58 | <span class="keyword">void</span> <a href="class_reference_filepos.html#set_accessors">set_line</a>(<span class="keyword">int</span> line); | |
59 | <span class="keyword">void</span> <a href="class_reference_filepos.html#set_accessors">set_column</a>(<span class="keyword">int</span> column); | |
60 | }; | |
61 | ||
62 | } <span class="comment">// namespace util</span> | |
63 | } <span class="comment">// namespace wave</span> | |
64 | } <span class="comment">// namespace boost</span></pre> | |
65 | <h2><a name="template_parameters"></a>Template parameters</h2> | |
66 | <p>The <tt>file_position</tt> template used by the default token type has to be instantiated with one template parameter, | |
67 | which gives the string type to use for storing the file name member of the file | |
68 | position. If this parameter isn't given, it defaults to a <tt>std::string</tt>. | |
69 | Please note, that the type given as the template parameter must be compatible | |
70 | with a <tt>std::string. </tt>Please note, that the type given as the template parameter must be compatible with a <tt>std::string</tt>.</p> | |
71 | <p>You may use your own position types if appropriate, but in any case these should implement the same interface as the <tt>file_position</tt> template described here. </p> | |
72 | <h2><a name="member_functions"></a>Member functions</h2> | |
73 | <h3><a name="constructors"></a>Constructors</h3> | |
74 | <pre> <a href="class_reference_filepos.html#constructors">file_position</a>(); | |
75 | <span class="keyword">explicit</span> <a href="class_reference_filepos.html#constructors">file_position</a>(String const &file, | |
76 | <span class="keyword">unsigned int </span>line_ = 1, <span class="keyword">unsigned int </span>column_ = 1); | |
77 | </pre> | |
78 | <blockquote> | |
79 | <p>The constructors initialize a new instance of a <tt>file_position</tt> in | |
80 | correspondence to the supplied parameters. The parameters default to an empty | |
81 | filename and the line number and column number set to one.</p> | |
82 | </blockquote> | |
83 | <p><a name="get_accessors"></a><b>get_file</b>, <b>get_line</b>, <b>get_column</b></p> | |
84 | <pre> String <span class="keyword">const</span> &<a href="class_reference_filepos.html#get_accessors">get_file</a>() <span class="keyword">const</span>; | |
85 | <span class="keyword">unsigned int</span> <a href="class_reference_filepos.html#get_accessors">get_line</a>() <span class="keyword">const</span>; | |
86 | <span class="keyword">unsigned int</span> <a href="class_reference_filepos.html#get_accessors">get_column</a>() <span class="keyword">const</span>; | |
87 | </pre> | |
88 | <blockquote> | |
89 | <p>The <tt>get_...</tt> functions are used to access the current values of the | |
90 | file position members: the filename (<tt>get_file</tt>), the line number (<tt>get_line</tt>) | |
91 | and the column number (<tt>get_column</tt>).</p> | |
92 | </blockquote> | |
93 | <p><a name="set_accessors"></a><b>set_file</b>, <b>set_line</b>, <b>set_column</b></p> | |
94 | <pre> <span class="keyword">void</span> <a href="class_reference_filepos.html#set_accessors">set_file</a>(String <span class="keyword">const</span> &file); | |
95 | <span class="keyword">void</span> <a href="class_reference_filepos.html#set_accessors">set_line</a>(<span class="keyword">unsigned int</span> line); | |
96 | <span class="keyword">void</span> <a href="class_reference_filepos.html#set_accessors">set_column</a>(<span class="keyword">unsigned int</span> column); | |
97 | </pre> | |
98 | <blockquote> | |
99 | <p>The <tt>set_...</tt> functions are used to set new values to the file position | |
100 | members: the filename (<tt>set_file</tt>), the line number (<tt>set_line</tt>) | |
101 | and the column number (<tt>set_column</tt>).</p> | |
102 | </blockquote> | |
103 | <table border="0"> | |
104 | <tr> | |
105 | <td width="10"></td> | |
106 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> | |
107 | <td width="30"><a href="token_ids.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> | |
108 | <td width="30"><a href="predefined_macros.html"><img src="theme/r_arr.gif" border="0"></a></td> | |
109 | </tr> | |
110 | </table> | |
111 | <hr size="1"> | |
112 | <p class="copyright">Copyright © 2003-2011 Hartmut Kaiser<br> | |
113 | <br> | |
114 | <font size="2">Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p> | |
115 | <p class="copyright"><span class="updated">Last updated: | |
116 | <!-- #BeginDate format:fcAm1m -->Saturday, September 18, 2010 15:14<!-- #EndDate --> | |
117 | </span></p> | |
118 | </body> | |
119 | </html> |