# reference on toml11

https://toruniina.github.io/toml11/docs/reference/ Recent content in reference on toml11 Hugo en

# color.hpp

https://toruniina.github.io/toml11/docs/reference/color/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/color/<h1 id="colorhpp"> color.hpp <a class="anchor" href="#colorhpp">#</a> </h1> <p>In <code>color.hpp</code>, functions related to colorizing error messages are defined.</p> <p>Colors are specified using ANSI escape code. In terminals or other output destinations that do not support ANSI escape code, the output may become difficult to read.</p> <h2 id="macros"> Macros <a class="anchor" href="#macros">#</a> </h2> <h3 id="toml11_colorize_error_message"> <code>TOML11_COLORIZE_ERROR_MESSAGE</code> <a class="anchor" href="#toml11_colorize_error_message">#</a> </h3> <p>If this macro is defined during compilation (<code>-DTOML11_COLORIZE_ERROR_MESASGE</code>), error messages are colored by default.</p> <p>If not defined, colors are not applied by default. You need to specify them using <code>toml::color::enable()</code>.</p>

# comments.hpp

https://toruniina.github.io/toml11/docs/reference/comments/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/comments/<h1 id="commentshpp"> comments.hpp <a class="anchor" href="#commentshpp">#</a> </h1> <p>In <code>comments.hpp</code>, comment containers are provided.</p> <h1 id="tomlpreserve_comments"> <code>toml::preserve_comments</code> <a class="anchor" href="#tomlpreserve_comments">#</a> </h1> <p><code>preserve_comments</code> is a container that preserves comments.</p> <p>It has all the member functions of <code>std::vector&lt;std::string&gt;</code>.</p> <p>Comments are preserved as <code>std::string</code>. If the comment does not start with <code>#</code>, it will be prefixed with <code>#</code> during output. However, this prefixing is not done when adding comments to the container.</p> <p>Spaces are not automatically added, so if you want a space immediately after <code>#</code>, either start the comment with a space or pass the comment with <code>#</code>.</p>

# conversion.hpp

https://toruniina.github.io/toml11/docs/reference/conversion/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/conversion/<h1 id="conversionhpp"> conversion.hpp <a class="anchor" href="#conversionhpp">#</a> </h1> <p>Provides macros to automatically define conversion functions for supporting user-defined types with <code>toml::get</code> and <code>toml::find</code>.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span>TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(NAME, ...) </span></span></code></pre></div><h2 id="example"> Example <a class="anchor" href="#example">#</a> </h2> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> foo </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">Foo</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string s; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">double</span> d; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">int</span> i; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// foo </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> </span></span><span style="display:flex;"><span>TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(foo<span style="color:#f92672">::</span>Foo, s, d, i) </span></span></code></pre></div><h1 id="related"> Related <a class="anchor" href="#related">#</a> </h1> <ul> <li><a href="https://toruniina.github.io/toml11/docs/reference/from/">from.hpp</a></li> <li><a href="https://toruniina.github.io/toml11/docs/reference/into/">into.hpp</a></li> </ul>

# datetime.hpp

https://toruniina.github.io/toml11/docs/reference/datetime/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/datetime/<h1 id="datetimehpp"> datetime.hpp <a class="anchor" href="#datetimehpp">#</a> </h1> <p>Defines a class that stores date and time information used in TOML&rsquo;s <code>datetime</code>.</p> <h1 id="enum-class-month_t"> <code>enum class month_t</code> <a class="anchor" href="#enum-class-month_t">#</a> </h1> <p>Enum class to specify months.</p> <p>Due to its relationship with <code>std::tm</code>, <code>local_date</code> treats January as <code>0</code>. To avoid confusion, <code>month_t</code> allows specification of months by their names.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">enum</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">month_t</span> <span style="color:#f92672">:</span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint8_t</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> Jan <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>, </span></span><span style="display:flex;"><span> Feb <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>, </span></span><span style="display:flex;"><span> Mar <span style="color:#f92672">=</span> <span style="color:#ae81ff">2</span>, </span></span><span style="display:flex;"><span> Apr <span style="color:#f92672">=</span> <span style="color:#ae81ff">3</span>, </span></span><span style="display:flex;"><span> May <span style="color:#f92672">=</span> <span style="color:#ae81ff">4</span>, </span></span><span style="display:flex;"><span> Jun <span style="color:#f92672">=</span> <span style="color:#ae81ff">5</span>, </span></span><span style="display:flex;"><span> Jul <span style="color:#f92672">=</span> <span style="color:#ae81ff">6</span>, </span></span><span style="display:flex;"><span> Aug <span style="color:#f92672">=</span> <span style="color:#ae81ff">7</span>, </span></span><span style="display:flex;"><span> Sep <span style="color:#f92672">=</span> <span style="color:#ae81ff">8</span>, </span></span><span style="display:flex;"><span> Oct <span style="color:#f92672">=</span> <span style="color:#ae81ff">9</span>, </span></span><span style="display:flex;"><span> Nov <span style="color:#f92672">=</span> <span style="color:#ae81ff">10</span>, </span></span><span style="display:flex;"><span> Dec <span style="color:#f92672">=</span> <span style="color:#ae81ff">11</span> </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><h1 id="local_date"> <code>local_date</code> <a class="anchor" href="#local_date">#</a> </h1> <p><code>local_date</code> holds a date.</p>

