Skip to content

Commit

Permalink
added value assignment operators
Browse files Browse the repository at this point in the history
also:
- added value::value_type
- removed format_flags::always_print_as_inline
- significantly improved documentation
  • Loading branch information
marzer committed Feb 18, 2020
1 parent 1f8f3c7 commit 0b4eca3
Show file tree
Hide file tree
Showing 19 changed files with 564 additions and 392 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ int64_t depends_on_cpp_version = config["dependencies"]["cpp"].as_integer()->get

// modify the data
config.insert_or_assign("alternatives", toml::array{
"cpptoml",
"toml11",
"Boost.TOML"
"cpptoml",
"toml11",
"Boost.TOML"
});

// iterate & visit over the data
for (auto [k, v] : config)
{
v.visit([](auto& node) noexcept
{
std::cout << node << std:endl;
if constexpr (toml::is_string<decltype(node)>)
do_something_with_string_values(node)
});
v.visit([](auto& node) noexcept
{
std::cout << node << std:endl;
if constexpr (toml::is_string<decltype(node)>)
do_something_with_string_values(node);
});
}

// re-serialize as TOML
Expand Down
2 changes: 2 additions & 0 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES = "cpp=@code{.cpp}" \
"ecpp=@endcode" \
"out=@code{.unparsed}" \
"eout=@endcode" \
"detail=@details"
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
Expand Down
5 changes: 3 additions & 2 deletions docs/Doxyfile-mcss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
HTML_EXTRA_STYLESHEET = https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600 \
../css/m-dark+documentation.compiled.css \
tomlplusplus.css
HTML_EXTRA_FILES = tomlplusplus.js
HTML_EXTRA_FILES = tomlplusplus.js \
github-icon.png
##! M_THEME_COLOR = #22272e
##! M_LINKS_NAVBAR1 = \
##! namespaces
##! M_LINKS_NAVBAR2 = \
##! annotated \
##! "<a target="_blank" href="https://github.com/marzer/tomlplusplus/">Github</a>"
##! "<a target="_blank" href="https://github.com/marzer/tomlplusplus/" class="github">Github</a>"
##! M_SEARCH_DOWNLOAD_BINARY = NO
##! M_CLASS_TREE_EXPAND_LEVELS = 3
##! M_FILE_TREE_EXPAND_LEVELS = 3
Expand Down
Binary file added docs/github-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
176 changes: 52 additions & 124 deletions docs/tomlplusplus.css
Original file line number Diff line number Diff line change
@@ -1,109 +1,3 @@
/*
table.m-table th
{
color: #ffe698;
}
article section > h2
{
padding-top: 0.5rem;
padding-bottom: 0.1rem;
background-color: #282e36;
padding-left: 1rem;
margin-left: -1rem;
margin-right: -1rem;
margin-top: 2rem;
border-color: #282e36;
border-style: solid;
border-width: 0.0625rem;
border-left-width: 0.25rem;
border-radius: 0.2rem;
}
article section:target
{
border-radius: 0.2rem;
}
article section:target > h2
{
border-color: #a5c9ea;
}
table.m-table thead th
{
border-bottom-width: 0.0rem;
}
table.m-table tbody td
{
border: 0px;
}
table.m-table thead tr:first-child th
{
border-top-width: 0.1rem;
}
code.m-code, aside code
{
margin-left: 0.1em;
padding-left: 0.2em;
padding-right: 0.1em;
}
dl.m-doc dd
{
margin-bottom: 0.8rem;
}
.m-doc-template a, dl.m-doc dd a, ul.m-doc li > span.m-doc a
{
color: #858585;
}
.m-doc-template a.tpp-external:hover,
dl.m-doc dd a.tpp-external:hover,
ul.m-doc li > span.m-doc a.tpp-external:hover
{
color: inherit;
}
pre, .m-doc-search-content
{
background-color: #1e1e1e;
}
pre.m-code, code
{
background-color: #1e1e1e88;
}
article section.m-doc-details > div > h3:first-child, article section > h2, body > footer > nav
{
background-color: #252526;
}
.tpp-external-navbar
{
background-color: #007acc11;
}
.m-label:not(.m-flat)
{
font-weight: bold;
}
div.m-doc-include
{
font-size: 0.9rem;
}
.m-doc-include span.cp
{
display: none;
}
.m-doc-include a.cpf
{
color: #9999AA;
}
*/

html, body
{
scroll-padding-top: 3.5rem;
Expand All @@ -114,39 +8,46 @@ body
margin-top: 3rem;
}

