880 lines
49 KiB
HTML
880 lines
49 KiB
HTML
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||
|
|
<head>
|
||
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||
|
|
<meta name="generator" content="Doxygen 1.13.2"/>
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||
|
|
<title>libconfig: fourdst::config::Config< T > Class Template Reference</title>
|
||
|
|
<link rel="icon" href="logo.png" type="image/x-icon" />
|
||
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
||
|
|
<script type="text/javascript" src="clipboard.js"></script>
|
||
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
||
|
|
<script type="text/javascript" src="navtree.js"></script>
|
||
|
|
<script type="text/javascript" src="resize.js"></script>
|
||
|
|
<script type="text/javascript" src="cookie.js"></script>
|
||
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
||
|
|
<script type="text/javascript" src="search/search.js"></script>
|
||
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||
|
|
<div id="titlearea">
|
||
|
|
<table cellspacing="0" cellpadding="0">
|
||
|
|
<tbody>
|
||
|
|
<tr id="projectrow">
|
||
|
|
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
|
||
|
|
<td id="projectalign">
|
||
|
|
<div id="projectname">libconfig<span id="projectnumber"> v2.1.0</span>
|
||
|
|
</div>
|
||
|
|
<div id="projectbrief">Reflection based C++ configuration library</div>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<!-- end header part -->
|
||
|
|
<!-- Generated by Doxygen 1.13.2 -->
|
||
|
|
<script type="text/javascript">
|
||
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||
|
|
/* @license-end */
|
||
|
|
</script>
|
||
|
|
<script type="text/javascript">
|
||
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
|
$(function() { codefold.init(0); });
|
||
|
|
/* @license-end */
|
||
|
|
</script>
|
||
|
|
<script type="text/javascript" src="menudata.js"></script>
|
||
|
|
<script type="text/javascript" src="menu.js"></script>
|
||
|
|
<script type="text/javascript">
|
||
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
|
$(function() {
|
||
|
|
initMenu('',true,false,'search.php','Search',true);
|
||
|
|
$(function() { init_search(); });
|
||
|
|
});
|
||
|
|
/* @license-end */
|
||
|
|
</script>
|
||
|
|
<div id="main-nav"></div>
|
||
|
|
</div><!-- top -->
|
||
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
|
|
<div id="nav-tree">
|
||
|
|
<div id="nav-tree-contents">
|
||
|
|
<div id="nav-sync" class="sync"></div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
||
|
|
class="ui-resizable-handle">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<script type="text/javascript">
|
||
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||
|
|
$(function(){initNavTree('classfourdst_1_1config_1_1_config.html',''); initResizable(true); });
|
||
|
|
/* @license-end */
|
||
|
|
</script>
|
||
|
|
<div id="doc-content">
|
||
|
|
<!-- window showing the filter options -->
|
||
|
|
<div id="MSearchSelectWindow"
|
||
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- iframe showing the search results (closed by default) -->
|
||
|
|
<div id="MSearchResultsWindow">
|
||
|
|
<div id="MSearchResults">
|
||
|
|
<div class="SRPage">
|
||
|
|
<div id="SRIndex">
|
||
|
|
<div id="SRResults"></div>
|
||
|
|
<div class="SRStatus" id="Loading">Loading...</div>
|
||
|
|
<div class="SRStatus" id="Searching">Searching...</div>
|
||
|
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="header">
|
||
|
|
<div class="summary">
|
||
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
||
|
|
<a href="#pub-static-methods">Static Public Member Functions</a> |
|
||
|
|
<a href="#pri-attribs">Private Attributes</a> |
|
||
|
|
<a href="classfourdst_1_1config_1_1_config-members.html">List of all members</a> </div>
|
||
|
|
<div class="headertitle"><div class="title">fourdst::config::Config< T > Class Template Reference</div></div>
|
||
|
|
</div><!--header-->
|
||
|
|
<div class="contents">
|
||
|
|
|
||
|
|
<p>Wrapper class for managing strongly-typed configuration structures.
|
||
|
|
<a href="#details">More...</a></p>
|
||
|
|
|
||
|
|
<p><code>#include <base.h></code></p>
|
||
|
|
<div class="dynheader">
|
||
|
|
Collaboration diagram for fourdst::config::Config< T >:</div>
|
||
|
|
<div class="dyncontent">
|
||
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="classfourdst_1_1config_1_1_config__coll__graph.svg" width="212" height="215"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||
|
|
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
|
||
|
|
<table class="memberdecls">
|
||
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
||
|
|
Public Member Functions</h2></td></tr>
|
||
|
|
<tr class="memitem:a0524ebb181822bd6324dfd42c05aef04" id="r_a0524ebb181822bd6324dfd42c05aef04"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a0524ebb181822bd6324dfd42c05aef04">Config</a> ()=default</td></tr>
|
||
|
|
<tr class="memdesc:a0524ebb181822bd6324dfd42c05aef04"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. Initializes the inner content with default values. <br /></td></tr>
|
||
|
|
<tr class="separator:a0524ebb181822bd6324dfd42c05aef04"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:ac51cd4e8354046ac42631b4b8b83d853" id="r_ac51cd4e8354046ac42631b4b8b83d853"><td class="memItemLeft" align="right" valign="top">const T * </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac51cd4e8354046ac42631b4b8b83d853">operator-></a> () const</td></tr>
|
||
|
|
<tr class="memdesc:ac51cd4e8354046ac42631b4b8b83d853"><td class="mdescLeft"> </td><td class="mdescRight">Access member of the underlying configuration struct. <br /></td></tr>
|
||
|
|
<tr class="separator:ac51cd4e8354046ac42631b4b8b83d853"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a4549293d409139a0c732b0c2c956290d" id="r_a4549293d409139a0c732b0c2c956290d"><td class="memItemLeft" align="right" valign="top">T * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4549293d409139a0c732b0c2c956290d">write</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:a4549293d409139a0c732b0c2c956290d"><td class="mdescLeft"> </td><td class="mdescRight">Get a mutable pointer to the configuration content. <br /></td></tr>
|
||
|
|
<tr class="separator:a4549293d409139a0c732b0c2c956290d"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a4d143396a1165ee7fcdc00eb116ec31e" id="r_a4d143396a1165ee7fcdc00eb116ec31e"><td class="memItemLeft" align="right" valign="top">T & </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4d143396a1165ee7fcdc00eb116ec31e">operator*</a> ()</td></tr>
|
||
|
|
<tr class="memdesc:a4d143396a1165ee7fcdc00eb116ec31e"><td class="mdescLeft"> </td><td class="mdescRight">Dereference operator to access the underlying configuration struct. <br /></td></tr>
|
||
|
|
<tr class="separator:a4d143396a1165ee7fcdc00eb116ec31e"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a4c316b0026d41e731b03ac9f7bfb24fe" id="r_a4c316b0026d41e731b03ac9f7bfb24fe"><td class="memItemLeft" align="right" valign="top">const T & </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4c316b0026d41e731b03ac9f7bfb24fe">operator*</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:a4c316b0026d41e731b03ac9f7bfb24fe"><td class="mdescLeft"> </td><td class="mdescRight">Dereference operator to access the underlying configuration struct. <br /></td></tr>
|
||
|
|
<tr class="separator:a4c316b0026d41e731b03ac9f7bfb24fe"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a4715e05dc32076789462266e4b571dc0" id="r_a4715e05dc32076789462266e4b571dc0"><td class="memItemLeft" align="right" valign="top">const T & </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4715e05dc32076789462266e4b571dc0">main</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:a4715e05dc32076789462266e4b571dc0"><td class="mdescLeft"> </td><td class="mdescRight">Explicit accessor for the main configuration content. <br /></td></tr>
|
||
|
|
<tr class="separator:a4715e05dc32076789462266e4b571dc0"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a91fa54016e231a8361142b51807f047d" id="r_a91fa54016e231a8361142b51807f047d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a91fa54016e231a8361142b51807f047d">save</a> (std::string_view path) const</td></tr>
|
||
|
|
<tr class="memdesc:a91fa54016e231a8361142b51807f047d"><td class="mdescLeft"> </td><td class="mdescRight">Saves the current configuration to a TOML file. <br /></td></tr>
|
||
|
|
<tr class="separator:a91fa54016e231a8361142b51807f047d"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a65d0b3c0a7063f6f56f6cde4700ad312" id="r_a65d0b3c0a7063f6f56f6cde4700ad312"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a65d0b3c0a7063f6f56f6cde4700ad312">set_root_name</a> (const std::string_view name)</td></tr>
|
||
|
|
<tr class="memdesc:a65d0b3c0a7063f6f56f6cde4700ad312"><td class="mdescLeft"> </td><td class="mdescRight">Sets the root name/key used in the TOML file. <br /></td></tr>
|
||
|
|
<tr class="separator:a65d0b3c0a7063f6f56f6cde4700ad312"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:af2cd9ccc1d066a4e9d5bf9e82e61961d" id="r_af2cd9ccc1d066a4e9d5bf9e82e61961d"><td class="memItemLeft" align="right" valign="top">std::string_view </td><td class="memItemRight" valign="bottom"><a class="el" href="#af2cd9ccc1d066a4e9d5bf9e82e61961d">get_root_name</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:af2cd9ccc1d066a4e9d5bf9e82e61961d"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current root name. <br /></td></tr>
|
||
|
|
<tr class="separator:af2cd9ccc1d066a4e9d5bf9e82e61961d"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a2a106d63f18536ad950b325a0acd4a5f" id="r_a2a106d63f18536ad950b325a0acd4a5f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2a106d63f18536ad950b325a0acd4a5f">set_root_name_load_policy</a> (const <a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14">RootNameLoadPolicy</a> policy)</td></tr>
|
||
|
|
<tr class="memdesc:a2a106d63f18536ad950b325a0acd4a5f"><td class="mdescLeft"> </td><td class="mdescRight">Sets the policy for handling root name mismatches during load. <br /></td></tr>
|
||
|
|
<tr class="separator:a2a106d63f18536ad950b325a0acd4a5f"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a17b045d5646e982572abf87ce881895d" id="r_a17b045d5646e982572abf87ce881895d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14">RootNameLoadPolicy</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a17b045d5646e982572abf87ce881895d">get_root_name_load_policy</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:a17b045d5646e982572abf87ce881895d"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current root name load policy. <br /></td></tr>
|
||
|
|
<tr class="separator:a17b045d5646e982572abf87ce881895d"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:ac9a325e3b1eaf06d137d91dac9f62b77" id="r_ac9a325e3b1eaf06d137d91dac9f62b77"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac9a325e3b1eaf06d137d91dac9f62b77">describe_root_name_load_policy</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:ac9a325e3b1eaf06d137d91dac9f62b77"><td class="mdescLeft"> </td><td class="mdescRight">Returns a string description of the current root name load policy. <br /></td></tr>
|
||
|
|
<tr class="separator:ac9a325e3b1eaf06d137d91dac9f62b77"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:ae0097a0c728ad24a5d03f9a8580eac74" id="r_ae0097a0c728ad24a5d03f9a8580eac74"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae0097a0c728ad24a5d03f9a8580eac74">load</a> (const std::string_view path)</td></tr>
|
||
|
|
<tr class="memdesc:ae0097a0c728ad24a5d03f9a8580eac74"><td class="mdescLeft"> </td><td class="mdescRight">Loads configuration from a TOML file. <br /></td></tr>
|
||
|
|
<tr class="separator:ae0097a0c728ad24a5d03f9a8580eac74"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a531023140279187dc4bf4720ad64a75a" id="r_a531023140279187dc4bf4720ad64a75a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacefourdst_1_1config.html#a18da8b2ec98ddd0a28e61644ce795b7e">ConfigState</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a531023140279187dc4bf4720ad64a75a">get_state</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:a531023140279187dc4bf4720ad64a75a"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current state of the configuration object. <br /></td></tr>
|
||
|
|
<tr class="separator:a531023140279187dc4bf4720ad64a75a"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a173250f83357b28ab7a5e718581ac7e3" id="r_a173250f83357b28ab7a5e718581ac7e3"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="#a173250f83357b28ab7a5e718581ac7e3">describe_state</a> () const</td></tr>
|
||
|
|
<tr class="memdesc:a173250f83357b28ab7a5e718581ac7e3"><td class="mdescLeft"> </td><td class="mdescRight">Returns a string description of the current configuration state. <br /></td></tr>
|
||
|
|
<tr class="separator:a173250f83357b28ab7a5e718581ac7e3"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
</table><table class="memberdecls">
|
||
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
|
||
|
|
Static Public Member Functions</h2></td></tr>
|
||
|
|
<tr class="memitem:ae698328f4cf5b175bf113b0d8dbc7937" id="r_ae698328f4cf5b175bf113b0d8dbc7937"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae698328f4cf5b175bf113b0d8dbc7937">save_schema</a> (const std::string &path)</td></tr>
|
||
|
|
<tr class="memdesc:ae698328f4cf5b175bf113b0d8dbc7937"><td class="mdescLeft"> </td><td class="mdescRight">Generates and saves a JSON schema for the configuration structure. <br /></td></tr>
|
||
|
|
<tr class="separator:ae698328f4cf5b175bf113b0d8dbc7937"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
</table><table class="memberdecls">
|
||
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
|
||
|
|
Private Attributes</h2></td></tr>
|
||
|
|
<tr class="memitem:a77b1d1992d65f58f33cb3c0f67c751b1" id="r_a77b1d1992d65f58f33cb3c0f67c751b1"><td class="memItemLeft" align="right" valign="top">T </td><td class="memItemRight" valign="bottom"><a class="el" href="#a77b1d1992d65f58f33cb3c0f67c751b1">m_content</a></td></tr>
|
||
|
|
<tr class="separator:a77b1d1992d65f58f33cb3c0f67c751b1"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a01fd433545e9fb6309e0aa24cf59b01c" id="r_a01fd433545e9fb6309e0aa24cf59b01c"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="#a01fd433545e9fb6309e0aa24cf59b01c">m_root_name</a> = "main"</td></tr>
|
||
|
|
<tr class="separator:a01fd433545e9fb6309e0aa24cf59b01c"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:ae493f71623caf944ed8f078167941adf" id="r_ae493f71623caf944ed8f078167941adf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacefourdst_1_1config.html#a18da8b2ec98ddd0a28e61644ce795b7e">ConfigState</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae493f71623caf944ed8f078167941adf">m_state</a> = <a class="el" href="namespacefourdst_1_1config.html#a18da8b2ec98ddd0a28e61644ce795b7ea5b39c8b553c821e7cddc6da64b5bd2ee">ConfigState::DEFAULT</a></td></tr>
|
||
|
|
<tr class="separator:ae493f71623caf944ed8f078167941adf"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
<tr class="memitem:a3c2d0c8bf35817767089340036d18ebb" id="r_a3c2d0c8bf35817767089340036d18ebb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14">RootNameLoadPolicy</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a3c2d0c8bf35817767089340036d18ebb">m_root_name_load_policy</a> = <a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14a88b20772e9853307149861fa7e01e918">RootNameLoadPolicy::KEEP_CURRENT</a></td></tr>
|
||
|
|
<tr class="separator:a3c2d0c8bf35817767089340036d18ebb"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
|
</table>
|
||
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||
|
|
<div class="textblock"><div class="compoundTemplParams">template<IsConfigSchema T><br />
|
||
|
|
class fourdst::config::Config< T ></div><p>Wrapper class for managing strongly-typed configuration structures. </p>
|
||
|
|
<p>The <code><a class="el" href="classfourdst_1_1config_1_1_config.html" title="Wrapper class for managing strongly-typed configuration structures.">Config</a></code> class wraps a user-defined aggregate struct <code>T</code> and provides methods to save/load it to/from TOML files, as well as generate JSON schemas.</p>
|
||
|
|
<p>It uses <code>reflect-cpp</code> to automatically inspect the fields of <code>T</code>.</p>
|
||
|
|
<dl class="tparams"><dt>Template Parameters</dt><dd>
|
||
|
|
<table class="tparams">
|
||
|
|
<tr><td class="paramname">T</td><td>The configuration structure type. Must satisfy <code><a class="el" href="conceptfourdst_1_1config_1_1_is_config_schema.html" title="Concept ensuring a type is suitable for configuration schema.">IsConfigSchema</a></code>.</td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="section user"><dt>Examples</dt><dd>Defining a config struct and using <code><a class="el" href="classfourdst_1_1config_1_1_config.html" title="Wrapper class for managing strongly-typed configuration structures.">Config</a></code>: <div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="config_8h.html">fourdst/config/config.h</a>"</span></div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"><span class="keyword">struct </span>MySettings {</div>
|
||
|
|
<div class="line"> <span class="keywordtype">int</span> threads = 4;</div>
|
||
|
|
<div class="line"> <span class="keywordtype">double</span> timeout = 30.5;</div>
|
||
|
|
<div class="line">};</div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"><span class="keywordtype">int</span> <a class="code hl_function" href="#a4715e05dc32076789462266e4b571dc0">main</a>() {</div>
|
||
|
|
<div class="line"> <a class="code hl_class" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config<MySettings></a> cfg;</div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"> <span class="comment">// Access values (default)</span></div>
|
||
|
|
<div class="line"> std::cout << <span class="stringliteral">"Threads: "</span> << cfg->threads << <span class="stringliteral">"\n"</span>;</div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"> <span class="comment">// Save default config</span></div>
|
||
|
|
<div class="line"> cfg.<a class="code hl_function" href="#a91fa54016e231a8361142b51807f047d">save</a>(<span class="stringliteral">"settings.toml"</span>);</div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"> <span class="comment">// Load from file</span></div>
|
||
|
|
<div class="line"> cfg.<a class="code hl_function" href="#ae0097a0c728ad24a5d03f9a8580eac74">load</a>(<span class="stringliteral">"settings.toml"</span>);</div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"> <span class="comment">// Save JSON Schema for editors</span></div>
|
||
|
|
<div class="line"> cfg.<a class="code hl_function" href="#ae698328f4cf5b175bf113b0d8dbc7937">save_schema</a>(<span class="stringliteral">"schema.json"</span>);</div>
|
||
|
|
<div class="line"> </div>
|
||
|
|
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
||
|
|
<div class="line">}</div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1_config_html"><div class="ttname"><a href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a></div><div class="ttdoc">Wrapper class for managing strongly-typed configuration structures.</div><div class="ttdef"><b>Definition</b> base.h:113</div></div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1_config_html_a4715e05dc32076789462266e4b571dc0"><div class="ttname"><a href="#a4715e05dc32076789462266e4b571dc0">fourdst::config::Config::main</a></div><div class="ttdeci">const T & main() const</div><div class="ttdoc">Explicit accessor for the main configuration content.</div><div class="ttdef"><b>Definition</b> base.h:148</div></div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1_config_html_a91fa54016e231a8361142b51807f047d"><div class="ttname"><a href="#a91fa54016e231a8361142b51807f047d">fourdst::config::Config::save</a></div><div class="ttdeci">void save(std::string_view path) const</div><div class="ttdoc">Saves the current configuration to a TOML file.</div><div class="ttdef"><b>Definition</b> base.h:164</div></div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1_config_html_ae0097a0c728ad24a5d03f9a8580eac74"><div class="ttname"><a href="#ae0097a0c728ad24a5d03f9a8580eac74">fourdst::config::Config::load</a></div><div class="ttdeci">void load(const std::string_view path)</div><div class="ttdoc">Loads configuration from a TOML file.</div><div class="ttdef"><b>Definition</b> base.h:249</div></div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1_config_html_ae698328f4cf5b175bf113b0d8dbc7937"><div class="ttname"><a href="#ae698328f4cf5b175bf113b0d8dbc7937">fourdst::config::Config::save_schema</a></div><div class="ttdeci">static void save_schema(const std::string &path)</div><div class="ttdoc">Generates and saves a JSON schema for the configuration structure.</div><div class="ttdef"><b>Definition</b> base.h:300</div></div>
|
||
|
|
<div class="ttc" id="aconfig_8h_html"><div class="ttname"><a href="config_8h.html">config.h</a></div><div class="ttdoc">Main entry point for the fourdst::config library.</div></div>
|
||
|
|
</div><!-- fragment --> </dd></dl>
|
||
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
||
|
|
<a id="a0524ebb181822bd6324dfd42c05aef04" name="a0524ebb181822bd6324dfd42c05aef04"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a0524ebb181822bd6324dfd42c05aef04">◆ </a></span>Config()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname"><a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::Config </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel default">default</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Default constructor. Initializes the inner content with default values. </p>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
||
|
|
<a id="ac9a325e3b1eaf06d137d91dac9f62b77" name="ac9a325e3b1eaf06d137d91dac9f62b77"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ac9a325e3b1eaf06d137d91dac9f62b77">◆ </a></span>describe_root_name_load_policy()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">std::string <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::describe_root_name_load_policy </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel nodiscard">nodiscard</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Returns a string description of the current root name load policy. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>"FROM_FILE", "KEEP_CURRENT", or "UNKNOWN". </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a173250f83357b28ab7a5e718581ac7e3" name="a173250f83357b28ab7a5e718581ac7e3"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a173250f83357b28ab7a5e718581ac7e3">◆ </a></span>describe_state()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">std::string <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::describe_state </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel nodiscard">nodiscard</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Returns a string description of the current configuration state. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>"DEFAULT", "LOADED_FROM_FILE", or "UNKNOWN". </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="af2cd9ccc1d066a4e9d5bf9e82e61961d" name="af2cd9ccc1d066a4e9d5bf9e82e61961d"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#af2cd9ccc1d066a4e9d5bf9e82e61961d">◆ </a></span>get_root_name()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">std::string_view <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::get_root_name </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel nodiscard">nodiscard</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Gets the current root name. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>The root name string view. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a17b045d5646e982572abf87ce881895d" name="a17b045d5646e982572abf87ce881895d"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a17b045d5646e982572abf87ce881895d">◆ </a></span>get_root_name_load_policy()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname"><a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14">RootNameLoadPolicy</a> <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::get_root_name_load_policy </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel nodiscard">nodiscard</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Gets the current root name load policy. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>The current policy. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a531023140279187dc4bf4720ad64a75a" name="a531023140279187dc4bf4720ad64a75a"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a531023140279187dc4bf4720ad64a75a">◆ </a></span>get_state()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname"><a class="el" href="namespacefourdst_1_1config.html#a18da8b2ec98ddd0a28e61644ce795b7e">ConfigState</a> <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::get_state </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel nodiscard">nodiscard</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Gets the current state of the configuration object. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>The current state (DEFAULT or LOADED_FROM_FILE). </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="ae0097a0c728ad24a5d03f9a8580eac74" name="ae0097a0c728ad24a5d03f9a8580eac74"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ae0097a0c728ad24a5d03f9a8580eac74">◆ </a></span>load()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">void <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::load </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramtype">const std::string_view</td> <td class="paramname"><span class="paramname"><em>path</em></span></td><td>)</td>
|
||
|
|
<td></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Loads configuration from a TOML file. </p>
|
||
|
|
<p>Reads the file, parses it, and updates the internal configuration state.</p>
|
||
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
|
<table class="params">
|
||
|
|
<tr><td class="paramname">path</td><td>The file path to read from. </td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="exception"><dt>Exceptions</dt><dd>
|
||
|
|
<table class="exception">
|
||
|
|
<tr><td class="paramname"><a class="el" href="classfourdst_1_1config_1_1exceptions_1_1_config_load_error.html" title="Thrown when loading the configuration from a file fails.">exceptions::ConfigLoadError</a></td><td>If the config is already loaded, file doesn't exist, or root name mismatch (under KEEP_CURRENT policy). </td></tr>
|
||
|
|
<tr><td class="paramname"><a class="el" href="classfourdst_1_1config_1_1exceptions_1_1_config_parse_error.html" title="Thrown when parsing the configuration file fails.">exceptions::ConfigParseError</a></td><td>If the file content is invalid TOML or doesn't match the schema.</td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="section user"><dt>Examples</dt><dd><div class="fragment"><div class="line"><span class="keywordflow">try</span> {</div>
|
||
|
|
<div class="line"> cfg.load(<span class="stringliteral">"config.toml"</span>);</div>
|
||
|
|
<div class="line">} <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code hl_class" href="classfourdst_1_1config_1_1exceptions_1_1_config_error.html">fourdst::config::exceptions::ConfigError</a>& e) {</div>
|
||
|
|
<div class="line"> std::cerr << <span class="stringliteral">"Error loading config: "</span> << e.<a class="code hl_function" href="classfourdst_1_1config_1_1exceptions_1_1_config_error.html#aed6ae63fbbc9cb7e1d372904638b1fe6">what</a>() << std::endl;</div>
|
||
|
|
<div class="line">}</div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1exceptions_1_1_config_error_html"><div class="ttname"><a href="classfourdst_1_1config_1_1exceptions_1_1_config_error.html">fourdst::config::exceptions::ConfigError</a></div><div class="ttdoc">Base exception class for all configuration-related errors.</div><div class="ttdef"><b>Definition</b> exceptions.h:20</div></div>
|
||
|
|
<div class="ttc" id="aclassfourdst_1_1config_1_1exceptions_1_1_config_error_html_aed6ae63fbbc9cb7e1d372904638b1fe6"><div class="ttname"><a href="classfourdst_1_1config_1_1exceptions_1_1_config_error.html#aed6ae63fbbc9cb7e1d372904638b1fe6">fourdst::config::exceptions::ConfigError::what</a></div><div class="ttdeci">const char * what() const noexcept override</div><div class="ttdoc">Returns the error message.</div><div class="ttdef"><b>Definition</b> exceptions.h:32</div></div>
|
||
|
|
</div><!-- fragment --> </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a4715e05dc32076789462266e4b571dc0" name="a4715e05dc32076789462266e4b571dc0"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4715e05dc32076789462266e4b571dc0">◆ </a></span>main()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">const T & <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::main </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Explicit accessor for the main configuration content. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>Reference to the constant configuration content. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a4d143396a1165ee7fcdc00eb116ec31e" name="a4d143396a1165ee7fcdc00eb116ec31e"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4d143396a1165ee7fcdc00eb116ec31e">◆ </a></span>operator*() <span class="overload">[1/2]</span></h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">T & <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::operator* </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Dereference operator to access the underlying configuration struct. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>Reference to the mutable configuration content. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a4c316b0026d41e731b03ac9f7bfb24fe" name="a4c316b0026d41e731b03ac9f7bfb24fe"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4c316b0026d41e731b03ac9f7bfb24fe">◆ </a></span>operator*() <span class="overload">[2/2]</span></h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">const T & <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::operator* </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Dereference operator to access the underlying configuration struct. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>Reference to the constant configuration content. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="ac51cd4e8354046ac42631b4b8b83d853" name="ac51cd4e8354046ac42631b4b8b83d853"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ac51cd4e8354046ac42631b4b8b83d853">◆ </a></span>operator->()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">const T * <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::operator-> </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Access member of the underlying configuration struct. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to the constant configuration content. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a91fa54016e231a8361142b51807f047d" name="a91fa54016e231a8361142b51807f047d"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a91fa54016e231a8361142b51807f047d">◆ </a></span>save()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">void <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::save </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramtype">std::string_view</td> <td class="paramname"><span class="paramname"><em>path</em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Saves the current configuration to a TOML file. </p>
|
||
|
|
<p>Wraps the configuration content under the current root name (default "main") and writes it to the specified path.</p>
|
||
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
|
<table class="params">
|
||
|
|
<tr><td class="paramname">path</td><td>The file path to write to. </td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="exception"><dt>Exceptions</dt><dd>
|
||
|
|
<table class="exception">
|
||
|
|
<tr><td class="paramname"><a class="el" href="classfourdst_1_1config_1_1exceptions_1_1_config_save_error.html" title="Thrown when saving the configuration to a file fails.">exceptions::ConfigSaveError</a></td><td>If the file cannot be opened.</td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="section user"><dt>Examples</dt><dd><div class="fragment"><div class="line">cfg.save(<span class="stringliteral">"config.toml"</span>);</div>
|
||
|
|
</div><!-- fragment --> </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="ae698328f4cf5b175bf113b0d8dbc7937" name="ae698328f4cf5b175bf113b0d8dbc7937"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ae698328f4cf5b175bf113b0d8dbc7937">◆ </a></span>save_schema()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">static void <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::save_schema </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>path</em></span></td><td>)</td>
|
||
|
|
<td></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Generates and saves a JSON schema for the configuration structure. </p>
|
||
|
|
<p>Useful for enabling autocompletion and validation in editors (e.g., VS Code).</p>
|
||
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
|
<table class="params">
|
||
|
|
<tr><td class="paramname">path</td><td>The path to save the schema file to. </td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="exception"><dt>Exceptions</dt><dd>
|
||
|
|
<table class="exception">
|
||
|
|
<tr><td class="paramname"><a class="el" href="classfourdst_1_1config_1_1exceptions_1_1_schema_save_error.html" title="Thrown when generating or saving the JSON schema fails.">exceptions::SchemaSaveError</a></td><td>If the file cannot be opened.</td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
<dl class="section user"><dt>Examples</dt><dd><div class="fragment"><div class="line"><a class="code hl_function" href="#ae698328f4cf5b175bf113b0d8dbc7937">Config<MyConfig>::save_schema</a>(<span class="stringliteral">"MyConfig.schema.json"</span>);</div>
|
||
|
|
</div><!-- fragment --> </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a65d0b3c0a7063f6f56f6cde4700ad312" name="a65d0b3c0a7063f6f56f6cde4700ad312"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a65d0b3c0a7063f6f56f6cde4700ad312">◆ </a></span>set_root_name()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">void <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::set_root_name </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramtype">const std::string_view</td> <td class="paramname"><span class="paramname"><em>name</em></span></td><td>)</td>
|
||
|
|
<td></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Sets the root name/key used in the TOML file. </p>
|
||
|
|
<p>The default root name is "main". This name appears as the top-level table in the TOML file (e.g., <code>[main]</code>).</p>
|
||
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
|
<table class="params">
|
||
|
|
<tr><td class="paramname">name</td><td>The new root name. </td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a2a106d63f18536ad950b325a0acd4a5f" name="a2a106d63f18536ad950b325a0acd4a5f"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a2a106d63f18536ad950b325a0acd4a5f">◆ </a></span>set_root_name_load_policy()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">void <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::set_root_name_load_policy </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramtype">const <a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14">RootNameLoadPolicy</a></td> <td class="paramname"><span class="paramname"><em>policy</em></span></td><td>)</td>
|
||
|
|
<td></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Sets the policy for handling root name mismatches during load. </p>
|
||
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
|
<table class="params">
|
||
|
|
<tr><td class="paramname">policy</td><td>The policy (FROM_FILE or KEEP_CURRENT). </td></tr>
|
||
|
|
</table>
|
||
|
|
</dd>
|
||
|
|
</dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a4549293d409139a0c732b0c2c956290d" name="a4549293d409139a0c732b0c2c956290d"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4549293d409139a0c732b0c2c956290d">◆ </a></span>write()</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">T * <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::write </td>
|
||
|
|
<td>(</td>
|
||
|
|
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
|
|
<td> const</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
<p>Get a mutable pointer to the configuration content. </p>
|
||
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to the mutable configuration content. </dd></dl>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<h2 class="groupheader">Member Data Documentation</h2>
|
||
|
|
<a id="a77b1d1992d65f58f33cb3c0f67c751b1" name="a77b1d1992d65f58f33cb3c0f67c751b1"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a77b1d1992d65f58f33cb3c0f67c751b1">◆ </a></span>m_content</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">T <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::m_content</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel private">private</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a01fd433545e9fb6309e0aa24cf59b01c" name="a01fd433545e9fb6309e0aa24cf59b01c"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a01fd433545e9fb6309e0aa24cf59b01c">◆ </a></span>m_root_name</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname">std::string <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::m_root_name = "main"</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel private">private</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="a3c2d0c8bf35817767089340036d18ebb" name="a3c2d0c8bf35817767089340036d18ebb"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a3c2d0c8bf35817767089340036d18ebb">◆ </a></span>m_root_name_load_policy</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname"><a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14">RootNameLoadPolicy</a> <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::m_root_name_load_policy = <a class="el" href="namespacefourdst_1_1config.html#a9870cefcd568dac301257ca35b73ab14a88b20772e9853307149861fa7e01e918">RootNameLoadPolicy::KEEP_CURRENT</a></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel private">private</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<a id="ae493f71623caf944ed8f078167941adf" name="ae493f71623caf944ed8f078167941adf"></a>
|
||
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ae493f71623caf944ed8f078167941adf">◆ </a></span>m_state</h2>
|
||
|
|
|
||
|
|
<div class="memitem">
|
||
|
|
<div class="memproto">
|
||
|
|
<div class="memtemplate">
|
||
|
|
template<IsConfigSchema T> </div>
|
||
|
|
<table class="mlabels">
|
||
|
|
<tr>
|
||
|
|
<td class="mlabels-left">
|
||
|
|
<table class="memname">
|
||
|
|
<tr>
|
||
|
|
<td class="memname"><a class="el" href="namespacefourdst_1_1config.html#a18da8b2ec98ddd0a28e61644ce795b7e">ConfigState</a> <a class="el" href="classfourdst_1_1config_1_1_config.html">fourdst::config::Config</a>< T >::m_state = <a class="el" href="namespacefourdst_1_1config.html#a18da8b2ec98ddd0a28e61644ce795b7ea5b39c8b553c821e7cddc6da64b5bd2ee">ConfigState::DEFAULT</a></td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</td>
|
||
|
|
<td class="mlabels-right">
|
||
|
|
<span class="mlabels"><span class="mlabel private">private</span></span> </td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div><div class="memdoc">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
||
|
|
<li>src/config/include/fourdst/config/<a class="el" href="base_8h.html">base.h</a></li>
|
||
|
|
</ul>
|
||
|
|
</div><!-- contents -->
|
||
|
|
</div><!-- doc-content -->
|
||
|
|
<!-- start footer part -->
|
||
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||
|
|
<ul>
|
||
|
|
<li class="navelem"><a class="el" href="namespacefourdst.html">fourdst</a></li><li class="navelem"><a class="el" href="namespacefourdst_1_1config.html">config</a></li><li class="navelem"><a class="el" href="classfourdst_1_1config_1_1_config.html">Config</a></li>
|
||
|
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|