# error_info.hpp

https://toruniina.github.io/toml11/docs/reference/error_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/error_info/<h1 id="error_infohpp"> error_info.hpp <a class="anchor" href="#error_infohpp">#</a> </h1> <p>In <code>error_info.hpp</code>, definitions for <code>error_info</code> and functions to format it are provided.</p> <h1 id="tomlerror_info"> <code>toml::error_info</code> <a class="anchor" href="#tomlerror_info">#</a> </h1> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">error_info</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> error_info(std<span style="color:#f92672">::</span>string t, source_location l, std<span style="color:#f92672">::</span>string m, std<span style="color:#f92672">::</span>string s <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;&#34;</span>); </span></span><span style="display:flex;"><span> error_info(std<span style="color:#f92672">::</span>string t, std<span style="color:#f92672">::</span>vector<span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>pair<span style="color:#f92672">&lt;</span>source_location, std<span style="color:#f92672">::</span>string<span style="color:#f92672">&gt;&gt;</span> l, std<span style="color:#f92672">::</span>string s <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;&#34;</span>); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> title() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#f92672">&amp;</span> title() <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>vector<span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>pair<span style="color:#f92672">&lt;</span>source_location, std<span style="color:#f92672">::</span>string<span style="color:#f92672">&gt;&gt;</span> <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> locations() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">void</span> <span style="color:#a6e22e">add_locations</span>(source_location loc, std<span style="color:#f92672">::</span>string msg) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> suffix() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#f92672">&amp;</span> suffix() <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> ... Ts<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>error_info make_error_info( </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string title, source_location loc, std<span style="color:#f92672">::</span>string msg, Ts<span style="color:#f92672">&amp;&amp;</span> ... tail); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format_error(<span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span>string<span style="color:#f92672">&amp;</span> errkind, <span style="color:#66d9ef">const</span> error_info<span style="color:#f92672">&amp;</span> err); </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format_error(<span style="color:#66d9ef">const</span> error_info<span style="color:#f92672">&amp;</span> err); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> ... Ts<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format_error(std<span style="color:#f92672">::</span>string title, </span></span><span style="display:flex;"><span> source_location loc, std<span style="color:#f92672">::</span>string msg, Ts<span style="color:#f92672">&amp;&amp;</span> ... tail); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;&lt;</span>(std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> os, <span style="color:#66d9ef">const</span> error_info<span style="color:#f92672">&amp;</span> e); </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><h2 id="member-functions"> Member Functions <a class="anchor" href="#member-functions">#</a> </h2> <h3 id="constructor-title-loc-msg-suffix"> Constructor (<code>title, loc, msg, suffix</code>) <a class="anchor" href="#constructor-title-loc-msg-suffix">#</a> </h3> <p>Constructs <code>error_info</code> with specified <code>title</code>, location information <code>loc</code>, message <code>msg</code>, and optional <code>suffix</code>.</p>

# exception.hpp

https://toruniina.github.io/toml11/docs/reference/exception/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/exception/<h1 id="exceptionhpp"> exception.hpp <a class="anchor" href="#exceptionhpp">#</a> </h1> <h1 id="tomlexception"> <code>toml::exception</code> <a class="anchor" href="#tomlexception">#</a> </h1> <p>Base class for exception types defined in toml11.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">exception</span> <span style="color:#f92672">:</span> <span style="color:#66d9ef">public</span> std<span style="color:#f92672">::</span>exception </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">public</span><span style="color:#f92672">:</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">virtual</span> <span style="color:#f92672">~</span>exception() <span style="color:#66d9ef">noexcept</span> <span style="color:#66d9ef">override</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">virtual</span> <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char</span><span style="color:#f92672">*</span> <span style="color:#a6e22e">what</span>() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span> <span style="color:#66d9ef">override</span> {<span style="color:#66d9ef">return</span> <span style="color:#e6db74">&#34;&#34;</span>;} </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h2 id="member-functions"> Member Functions <a class="anchor" href="#member-functions">#</a> </h2> <h3 id="destructor"> Destructor <a class="anchor" href="#destructor">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">virtual</span> <span style="color:#f92672">~</span>exception() <span style="color:#66d9ef">noexcept</span> <span style="color:#66d9ef">override</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span></code></pre></div><p>Override when derived.</p> <h3 id="what"> <code>what</code> <a class="anchor" href="#what">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">virtual</span> <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char</span><span style="color:#f92672">*</span> <span style="color:#a6e22e">what</span>() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span> <span style="color:#66d9ef">override</span> {<span style="color:#66d9ef">return</span> <span style="color:#e6db74">&#34;&#34;</span>;} </span></span></code></pre></div><p>Returns the error message. Override when derived.</p>

# find.hpp

https://toruniina.github.io/toml11/docs/reference/find/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/find/<h1 id="findhpp"> find.hpp <a class="anchor" href="#findhpp">#</a> </h1> <p>This function searches for a value in a <code>toml::value</code> and performs type conversion if necessary.</p> <blockquote class="book-hint info"> <code>toml::value</code> can change the type it stores, and <code>toml::find</code> accommodates these types. Technically, all functions use <code>toml::basic_value&lt;TC&gt;</code>. However, for simplicity, we refer to it as <code>toml::value</code> in explanations unless a distinction is necessary. In the documentation, if the template parameter <code>TC</code> changes the type, assume that types like <code>toml::value::integer_type</code> will also change accordingly. </blockquote> <h1 id="tomlfind"> <code>toml::find</code> <a class="anchor" href="#tomlfind">#</a> </h1> <h2 id="overview"> Overview <a class="anchor" href="#overview">#</a> </h2> <p><code>toml::find</code> uses template arguments for the type you want to retrieve and function arguments for the key of the value you want to find.</p>

