Files
tomlplusplus/structtoml_1_1source__position.html
2022-09-30 04:10:08 +00:00

270 lines
21 KiB
HTML

<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8"/>
<title>toml::source_position struct | toml++ TOML for C++</title>
<link href="favicon.ico" rel="icon" type="image/vnd.microsoft.icon"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta content="#22272e" name="theme-color"/>
<link href="poxy/poxy.css" referrerpolicy="no-referrer" rel="stylesheet"/>
<script src="poxy/poxy.js"></script>
<script>initialize_theme("dark");</script>
<meta content="toml++" name="twitter:title"/>
<meta content="toml++" property="og:title"/>
<meta content="toml++" itemprop="name"/>
<meta content="Mark Gillard" name="author"/>
<meta content="Mark Gillard" property="article:author"/>
<meta content="TOML for C++" name="description"/>
<meta content="TOML for C++" name="twitter:description"/>
<meta content="TOML for C++" property="og:description"/>
<meta content="TOML for C++" itemprop="description"/>
<meta content="telephone=no" name="format-detection"/>
<meta content="Poxy v0.8.1" name="generator"/>
<meta content="strict-origin-when-cross-origin" name="referrer"/>
<meta content="gbtcNgKlNiPSMKkYMw4zWFVWGPH_oU93m9n_-nb4qK8" name="google-site-verification"/>
<style>div.poxy-main-banner { padding: 2rem; }</style>
</head>
<body class="poxy-has-toc">
<header><nav id="navigation">
<div class="m-container">
<div class="m-row">
<a class="m-col-t-8 m-col-m-none m-left-m" href="index.html" id="m-navbar-brand"><img alt="" src="logo.png"/>toml++ <span class="m-thin">TOML for C++</span></a>
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
<a class="m-doc-search-icon" href="#search" onclick="return showSearch()" title="Search"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<path d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z" id="m-doc-search-icon-path"></path>
</svg></a>
<a href="#navigation" id="m-navbar-show" title="Show navigation"></a>
<a href="#" id="m-navbar-hide" title="Hide navigation"></a>
</div>
<div class="m-col-t-12 m-show-m m-col-m-none m-right-m" id="m-navbar-collapse">
<div class="m-row">
<ol class="m-col-t-6 m-col-m-none">
<li><a href="namespaces.html">Namespaces</a></li>
<li><a href="annotated.html">Classes</a></li>
</ol>
<ol class="m-col-t-6 m-col-m-none" start="3">
<li><a class="poxy-icon repo github poxy-external" href="https://github.com/marzer/tomlplusplus" target="_blank" title="View on GitHub"><svg viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
<path d="M25,1.23a24.37,24.37,0,0,0-7.7,47.5C18.51,49,19,48.2,19,47.56s0-2.12,0-4.15c-6.78,1.47-8.21-3.27-8.21-3.27C9.61,37.33,8,36.58,8,36.58c-2.21-1.51.17-1.48.17-1.48a5.12,5.12,0,0,1,3.73,2.51c2.17,3.72,5.7,2.65,7.09,2a5.25,5.25,0,0,1,1.55-3.26c-5.41-.61-11.1-2.7-11.1-12A9.41,9.41,0,0,1,12,17.79a8.75,8.75,0,0,1,.24-6.45s2-.66,6.7,2.49a23.1,23.1,0,0,1,12.2,0c4.66-3.15,6.7-2.49,6.7-2.49A8.75,8.75,0,0,1,38,17.79a9.41,9.41,0,0,1,2.51,6.54c0,9.36-5.7,11.42-11.13,12a5.83,5.83,0,0,1,1.65,4.51c0,3.26,0,5.89,0,6.69,0,.65.44,1.41,1.68,1.17A24.38,24.38,0,0,0,25,1.23Z" fill="currentColor"></path>
</svg>
</a></li>
<li><a class="poxy-icon theme" href="javascript:void(null);" id="poxy-theme-switch" onclick="toggle_theme();" role="button" title="Toggle dark and light themes"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<circle cx="185.6708" cy="183.8122" fill="currentColor" r="65.625"></circle>
<path d="M185.6708,87.5622a13.1256,13.1256,0,0,0,13.125-13.125V52.5622a13.125,13.125,0,1,0-26.25,0v21.875A13.1257,13.1257,0,0,0,185.6708,87.5622Z" fill="currentColor"></path>
<path d="M99.051,115.7519a13.1236,13.1236,0,1,0,18.56-18.56L102.1442,81.726a13.1236,13.1236,0,0,0-18.5595,18.56Z" fill="currentColor"></path>
<path d="M89.4208,183.8122a13.1257,13.1257,0,0,0-13.125-13.125H54.4208a13.125,13.125,0,0,0,0,26.25h21.875A13.1256,13.1256,0,0,0,89.4208,183.8122Z" fill="currentColor"></path>
<path d="M99.051,251.8725,83.5847,267.3431a13.1236,13.1236,0,1,0,18.56,18.56l15.4663-15.4706a13.1236,13.1236,0,1,0-18.5595-18.56Z" fill="currentColor"></path>
<path d="M185.6708,280.0622a13.1258,13.1258,0,0,0-13.125,13.125v21.875a13.125,13.125,0,0,0,26.25,0v-21.875A13.1257,13.1257,0,0,0,185.6708,280.0622Z" fill="currentColor"></path>
<path d="M272.2907,251.8725a13.1236,13.1236,0,1,0-18.56,18.56l15.4663,15.4706a13.1236,13.1236,0,1,0,18.56-18.56Z" fill="currentColor"></path>
<path d="M330.0458,183.8122a13.1257,13.1257,0,0,0-13.125-13.125h-21.875a13.125,13.125,0,0,0,0,26.25h21.875A13.1256,13.1256,0,0,0,330.0458,183.8122Z" fill="currentColor"></path>
<path d="M263.0109,119.5971a13.0824,13.0824,0,0,0,9.28-3.8452l15.4663-15.4663a13.1236,13.1236,0,1,0-18.56-18.56L253.7312,97.1923a13.125,13.125,0,0,0,9.28,22.4048Z" fill="currentColor"></path>
<path d="M456.9379,401.6714a63.97,63.97,0,0,1-14.9963,7.2055c-19.6448,6.5283-41.8787,2.9566-58.1439-9.8523a68.9311,68.9311,0,0,1-10.835-10.8339c-12.8088-16.2663-16.3806-38.5-9.8523-58.1471a63.8444,63.8444,0,0,1,7.2077-14.9931,8.8036,8.8036,0,0,0-10.1172-13.3034,87.5188,87.5188,0,1,0,110.0372,110.04A8.8,8.8,0,0,0,456.9379,401.6714Z" fill="currentColor"></path>
</svg>
</a></li>
<li class="m-show-m"><a class="m-doc-search-icon" href="#search" onclick="return showSearch()" title="Search"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<use href="#m-doc-search-icon-path"></use>
</svg></a></li>
</ol>
</div>
</div>
</div>
</div>
</nav></header>
<main><article>
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<h1>
<span class="m-breadcrumb"><a href="namespacetoml.html">toml</a>::<wbr/></span>source_position <span class="m-thin">struct</span>
</h1>
<p>A source document line-and-column pair.</p>
<nav class="m-block m-default poxy-toc" id="poxy-toc">
<h3>Contents</h3>
<ul>
<li>
Reference
<ul>
<li><a href="#typeless-methods">Constructors, destructors, conversion operators</a></li>
<li><a href="#pub-attribs">Public variables</a></li>
<li><a href="#friends">Friends</a></li>
</ul>
</li>
</ul>
</nav>
<pre class="m-code"><span class="k">auto</span><span class="w"> </span><span class="n">table</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nn">toml</span><span class="o">::</span><span class="n">parse_file</span><span class="p">(</span><span class="s">"config.toml"</span><span class="sa">sv</span><span class="p">);</span>
<span class="nn">std</span><span class="o">::</span><span class="nc">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">"The node 'description' was defined at "</span><span class="sa">sv</span>
<span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="n">table</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"description"</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">source</span><span class="p">().</span><span class="n">begin</span><span class="p">()</span>
<span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span></pre><pre class="m-console"><span class="go">The value 'description' was defined at line 7, column 15</span></pre><aside class="m-note m-default"><h4>Remark</h4><p>toml++'s parser is unicode-aware insofar as it knows how to handle non-ASCII whitespace and newline characters, but it doesn't give much thought to combining marks, grapheme clusters vs. characters, et cetera. If a TOML document contains lots of codepoints outside of the ASCII range you may find that your source_positions don't match those given by a text editor (typically the line numbers will be accurate but column numbers will be too high). <strong>This is not an error.</strong> I've chosen this behaviour as a deliberate trade-off between parser complexity and correctness.</p></aside>
<section id="typeless-methods">
<h2><a href="#typeless-methods">Constructors, destructors, conversion operators</a></h2>
<dl class="m-doc">
<dt id="accba2f34a07d8b453b8f2f6baf2d73cf">
<span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#accba2f34a07d8b453b8f2f6baf2d73cf">operator bool</a>(</span><span class="m-doc-wrap">) const <span class="m-label m-flat m-info">explicit</span> <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Returns true if both line and column numbers are non-zero.</dd>
</dl>
</section>
<section id="pub-attribs">
<h2><a href="#pub-attribs">Public variables</a></h2>
<dl class="m-doc">
<dt>
<a class="m-doc" href="namespacetoml.html#afb852fa22a8b3ea9d200d645b9d5c308">source_<wbr/>index</a> <a class="m-doc" href="#ab21cac59798d70e25fe97ac7433763cc">line</a>
</dt>
<dd>The line number.</dd>
<dt>
<a class="m-doc" href="namespacetoml.html#afb852fa22a8b3ea9d200d645b9d5c308">source_<wbr/>index</a> <a class="m-doc" href="#a1ca6d0db40c69d2784703011f7cf5434">column</a>
</dt>
<dd>The column number.</dd>
</dl>
</section>
<section id="friends">
<h2><a href="#friends">Friends</a></h2>
<dl class="m-doc">
<dt id="a8c3d253eb50b2b908cf1a7514a1d1dcb">
<span class="m-doc-wrap-bumper">auto <a class="m-doc-self" href="#a8c3d253eb50b2b908cf1a7514a1d1dcb">operator!=</a>(</span><span class="m-doc-wrap">const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Inequality operator.</dd>
<dt id="a1c7ae741097e2fba03cceb36b7aed973">
<span class="m-doc-wrap-bumper">auto <a class="m-doc-self" href="#a1c7ae741097e2fba03cceb36b7aed973">operator&lt;</a>(</span><span class="m-doc-wrap">const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Less-than operator.</dd>
<dt>
<span class="m-doc-wrap-bumper">auto <a class="m-doc" href="#adff6ba2a042bbaa4be4eaf88c4b58062">operator&lt;&lt;</a>(</span><span class="m-doc-wrap"><a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html" target="_blank">std::<wbr/>ostream</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; <a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html" target="_blank">std::<wbr/>ostream</a>&amp;</span>
</dt>
<dd>Prints a <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a> to a stream.</dd>
<dt id="a1f5525a304df6157cd0f41378c0773e2">
<span class="m-doc-wrap-bumper">auto <a class="m-doc-self" href="#a1f5525a304df6157cd0f41378c0773e2">operator&lt;=</a>(</span><span class="m-doc-wrap">const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Less-than-or-equal-to operator.</dd>
<dt id="ad4600cc2d6ede282c93a8bdc5bb7a2fe">
<span class="m-doc-wrap-bumper">auto <a class="m-doc-self" href="#ad4600cc2d6ede282c93a8bdc5bb7a2fe">operator==</a>(</span><span class="m-doc-wrap">const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Equality operator.</dd>
<dt id="a47e81424785ec01a50c012ca66a66136">
<span class="m-doc-wrap-bumper">auto <a class="m-doc-self" href="#a47e81424785ec01a50c012ca66a66136">operator&gt;</a>(</span><span class="m-doc-wrap">const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Greater-than operator.</dd>
<dt id="af8fc1d83087df475b7bb0209744a9c3d">
<span class="m-doc-wrap-bumper">auto <a class="m-doc-self" href="#af8fc1d83087df475b7bb0209744a9c3d">operator&gt;=</a>(</span><span class="m-doc-wrap">const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs) -&gt; bool <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>Greater-than-or-equal-to operator.</dd>
</dl>
</section>
<section>
<h2>Function documentation</h2>
<section class="m-doc-details" id="adff6ba2a042bbaa4be4eaf88c4b58062"><div>
<h3>
<span class="m-doc-wrap-bumper"><a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html" target="_blank">std::<wbr/>ostream</a>&amp; </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#adff6ba2a042bbaa4be4eaf88c4b58062">operator&lt;&lt;</a>(</span><span class="m-doc-wrap"><a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html" target="_blank">std::<wbr/>ostream</a>&amp; lhs,
const <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>&amp; rhs)</span></span>
</h3>
<p>Prints a <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a> to a stream.</p>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">lhs</td>
<td>The stream.</td>
</tr>
<tr>
<td>rhs</td>
<td>The <a class="m-doc" href="structtoml_1_1source__position.html">source_<wbr/>position</a>.</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Returns</th>
<td>The input stream.</td>
</tr>
</tfoot>
</table>
<pre class="m-code"><span class="k">auto</span><span class="w"> </span><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nn">toml</span><span class="o">::</span><span class="n">parse</span><span class="p">(</span><span class="s">"bar = 42"</span><span class="sa">sv</span><span class="p">);</span>
<span class="nn">std</span><span class="o">::</span><span class="nc">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">"The value for 'bar' was found on "</span><span class="sa">sv</span>
<span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"bar"</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">source</span><span class="p">().</span><span class="n">begin</span><span class="p">()</span>
<span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span></pre><pre class="m-console"><span class="go">The value for 'bar' was found on line 1, column 7</span></pre>
</div></section>
</section>
<section>
<h2>Variable documentation</h2>
<section class="m-doc-details" id="ab21cac59798d70e25fe97ac7433763cc"><div>
<h3>
<a class="m-doc" href="namespacetoml.html#afb852fa22a8b3ea9d200d645b9d5c308">source_<wbr/>index</a> toml::<wbr/>source_position::<wbr/><a class="m-doc-self" href="#ab21cac59798d70e25fe97ac7433763cc">line</a>
</h3>
<p>The line number.</p>
<aside class="m-note m-default"><h4>Remark</h4><p>Valid line numbers start at 1.</p></aside>
</div></section>
<section class="m-doc-details" id="a1ca6d0db40c69d2784703011f7cf5434"><div>
<h3>
<a class="m-doc" href="namespacetoml.html#afb852fa22a8b3ea9d200d645b9d5c308">source_<wbr/>index</a> toml::<wbr/>source_position::<wbr/><a class="m-doc-self" href="#a1ca6d0db40c69d2784703011f7cf5434">column</a>
</h3>
<p>The column number.</p>
<aside class="m-note m-default"><h4>Remark</h4><p>Valid column numbers start at 1.</p></aside>
</div></section>
</section>
</div>
</div>
</div>
</article></main>
<div class="m-doc-search" id="search">
<a href="#!" onclick="return hideSearch()"></a>
<div class="m-container">
<div class="m-row">
<div class="m-col-m-8 m-push-m-2">
<div class="m-doc-search-header m-text m-small">
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
<div id="search-symbolcount"></div>
</div>
<div class="m-doc-search-content">
<form>
<input autocomplete="off" autofocus="autofocus" disabled="disabled" id="search-input" name="q" placeholder="Loading …" spellcheck="false" type="search"/>
</form>
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
<div class="m-text m-dim m-text-center" id="search-help">
<p class="m-noindent">Search for symbols, directories, files, pages or
modules. You can omit any prefix from the symbol or file path; adding a
<code>:</code> or <code>/</code> suffix lists all members of given symbol or
directory.</p>
<p class="m-noindent">Use <span class="m-label m-dim"></span>
/ <span class="m-label m-dim"></span> to navigate through the list,
<span class="m-label m-dim">Enter</span> to go.
<span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
copy a link to the result using <span class="m-label m-dim"></span>
<span class="m-label m-dim">L</span> while <span class="m-label m-dim"></span>
<span class="m-label m-dim">M</span> produces a Markdown link.</p>
</div>
<div class="m-text m-warning m-text-center" id="search-notfound">Sorry, nothing was found.</div>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
</div>
<script src="search-v2.js"></script>
<script async="async" src="searchdata-v2.js"></script>
<footer><nav>
<div class="m-container">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<a class="poxy-external" href="https://github.com/marzer/tomlplusplus" target="_blank">GitHub</a>
<a class="poxy-external" href="https://github.com/marzer/tomlplusplus/issues" target="_blank">Report an issue</a>
<a href="md_poxy_changelog.html">Changelog</a>
<a class="poxy-external" href="https://github.com/marzer/tomlplusplus/blob/master/LICENSE" target="_blank">License</a>
<a download="" href="toml++.tagfile.xml" target="_blank" type="text/xml">Doxygen tagfile</a>
<br/><br/>
Site generated using <a class="poxy-external" href="https://github.com/marzer/poxy/" target="_blank">Poxy</a>
</div>
</div>
</div>
</nav></footer>
</body></html>