Function visit
Summary
#include <include/cpptoml.h>
(1) template <class T>
void visit(const value< T > &v, bool=false)
(2) void visit(const table &t, bool in_array=false)
(3) void visit(const array &a, bool=false)
(4) void visit(const table_array &t, bool=false)
Function overload
Synopsis
#include <include/cpptoml.h>
template <class T>
void visit(const value< T > &v, bool=false)
Description
Output a base value of the TOML tree.
Source
Lines 3317-3321 in include/cpptoml.h.
template <class T>
void visit(const value<T>& v, bool = false)
{
write(v);
}
Synopsis
#include <include/cpptoml.h>
void visit(const table &t, bool in_array=false)
Description
Output a table element of the TOML tree
Source
Lines 3326-3369 in include/cpptoml.h.
void visit(const table& t, bool in_array = false)
{
write_table_header(in_array);
std::vector<std::string> values;
std::vector<std::string> tables;
for (const auto& i : t)
{
if (i.second->is_table() || i.second->is_table_array())
{
tables.push_back(i.first);
}
else
{
values.push_back(i.first);
}
}
for (unsigned int i = 0; i < values.size(); ++i)
{
path_.push_back(values[i]);
if (i > 0)
endline();
write_table_item_header(*t.get(values[i]));
t.get(values[i])->accept(*this, false);
path_.pop_back();
}
for (unsigned int i = 0; i < tables.size(); ++i)
{
path_.push_back(tables[i]);
if (values.size() > 0 || i > 0)
endline();
write_table_item_header(*t.get(tables[i]));
t.get(tables[i])->accept(*this, false);
path_.pop_back();
}
endline();
}
Synopsis
#include <include/cpptoml.h>
void visit(const array &a, bool=false)
Description
Output an array element of the TOML tree
Source
Lines 3374-3394 in include/cpptoml.h.
void visit(const array& a, bool = false)
{
write("[");
for (unsigned int i = 0; i < a.get().size(); ++i)
{
if (i > 0)
write(", ");
if (a.get()[i]->is_array())
{
a.get()[i]->as_array()->accept(*this, true);
}
else
{
a.get()[i]->accept(*this, true);
}
}
write("]");
}
Synopsis
#include <include/cpptoml.h>
void visit(const table_array &t, bool=false)
Description
Output a table_array element of the TOML tree
Source
Lines 3399-3410 in include/cpptoml.h.
void visit(const table_array& t, bool = false)
{
for (unsigned int j = 0; j < t.get().size(); ++j)
{
if (j > 0)
endline();
t.get()[j]->accept(*this, true);
}
endline();
}