# format.hpp

https://toruniina.github.io/toml11/docs/reference/format/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/format/<h1 id="formathpp"> format.hpp <a class="anchor" href="#formathpp">#</a> </h1> <p>Defines structures and enumerations related to formatting information for <code>toml::value</code>.</p> <h1 id="indent_char"> <code>indent_char</code> <a class="anchor" href="#indent_char">#</a> </h1> <p>An enumeration representing the indentation character choice.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">enum</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">indent_char</span> <span style="color:#f92672">:</span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint8_t</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> space, <span style="color:#75715e">// use space </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> tab, <span style="color:#75715e">// use tab </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> none <span style="color:#75715e">// no indent </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>}; </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;&lt;</span>(std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> os, <span style="color:#66d9ef">const</span> indent_char<span style="color:#f92672">&amp;</span> c); </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string to_string(<span style="color:#66d9ef">const</span> indent_char); </span></span></code></pre></div><p>Choosing <code>none</code> means no indentation is used, regardless of the value in super tables.</p> <p>If both <code>space</code> and <code>tab</code> are specified within the serializable value, the behavior is unspecified; typically, the unspecified indentation character appears.</p>

# from.hpp

https://toruniina.github.io/toml11/docs/reference/from/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/from/<h1 id="fromhpp"> from.hpp <a class="anchor" href="#fromhpp">#</a> </h1> <p>Defines a <code>struct</code> used for conversion from <code>toml::value</code> in <code>toml::get</code> and <code>toml::find</code>.</p> <p>You can achieve the same functionality by adding a <code>from_toml</code> member function, but for classes where you cannot add member functions, use <code>from&lt;T&gt;</code>.</p> <p>This file does not provide specific implementations. Please specialize this <code>struct</code> when using.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> T<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">from</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h2 id="example"> Example <a class="anchor" href="#example">#</a> </h2> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> extlib </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">foo</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">int</span> a; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string b; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// extlib </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> </span></span><span style="display:flex;"><span><span style="color:#75715e">#include</span> <span style="color:#75715e">&lt;toml11/from.hpp&gt;</span><span style="color:#75715e"> </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">from</span><span style="color:#f92672">&lt;</span>extlib<span style="color:#f92672">::</span>foo<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">static</span> extlib<span style="color:#f92672">::</span>foo from_toml(<span style="color:#66d9ef">const</span> toml<span style="color:#f92672">::</span>basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span> v) </span></span><span style="display:flex;"><span> { </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">return</span> extlib<span style="color:#f92672">::</span>foo{toml<span style="color:#f92672">::</span>find<span style="color:#f92672">&lt;</span><span style="color:#66d9ef">int</span><span style="color:#f92672">&gt;</span>(v, <span style="color:#e6db74">&#34;a&#34;</span>), toml<span style="color:#f92672">::</span>find<span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>string<span style="color:#f92672">&gt;</span>(v, <span style="color:#e6db74">&#34;b&#34;</span>)}; </span></span><span style="display:flex;"><span> } </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h1 id="related"> Related <a class="anchor" href="#related">#</a> </h1> <ul> <li><a href="https://toruniina.github.io/toml11/docs/reference/conversion/">conversion.hpp</a></li> <li><a href="https://toruniina.github.io/toml11/docs/reference/into/">into.hpp</a></li> </ul>

# get.hpp

https://toruniina.github.io/toml11/docs/reference/get/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/get/<h1 id="gethpp"> get.hpp <a class="anchor" href="#gethpp">#</a> </h1> <p>These are functions for extracting values from <code>toml::value</code> and performing type conversions if necessary.</p> <blockquote class="book-hint info"> <code>toml::value</code> can change the type it stores, and <code>toml::get</code> accommodates these types. Technically, all functions use <code>toml::basic_value&lt;TC&gt;</code>. However, for simplicity, we refer to it as <code>toml::value</code> in explanations unless a distinction is necessary. In the documentation, if the template parameter <code>TC</code> changes the type, assume that types like <code>toml::value::integer_type</code> will also change accordingly. </blockquote> <h1 id="tomlgett"> <code>toml::get&lt;T&gt;</code> <a class="anchor" href="#tomlgett">#</a> </h1> <h2 id="overview"> Overview <a class="anchor" href="#overview">#</a> </h2> <p>Generally, <code>toml::get</code> behaves as follows: You specify <code>T</code> as in <code>toml::get&lt;int&gt;(v)</code>.</p>

# into.hpp