header {
header
{
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 100;
}

article, article > header, article section {
article, article > header, article section
{
margin-bottom: 3em;
}

pre, code, .tpp-enable-if > a {
pre, code, .tpp-enable-if > a
{
font-family: 'Consolas', 'Source Sans Pro', monospace;
}

a.tpp-external {
a.tpp-external
{
font-weight: normal;
}

.tpp-enable-if {
.tpp-enable-if
{
margin-bottom: 2px;
}

.tpp-enable-if > * {
.tpp-enable-if > *
{
display: inline-block;
border-radius: 0.2rem;
background-clip: padding-box !important;
padding: 0px 2px;
text-decoration: none;
}

.tpp-enable-if > a {
.tpp-enable-if > a
{
white-space: nowrap;
font-size: 0.8rem;
font-weight: bold;
Expand All @@ -157,22 +58,46 @@ a.tpp-external {
margin-bottom: 2px;
}

.tpp-enable-if > a:hover {
background-color: #747474;
color: initial;
}
.tpp-enable-if > a:hover
{
background-color: #747474;
color: initial;
}

.tpp-enable-if > span {
.tpp-enable-if > span
{
display: none;
padding-left: 2em;
}

nav .m-thin {
nav .m-thin
{
margin-left: 0.5em;
}

nav .github
{
padding-left: 44px !important;
background-image: url("github-icon.png");
background-repeat: no-repeat;
background-size: 25px 25px;
background-position: -30px center;
background-origin: content-box;
}

pre.m-code + pre
{
margin-top: -1.0rem;
color: #bababa; /* is yououou */
background-color: #282e36aa;
font-size: 0.8rem;
}

/* "Parameters", "Returns" etc */
.m-doc-details div table.m-table.m-fullwidth.m-flat thead tr th,
.m-doc-details div table.m-table.m-fullwidth.m-flat tfoot tr th
.m-doc-details div table.m-table.m-fullwidth.m-flat tfoot tr th,
.m-doc-details div table.m-table.m-fullwidth.m-flat tfoot tr td strong em,
.m-doc-details div table.m-table.m-fullwidth.m-flat tbody tr td strong em
{
color: #a5c9ea;
}
Expand Down Expand Up @@ -216,20 +141,23 @@ nav .m-thin {

/* string literals, "includes" */
.m-code .s,
.m-code .s + .n,
.m-code .sa,
.m-code .dl,
.m-code .cpf
{
color: rgb(214,157,133);
}

.m-code .kt,
.m-code .k
.m-code .k,
.m-code .nc
{
font-weight: normal;
}

/* user types and typedefs */
.m-code .ut
.m-code .ut,
.m-code .nc
{
color: rgb(78,201,176);
}
Expand All @@ -238,4 +166,4 @@ nav .m-thin {
.m-code .ns
{
color: rgb(140,140,140);
}
}
49 changes: 48 additions & 1 deletion include/toml++/toml.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "toml_default_formatter.h"
#include "toml_json_formatter.h"

//macro hygiene
// macro hygiene
#if TOML_UNDEF_MACROS
#undef TOML_EXCEPTIONS
#undef TOML_USE_STREAMS_FOR_FLOATS
Expand Down Expand Up @@ -53,3 +53,50 @@
#undef TOML_UNDEF_MACROS
#undef TOML_DOXYGEN
#endif

/// \mainpage toml++
///
/// This is the home of the API documentation for toml++, a [TOML](https://github.com/toml-lang/toml) parser for C++17 and later.
/// If you're looking for information about how to add toml++ to your project etc, see the
/// see [README](https://github.com/marzer/tomlplusplus/blob/master/README.md) on GitHub.
/// Otherwise, browse the docs using the links at the top of the page. You can search from anywhere by pressing the TAB key.
///
/// <em>Obviously this page is pretty sparse and could do with some more content. If you have concrete suggestions for what
/// should go here, please [let me know](https://github.com/marzer/tomlplusplus/issues)!</em>
///
/// \cpp
/// #include <iostream>
/// #include <toml++/toml.h>
///
/// int main()
/// {
/// auto tbl = toml::table{{
/// { "lib", "toml++" },
/// { "cpp", toml::array{ 17, 20, "and beyond" } },
/// { "toml", toml::array{ "0.5.0", "and beyond" } },
/// { "repo", "https://github.com/marzer/tomlplusplus/" },
/// { "author", toml::table{{
/// { "name", "Mark Gillard" },
/// { "github", "https://github.com/marzer" },
/// { "twitter", "https://twitter.com/marzer8789" }
/// }}
/// },
/// }};
///
/// std::cout << tbl << std::endl;
/// return 0;
/// }
/// \ecpp
///
/// \out
/// cpp = [ 17, 20, "and beyond" ]
/// lib = "toml++"
/// repo = "https://github.com/marzer/tomlplusplus/"
/// toml = [ "0.5.0", "and beyond" ]
///
/// [author]
/// github = "https://github.com/marzer"
/// name = "Mark Gillard"
/// twitter = "https://twitter.com/marzer8789"
/// \eout
///
Loading

0 comments on commit 0b4eca3

Please sign in to comment.