mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-12-16 03:08:52 +08:00
Merge pull request #295 from franzpoeschel/undef-source-location
Add a way to optionally suppress usage of std::source_location b96acf96ba
This commit is contained in:
148
docs/reference/types/index.html
Normal file
148
docs/reference/types/index.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
|
||||
types.hpp
|
||||
#
|
||||
|
||||
This document defines classes that specifies type information.
|
||||
|
||||
type_config
|
||||
#
|
||||
|
||||
type_config is a type that encapsulates parameters given to toml::basic_value.
|
||||
When using different types within toml::basic_value<T>, you need to define and pass this type separately.
|
||||
All elements listed are required.
|
||||
If you use numerical types that cannot use standard stream operators, define and replace the equivalents for read_int and read_float.
|
||||
namespace toml
|
||||
{
|
||||
struct type_config
|
||||
{
|
||||
using comment_type = preserve_comments;
|
||||
|
||||
using boolean_type = bool;
|
||||
using integer_type = std::int64_t;
|
||||
using floating_type = double;
|
||||
using string_type = std::string;
|
||||
|
||||
template<typename T>
|
||||
using array_type = std::vector<T>;
|
||||
template<typename K, typename T>
|
||||
using table_type = std::unordered_map<K, T>;
|
||||
|
||||
static result<integer_type, error_info>
|
||||
parse_int(const std::string& str, const source_location src, const std::uint8_t base);
|
||||
|
||||
static result<floating_type, error_info>
|
||||
parse_float(const std::string& str, const source_location src, const bool is_hex);
|
||||
};
|
||||
|
||||
using value = basic_value<type_config>;
|
||||
using table = typename value::table_type;
|
||||
using array = typename value::array_type;
|
||||
|
||||
} // toml
|
||||
|
||||
static Member Functions
|
||||
#
|
||||
|
||||
|
||||
parse_int(str, src, base)
|
||||
#
|
||||
|
||||
static result<integer_type, error_info>
|
||||
parse_int(const std::string& str, const source_location src, const std::uint8_t base);
|
||||
If you use a type as integer_type that cannot utilize standard stream operators, implement this function.
|
||||
Otherwise, use read_int described later."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/types/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="types.hpp"><meta property="og:description" content="types.hpp # This document defines classes that specifies type information.
|
||||
type_config # type_config is a type that encapsulates parameters given to toml::basic_value.
|
||||
When using different types within toml::basic_value<T>, you need to define and pass this type separately. All elements listed are required.
|
||||
If you use numerical types that cannot use standard stream operators, define and replace the equivalents for read_int and read_float.
|
||||
namespace toml { struct type_config { using comment_type = preserve_comments; using boolean_type = bool; using integer_type = std::int64_t; using floating_type = double; using string_type = std::string; template<typename T> using array_type = std::vector<T>; template<typename K, typename T> using table_type = std::unordered_map<K, T>; static result<integer_type, error_info> parse_int(const std::string& str, const source_location src, const std::uint8_t base); static result<floating_type, error_info> parse_float(const std::string& str, const source_location src, const bool is_hex); }; using value = basic_value<type_config>; using table = typename value::table_type; using array = typename value::array_type; } // toml static Member Functions # parse_int(str, src, base) # static result<integer_type, error_info> parse_int(const std::string& str, const source_location src, const std::uint8_t base); If you use a type as integer_type that cannot utilize standard stream operators, implement this function. Otherwise, use read_int described later."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>types.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/types/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/types/ title=types.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
|
||||
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
|
||||
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
|
||||
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/types/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
|
||||
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
|
||||
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/ class=active>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
|
||||
</label><strong>types.hpp</strong>
|
||||
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#typeshpp>types.hpp</a></li><li><a href=#type_config><code>type_config</code></a><ul><li><a href=#static-member-functions><code>static</code> Member Functions</a><ul><li><a href=#parse_intstr-src-base><code>parse_int(str, src, base)</code></a></li><li><a href=#parse_floatstr-src-is_hex><code>parse_float(str, src, is_hex)</code></a></li></ul></li><li><a href=#non-member-functions>Non-member Functions</a><ul><li><a href=#read_int><code>read_int</code></a></li><li><a href=#read_float><code>read_float</code></a></li></ul></li></ul></li><li><a href=#ordered_type_config><code>ordered_type_config</code></a></li></ul></nav></aside></header><article class="markdown book-article"><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<T></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><</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>></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><</span>T<span style=color:#f92672>></span>;
|
||||
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672><</span><span style=color:#66d9ef>typename</span> K, <span style=color:#66d9ef>typename</span> T<span style=color:#f92672>></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><</span>K, T<span style=color:#f92672>></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><</span>integer_type, error_info<span style=color:#f92672>></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>&</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><</span>floating_type, error_info<span style=color:#f92672>></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>&</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><</span>type_config<span style=color:#f92672>></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><</span>integer_type, error_info<span style=color:#f92672>></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>&</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><p>The <code>str</code> parameter receives a string with prefixes, leading zeros, and underscores removed.</p><p>The <code>src</code> parameter receives a <code>source_location</code> pointing to where the string was defined.</p><p>The <code>base</code> parameter receives one of <code>10</code>, <code>2</code>, <code>8</code>, or <code>16</code>.</p><h3 id=parse_floatstr-src-is_hex><code>parse_float(str, src, is_hex)</code>
|
||||
<a class=anchor href=#parse_floatstr-src-is_hex>#</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><</span>floating_type, error_info<span style=color:#f92672>></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>&</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></code></pre></div><p>If you use a type as <code>floating_type</code> that cannot utilize standard stream operators, implement this function.
|
||||
Otherwise, use <code>read_float</code> described later.</p><p>The <code>str</code> parameter receives a string with prefixes, leading zeros, and underscores removed.</p><p>The <code>src</code> parameter receives a <code>source_location</code> pointing to where the string was defined.</p><p>The <code>is_hex</code> parameter indicates whether the format is <code>hexfloat</code>. If you don’t use the <code>hexfloat</code> extension, you don’t need to implement this.</p><p>For details on the <code>hexfloat</code> extension, refer to <a href=https://toruniina.github.io/toml11/docs/reference/spec/>spec.hpp</a>.</p><h2 id=non-member-functions>Non-member Functions
|
||||
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=read_int><code>read_int</code>
|
||||
<a class=anchor href=#read_int>#</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>template</span><span style=color:#f92672><</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>></span>
|
||||
</span></span><span style=display:flex><span>result<span style=color:#f92672><</span>T, error_info<span style=color:#f92672>></span>
|
||||
</span></span><span style=display:flex><span>read_int(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&</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>This is the default function used. It parses using <code>std::istringstream</code>.</p><p>If <code>operator>></code> and manipulators like <code>std::hex</code>, and <code>std::numeric_limits<T></code> are defined (such as for <code>boost::multiprecision</code>), you can use this without modifications.</p><h3 id=read_float><code>read_float</code>
|
||||
<a class=anchor href=#read_float>#</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>template</span><span style=color:#f92672><</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>></span>
|
||||
</span></span><span style=display:flex><span>result<span style=color:#f92672><</span>T, error_info<span style=color:#f92672>></span>
|
||||
</span></span><span style=display:flex><span>read_float(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&</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></code></pre></div><p>This is the default function used. It parses decimals using <code>std::istringstream</code> and hexfloats using <code>sscanf()</code>.</p><p>It supports <code>double</code> and <code>float</code>.</p><p>For other types, if <code>operator>></code> is defined and <code>hex</code> is not used, you can use this function.</p><h1 id=ordered_type_config><code>ordered_type_config</code>
|
||||
<a class=anchor href=#ordered_type_config>#</a></h1><p><code>ordered_type_config</code> is a variation of <code>toml::type_config</code> where the table type is replaced with <code>toml::ordered_map</code>.
|
||||
Additionally, it defines the <code>toml::ordered_value</code> alias.</p><p>Other than these changes, it is identical to <code>type_config</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>ordered_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><</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>></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><</span>T<span style=color:#f92672>></span>;
|
||||
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672><</span><span style=color:#66d9ef>typename</span> K, <span style=color:#66d9ef>typename</span> T<span style=color:#f92672>></span>
|
||||
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> table_type <span style=color:#f92672>=</span> ordered_map<span style=color:#f92672><</span>K, T<span style=color:#f92672>></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><</span>integer_type, error_info<span style=color:#f92672>></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>&</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>return</span> read_int<span style=color:#f92672><</span>integer_type<span style=color:#f92672>></span>(str, src, 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><</span>floating_type, error_info<span style=color:#f92672>></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>&</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 style=color:#66d9ef>return</span> read_float<span style=color:#f92672><</span>floating_type<span style=color:#f92672>></span>(str, src, is_hex);
|
||||
</span></span><span style=display:flex><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>using</span> ordered_value <span style=color:#f92672>=</span> basic_value<span style=color:#f92672><</span>ordered_type_config<span style=color:#f92672>></span>;
|
||||
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_table <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> ordered_value<span style=color:#f92672>::</span>table_type;
|
||||
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_array <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> ordered_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></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#typeshpp>types.hpp</a></li><li><a href=#type_config><code>type_config</code></a><ul><li><a href=#static-member-functions><code>static</code> Member Functions</a><ul><li><a href=#parse_intstr-src-base><code>parse_int(str, src, base)</code></a></li><li><a href=#parse_floatstr-src-is_hex><code>parse_float(str, src, is_hex)</code></a></li></ul></li><li><a href=#non-member-functions>Non-member Functions</a><ul><li><a href=#read_int><code>read_int</code></a></li><li><a href=#read_float><code>read_float</code></a></li></ul></li></ul></li><li><a href=#ordered_type_config><code>ordered_type_config</code></a></li></ul></nav></div></aside></main></body></html>
|
||||
Reference in New Issue
Block a user