https://toruniina.github.io/toml11/docs/reference/into/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/into/<h1 id="intohpp"> into.hpp <a class="anchor" href="#intohpp">#</a> </h1> <p>Defines a <code>struct</code> used for conversion from user-defined types into <code>toml::value</code> constructors.</p> <p>You can achieve the same functionality by adding an <code>into_toml</code> member function, but for classes where you cannot add member functions, use <code>into&lt;T&gt;</code>.</p> <p>This file does not provide specific implementations. Please specialize this <code>struct</code> when using.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> T<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">into</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h2 id="example"> Example <a class="anchor" href="#example">#</a> </h2> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> extlib </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">foo</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">int</span> a; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string b; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// extlib </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> </span></span><span style="display:flex;"><span><span style="color:#75715e">#include</span> <span style="color:#75715e">&lt;toml11/into.hpp&gt;</span><span style="color:#75715e"> </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">into</span><span style="color:#f92672">&lt;</span>extlib<span style="color:#f92672">::</span>foo<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">static</span> toml<span style="color:#f92672">::</span>basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;</span> into_toml(<span style="color:#66d9ef">const</span> extlib<span style="color:#f92672">::</span>foo<span style="color:#f92672">&amp;</span> f) </span></span><span style="display:flex;"><span> { </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> value_type <span style="color:#f92672">=</span> toml<span style="color:#f92672">::</span>basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> table_type <span style="color:#f92672">=</span> <span style="color:#66d9ef">typename</span> value_type<span style="color:#f92672">::</span>table_type; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">value_type</span>(table_type{{<span style="color:#e6db74">&#34;a&#34;</span>, f.a}, {<span style="color:#e6db74">&#34;b&#34;</span>, f.b}}); </span></span><span style="display:flex;"><span> } </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h1 id="related"> Related <a class="anchor" href="#related">#</a> </h1> <ul> <li><a href="https://toruniina.github.io/toml11/docs/reference/conversion/">conversion.hpp</a></li> <li><a href="https://toruniina.github.io/toml11/docs/reference/from/">from.hpp</a></li> </ul>

# literal.hpp

https://toruniina.github.io/toml11/docs/reference/literal/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/literal/<h1 id="literalhpp"> literal.hpp <a class="anchor" href="#literalhpp">#</a> </h1> <p>In <code>literal.hpp</code>, the <code>_toml</code> literal is defined.</p> <p>The <code>_toml</code> literal parses string literals into <code>toml::value</code>.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">inline</span> <span style="color:#66d9ef">namespace</span> literals </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">inline</span> <span style="color:#66d9ef">namespace</span> toml_literals </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span>toml<span style="color:#f92672">::</span>value <span style="color:#66d9ef">operator</span><span style="color:#e6db74">&#34;&#34;</span> _toml(<span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char</span><span style="color:#f92672">*</span> str, std<span style="color:#f92672">::</span>size_t len); </span></span><span style="display:flex;"><span>toml<span style="color:#f92672">::</span>value <span style="color:#66d9ef">operator</span><span style="color:#e6db74">&#34;&#34;</span> _toml(<span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char8_t</span><span style="color:#f92672">*</span> str, std<span style="color:#f92672">::</span>size_t len); <span style="color:#75715e">// Available in C++20 and later </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>} <span style="color:#75715e">// toml_literals </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>} <span style="color:#75715e">// literals </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h2 id="free-functions"> Free Functions <a class="anchor" href="#free-functions">#</a> </h2> <h3 id="operator-_tomlconst-char"> <code>operator&quot;&quot; _toml(const char*)</code> <a class="anchor" href="#operator-_tomlconst-char">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span>toml<span style="color:#f92672">::</span>value <span style="color:#66d9ef">operator</span><span style="color:#e6db74">&#34;&#34;</span> _toml(<span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char</span><span style="color:#f92672">*</span> str, std<span style="color:#f92672">::</span>size_t len); </span></span></code></pre></div><p>Converts a string literal into a <code>toml::value</code> by parsing it.</p>

# ordered_map.hpp

https://toruniina.github.io/toml11/docs/reference/ordered_map/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/ordered_map/<h1 id="ordered_maphpp"> ordered_map.hpp <a class="anchor" href="#ordered_maphpp">#</a> </h1> <p>Defines <code>toml::ordered_map</code>, which is used to maintain the order of values in a file.</p> <h1 id="class-ordered_map"> <code>class ordered_map</code> <a class="anchor" href="#class-ordered_map">#</a> </h1> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> Key, <span style="color:#66d9ef">typename</span> Val, <span style="color:#66d9ef">typename</span> Cmp <span style="color:#f92672">=</span> std<span style="color:#f92672">::</span>equal_to<span style="color:#f92672">&lt;</span>Key<span style="color:#f92672">&gt;</span>, </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">typename</span> Allocator <span style="color:#f92672">=</span> std<span style="color:#f92672">::</span>allocator<span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>pair<span style="color:#f92672">&lt;</span>Key, Val<span style="color:#f92672">&gt;&gt;&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">ordered_map</span>; </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p>The <code>ordered_map</code> is a <code>map</code> type that preserves the insertion order of values, allowing iteration in that order.</p> <p>As a linear container, searches require <code>O(n)</code> time relative to the number of elements. Use this when search operations are infrequent and maintaining the order of values is important.</p>

# parser.hpp

https://toruniina.github.io/toml11/docs/reference/parser/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/parser/<h1 id="parserhpp"> parser.hpp <a class="anchor" href="#parserhpp">#</a> </h1> <p>Defines functions for parsing files or strings and the exceptions they use.</p> <p>While <code>parse</code> throws an exception on failure, <code>try_parse</code> returns error information.</p> <h1 id="parse"> <code>parse</code> <a class="anchor" href="#parse">#</a> </h1> <p>Parses the content of a given file and returns a <code>toml::basic_value</code>.</p> <p>In case of failure, <code>toml::syntax_error</code> is thrown.</p> <p>The type information of <code>basic_value</code> is provided by a <code>template</code>, and the TOML language version is specified by <code>toml::spec</code>.</p> <h3 id="parsestdstring-filename-tomlspec"> <code>parse(std::string filename, toml::spec)</code> <a class="anchor" href="#parsestdstring-filename-tomlspec">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC <span style="color:#f92672">=</span> type_config<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>parse(std<span style="color:#f92672">::</span>string fname, </span></span><span style="display:flex;"><span> spec s <span style="color:#f92672">=</span> spec<span style="color:#f92672">::</span>default_version()); </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p>Parses the content of the given filename.</p>

# result.hpp

https://toruniina.github.io/toml11/docs/reference/result/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/result/<h1 id="resulthpp"> result.hpp <a class="anchor" href="#resulthpp">#</a> </h1> <p><code>result.hpp</code> defines the <code>result</code> type, which can hold either a success value or a failure value.</p> <p>This is used as the return type for <code>toml::try_parse</code>, which does not throw exceptions.</p> <h1 id="success"> success <a class="anchor" href="#success">#</a> </h1> <p>A type that holds a success value.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> T<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">success</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> value_type <span style="color:#f92672">=</span> T; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">explicit</span> <span style="color:#a6e22e">success</span>(value_type v); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">~</span>success() <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> success(<span style="color:#66d9ef">const</span> success<span style="color:#f92672">&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> success(success<span style="color:#f92672">&amp;&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> success<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">=</span>(<span style="color:#66d9ef">const</span> success<span style="color:#f92672">&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> success<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">=</span>(success<span style="color:#f92672">&amp;&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> U<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">explicit</span> success(U<span style="color:#f92672">&amp;&amp;</span> v); </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> U<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">explicit</span> success(success<span style="color:#f92672">&lt;</span>U<span style="color:#f92672">&gt;</span> v); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> value_type<span style="color:#f92672">&amp;</span> get() <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> value_type <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> get() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> T<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>success<span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> std<span style="color:#f92672">::</span>decay<span style="color:#f92672">&lt;</span>T<span style="color:#f92672">&gt;::</span>type<span style="color:#f92672">&gt;</span> ok(T<span style="color:#f92672">&amp;&amp;</span> v); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>size_t N<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>success<span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>string<span style="color:#f92672">&gt;</span> ok(<span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char</span> (<span style="color:#f92672">&amp;</span>literal)[N]) </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><h2 id="member-types"> Member Types <a class="anchor" href="#member-types">#</a> </h2> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">using</span> value_type <span style="color:#f92672">=</span> T; </span></span></code></pre></div><p>The type of the success value.</p>

# serializer.hpp

https://toruniina.github.io/toml11/docs/reference/serializer/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/serializer/<h1 id="serializerhpp"> serializer.hpp <a class="anchor" href="#serializerhpp">#</a> </h1> <h2 id="format"> <code>format</code> <a class="anchor" href="#format">#</a> </h2> <p>Serializes the data.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format(<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span> v, </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">const</span> spec s <span style="color:#f92672">=</span> spec<span style="color:#f92672">::</span>default_version()); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format(<span style="color:#66d9ef">const</span> <span style="color:#66d9ef">typename</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;::</span>key_type<span style="color:#f92672">&amp;</span> k, </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span> v, </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">const</span> spec s <span style="color:#f92672">=</span> spec<span style="color:#f92672">::</span>default_version()); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format(<span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span>vector<span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;::</span>key_type<span style="color:#f92672">&gt;&amp;</span> ks, </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span> v, </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">const</span> spec s <span style="color:#f92672">=</span> spec<span style="color:#f92672">::</span>default_version()); </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p>If there&rsquo;s a conflict between the format information and the <code>spec</code>, for example, when using <code>v1.0.0</code> with <code>table_format::multiline_oneline</code>, the <code>spec</code> takes precedence.</p>

# source_location.hpp

https://toruniina.github.io/toml11/docs/reference/source_location/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/source_location/<h1 id="source_locationhpp"> source_location.hpp <a class="anchor" href="#source_locationhpp">#</a> </h1> <p><code>source_location.hpp</code> defines a class representing a specific area within a TOML file.</p> <p>This class is used to represent problematic areas in error messages.</p> <h1 id="tomlsource_location"> <code>toml::source_location</code> <a class="anchor" href="#tomlsource_location">#</a> </h1> <p><code>source_location</code> is a class representing a specific area within a TOML file.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">source_location</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">public</span><span style="color:#f92672">:</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">explicit</span> source_location(<span style="color:#75715e">/* implementation-defined */</span>); </span></span><span style="display:flex;"><span> <span style="color:#f92672">~</span>source_location() <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> source_location(source_location <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> source_location(source_location <span style="color:#f92672">&amp;&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> source_location<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">=</span>(source_location <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> source_location<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">=</span>(source_location <span style="color:#f92672">&amp;&amp;</span>) <span style="color:#f92672">=</span> <span style="color:#66d9ef">default</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">bool</span> <span style="color:#a6e22e">is_ok</span>() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>size_t length() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>size_t first_line_number() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>size_t first_column_number() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>size_t last_line_number() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>size_t last_column_number() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> file_name() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>size_t num_lines() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> first_line() <span style="color:#66d9ef">const</span>; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>string <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> last_line() <span style="color:#66d9ef">const</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span>vector<span style="color:#f92672">&lt;</span>std<span style="color:#f92672">::</span>string<span style="color:#f92672">&gt;</span> <span style="color:#66d9ef">const</span><span style="color:#f92672">&amp;</span> lines() <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> ... Ts<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string format_location(<span style="color:#66d9ef">const</span> source_location<span style="color:#f92672">&amp;</span> loc, <span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span>string<span style="color:#f92672">&amp;</span> msg, <span style="color:#66d9ef">const</span> Ts<span style="color:#f92672">&amp;</span> ... locs_and_msgs); </span></span><span style="display:flex;"><span>} <span style="color:#75715e">//toml </span></span></span></code></pre></div><h2 id="member-functions"> Member Functions <a class="anchor" href="#member-functions">#</a> </h2> <h3 id="constructor"> Constructor <a class="anchor" href="#constructor">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">explicit</span> <span style="color:#a6e22e">source_location</span>(<span style="color:#75715e">/* implementation-defined */</span>); </span></span></code></pre></div><p><code>toml::source_location</code> can only be constructed via <code>toml::parse</code> or the <code>_toml</code> literal.</p>

# spec.hpp

https://toruniina.github.io/toml11/docs/reference/spec/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/spec/<h1 id="spechpp"> spec.hpp <a class="anchor" href="#spechpp">#</a> </h1> <p><code>spec.hpp</code> defines classes for specifying the version of TOML.</p> <h1 id="tomlsemantic_version"> <code>toml::semantic_version</code> <a class="anchor" href="#tomlsemantic_version">#</a> </h1> <p><code>semantic_version</code> is a class that stores version information.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">semantic_version</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">constexpr</span> <span style="color:#a6e22e">semantic_version</span>(std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> mjr, std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> mnr, std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> p) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> major; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> minor; </span></span><span style="display:flex;"><span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> patch; </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> semantic_version </span></span><span style="display:flex;"><span><span style="color:#a6e22e">make_semver</span>(std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> major, std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> minor, std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> patch) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">==</span>(<span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">!=</span>(<span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;</span> (<span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;=</span>(<span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&gt;</span> (<span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&gt;=</span>(<span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span>) <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;&lt;</span>(std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> os, <span style="color:#66d9ef">const</span> semantic_version<span style="color:#f92672">&amp;</span> ver); </span></span><span style="display:flex;"><span>} <span style="color:#75715e">//toml </span></span></span></code></pre></div><h2 id="member-functions"> Member Functions <a class="anchor" href="#member-functions">#</a> </h2> <h3 id="constructor"> Constructor <a class="anchor" href="#constructor">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">constexpr</span> <span style="color:#a6e22e">semantic_version</span>(std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> mjr, std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> mnr, std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint32_t</span> p) <span style="color:#66d9ef">noexcept</span>; </span></span></code></pre></div><p>Constructs a <code>semantic_version</code> instance with the specified <code>major</code>, <code>minor</code>, and <code>patch</code> version numbers.</p>

# toml_fwd.hpp

https://toruniina.github.io/toml11/docs/reference/toml_fwd/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/toml_fwd/<h1 id="toml_fwdhpp"> toml_fwd.hpp <a class="anchor" href="#toml_fwdhpp">#</a> </h1> <p><code>toml_fwd.hpp</code> contains forward declarations of structures defined in toml11 and macro definitions.</p> <p>When only forward declarations of toml11 structures are needed and implementation is not required, including <code>toml_fwd.hpp</code> instead of <code>toml.hpp</code> can reduce compilation time.</p> <blockquote class="book-hint warning"> Since this file only contains forward declarations, you cannot use <code>toml::table</code>, defined as <code>toml::basic_value&lt;toml::type_config&gt;::table_type</code>, and similarly defined <code>toml::array</code>. This is because they require the implementation of <code>basic_value</code>. </blockquote> <p>This header file and <code>toml.hpp</code> are located under <code>${TOML11_INCLUDE_DIR}/</code>, while other header files are located under <code>${TOML11_INCLUDE_DIR}/toml11/</code>.</p>

# toml.hpp

https://toruniina.github.io/toml11/docs/reference/toml/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/toml/<h1 id="tomlhpp"> toml.hpp <a class="anchor" href="#tomlhpp">#</a> </h1> <p><code>toml.hpp</code> includes all other headers.</p> <p>This allows access to all features of toml11.</p> <p>This header file and <code>toml_fwd.hpp</code> are located under <code>${TOML11_INCLUDE_DIR}/</code>, while other header files are located under <code>${toml11_include_dir}/toml11/</code>.</p>

# types.hpp

https://toruniina.github.io/toml11/docs/reference/types/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/types/<h1 id="typeshpp"> types.hpp <a class="anchor" href="#typeshpp">#</a> </h1> <p>This document defines classes that specifies type information.</p> <h1 id="type_config"> <code>type_config</code> <a class="anchor" href="#type_config">#</a> </h1> <p><code>type_config</code> is a type that encapsulates parameters given to <code>toml::basic_value</code>.</p> <p>When using different types within <code>toml::basic_value&lt;T&gt;</code>, you need to define and pass this type separately. All elements listed are required.</p> <p>If you use numerical types that cannot use standard stream operators, define and replace the equivalents for <code>read_int</code> and <code>read_float</code>.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">type_config</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> comment_type <span style="color:#f92672">=</span> preserve_comments; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> boolean_type <span style="color:#f92672">=</span> <span style="color:#66d9ef">bool</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> integer_type <span style="color:#f92672">=</span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">int64_t</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> floating_type <span style="color:#f92672">=</span> <span style="color:#66d9ef">double</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> string_type <span style="color:#f92672">=</span> std<span style="color:#f92672">::</span>string; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> T<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> array_type <span style="color:#f92672">=</span> std<span style="color:#f92672">::</span>vector<span style="color:#f92672">&lt;</span>T<span style="color:#f92672">&gt;</span>; </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> K, <span style="color:#66d9ef">typename</span> T<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">using</span> table_type <span style="color:#f92672">=</span> std<span style="color:#f92672">::</span>unordered_map<span style="color:#f92672">&lt;</span>K, T<span style="color:#f92672">&gt;</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">static</span> result<span style="color:#f92672">&lt;</span>integer_type, error_info<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> parse_int(<span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span>string<span style="color:#f92672">&amp;</span> str, <span style="color:#66d9ef">const</span> source_location src, <span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint8_t</span> base); </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#66d9ef">static</span> result<span style="color:#f92672">&lt;</span>floating_type, error_info<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span> parse_float(<span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span>string<span style="color:#f92672">&amp;</span> str, <span style="color:#66d9ef">const</span> source_location src, <span style="color:#66d9ef">const</span> <span style="color:#66d9ef">bool</span> is_hex); </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">using</span> value <span style="color:#f92672">=</span> basic_value<span style="color:#f92672">&lt;</span>type_config<span style="color:#f92672">&gt;</span>; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">using</span> table <span style="color:#f92672">=</span> <span style="color:#66d9ef">typename</span> value<span style="color:#f92672">::</span>table_type; </span></span><span style="display:flex;"><span><span style="color:#66d9ef">using</span> array <span style="color:#f92672">=</span> <span style="color:#66d9ef">typename</span> value<span style="color:#f92672">::</span>array_type; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h2 id="static-member-functions"> <code>static</code> Member Functions <a class="anchor" href="#static-member-functions">#</a> </h2> <h3 id="parse_intstr-src-base"> <code>parse_int(str, src, base)</code> <a class="anchor" href="#parse_intstr-src-base">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">static</span> result<span style="color:#f92672">&lt;</span>integer_type, error_info<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span>parse_int(<span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span>string<span style="color:#f92672">&amp;</span> str, <span style="color:#66d9ef">const</span> source_location src, <span style="color:#66d9ef">const</span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint8_t</span> base); </span></span></code></pre></div><p>If you use a type as <code>integer_type</code> that cannot utilize standard stream operators, implement this function. Otherwise, use <code>read_int</code> described later.</p>

# value_t.hpp

https://toruniina.github.io/toml11/docs/reference/value_t/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/value_t/<h1 id="value_thpp"> value_t.hpp <a class="anchor" href="#value_thpp">#</a> </h1> <h1 id="value_t"> <code>value_t</code> <a class="anchor" href="#value_t">#</a> </h1> <p><code>value_t</code> is used to handle the type information of <code>toml::value</code>.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">enum</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">value_t</span> <span style="color:#f92672">:</span> std<span style="color:#f92672">::</span><span style="color:#66d9ef">uint8_t</span> </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span> empty <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>, </span></span><span style="display:flex;"><span> boolean <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>, </span></span><span style="display:flex;"><span> integer <span style="color:#f92672">=</span> <span style="color:#ae81ff">2</span>, </span></span><span style="display:flex;"><span> floating <span style="color:#f92672">=</span> <span style="color:#ae81ff">3</span>, </span></span><span style="display:flex;"><span> string <span style="color:#f92672">=</span> <span style="color:#ae81ff">4</span>, </span></span><span style="display:flex;"><span> offset_datetime <span style="color:#f92672">=</span> <span style="color:#ae81ff">5</span>, </span></span><span style="display:flex;"><span> local_datetime <span style="color:#f92672">=</span> <span style="color:#ae81ff">6</span>, </span></span><span style="display:flex;"><span> local_date <span style="color:#f92672">=</span> <span style="color:#ae81ff">7</span>, </span></span><span style="display:flex;"><span> local_time <span style="color:#f92672">=</span> <span style="color:#ae81ff">8</span>, </span></span><span style="display:flex;"><span> array <span style="color:#f92672">=</span> <span style="color:#ae81ff">9</span>, </span></span><span style="display:flex;"><span> table <span style="color:#f92672">=</span> <span style="color:#ae81ff">10</span> </span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;&lt;</span>(std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> os, value_t t); </span></span><span style="display:flex;"><span>std<span style="color:#f92672">::</span>string to_string(value_t t); </span></span><span style="display:flex;"><span>} <span style="color:#75715e">// toml </span></span></span></code></pre></div><h2 id="non-member-functions"> Non-member Functions <a class="anchor" href="#non-member-functions">#</a> </h2> <h3 id="stream-operator"> Stream Operator <a class="anchor" href="#stream-operator">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span>std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;&lt;</span>(std<span style="color:#f92672">::</span>ostream<span style="color:#f92672">&amp;</span> os, value_t t); </span></span></code></pre></div><p>Outputs the string representation of the <code>value_t</code> to the stream.</p>

# value.hpp

https://toruniina.github.io/toml11/docs/reference/value/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/value/<h1 id="valuehpp"> value.hpp <a class="anchor" href="#valuehpp">#</a> </h1> <p><code>value.hpp</code> defines <code>basic_value</code>.</p> <h1 id="tomlbasic_value"> <code>toml::basic_value</code> <a class="anchor" href="#tomlbasic_value">#</a> </h1> <p><code>basic_value</code> is a class that stores TOML values.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span> <span style="color:#f92672">&lt;</span><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">TypeConfig</span><span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">basic_value</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span><span style="color:#75715e">// Defined in types.hpp </span></span></span><span style="display:flex;"><span><span style="color:#75715e">// using value = basic_value&lt;type_config&gt;; </span></span></span><span style="display:flex;"><span><span style="color:#75715e">// using table = typename basic_value&lt;type_config&gt;::table_type; </span></span></span><span style="display:flex;"><span><span style="color:#75715e">// using array = typename basic_value&lt;type_config&gt;::array_type; </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">==</span>(<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>, <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">!=</span>(<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>, <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;</span> (<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>, <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&lt;=</span>(<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>, <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&gt;</span> (<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>, <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>); </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> TC<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#66d9ef">bool</span> <span style="color:#66d9ef">operator</span><span style="color:#f92672">&gt;=</span>(<span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>, <span style="color:#66d9ef">const</span> basic_value<span style="color:#f92672">&lt;</span>TC<span style="color:#f92672">&gt;&amp;</span>); </span></span><span style="display:flex;"><span>} <span style="color:#75715e">//toml </span></span></span></code></pre></div><h2 id="member-types"> Member Types <a class="anchor" href="#member-types">#</a> </h2> <p>The following member types are defined.</p>

# version.hpp

https://toruniina.github.io/toml11/docs/reference/version/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/version/<h1 id="versionhpp"> version.hpp <a class="anchor" href="#versionhpp">#</a> </h1> <p>In <code>version.hpp</code>, macros related to the version information of toml11 are defined.</p> <h2 id="macros"> Macros <a class="anchor" href="#macros">#</a> </h2> <h3 id="toml11_version_major"> <code>TOML11_VERSION_MAJOR</code> <a class="anchor" href="#toml11_version_major">#</a> </h3> <p>The major version of toml11.</p> <h3 id="toml11_version_minor"> <code>TOML11_VERSION_MINOR</code> <a class="anchor" href="#toml11_version_minor">#</a> </h3> <p>The minor version of toml11.</p> <h3 id="toml11_version_patch"> <code>TOML11_VERSION_PATCH</code> <a class="anchor" href="#toml11_version_patch">#</a> </h3> <p>The patch version of toml11.</p> <h2 id="function"> Function <a class="anchor" href="#function">#</a> </h2> <h3 id="license_notice"> <code>license_notice</code> <a class="anchor" href="#license_notice">#</a> </h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#66d9ef">char</span><span style="color:#f92672">*</span> <span style="color:#a6e22e">license_notice</span>() <span style="color:#66d9ef">noexcept</span>; </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p>Returns the license notice.</p> <p>Provided for convenience when redistributing without source code.</p>

# visit.hpp

https://toruniina.github.io/toml11/docs/reference/visit/ Mon, 01 Jan 0001 00:00:00 +0000 https://toruniina.github.io/toml11/docs/reference/visit/<h1 id="visithpp"> visit.hpp <a class="anchor" href="#visithpp">#</a> </h1> <p>In <code>visit.hpp</code>, <code>toml::visit</code> is defined.</p> <h1 id="tomlvisit"> <code>toml::visit</code> <a class="anchor" href="#tomlvisit">#</a> </h1> <h2 id="functions"> Functions <a class="anchor" href="#functions">#</a> </h2> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cpp" data-lang="cpp"><span style="display:flex;"><span><span style="color:#66d9ef">namespace</span> toml </span></span><span style="display:flex;"><span>{ </span></span><span style="display:flex;"><span><span style="color:#66d9ef">template</span><span style="color:#f92672">&lt;</span><span style="color:#66d9ef">typename</span> Visitor, <span style="color:#66d9ef">typename</span> ... Args<span style="color:#f92672">&gt;</span> </span></span><span style="display:flex;"><span><span style="color:#75715e">/* Return value when Visitor is called with a value of basic_value&lt;TC&gt; */</span> </span></span><span style="display:flex;"><span>visit(Visitor<span style="color:#f92672">&amp;&amp;</span> visitor, Args<span style="color:#f92672">&amp;&amp;</span> ... args); </span></span><span style="display:flex;"><span>} </span></span></code></pre></div><p><code>toml::visit</code> calls the overload of <code>Visitor</code> corresponding to the type held by <code>basic_value&lt;TC&gt;</code>, and returns the result.</p> <h4 id="requirements"> Requirements <a class="anchor" href="#requirements">#</a> </h4> <p><code>Visitor</code> must be a function or function object callable with any type held by <code>basic_value&lt;TC&gt;</code>.</p>