cpptoml
A C++11 parser for TOML
Loading...
Searching...
No Matches
cpptoml::toml_writer Class Reference

Writer that can be passed to accept() functions of cpptoml objects and will output valid TOML to a stream. More...

#include <cpptoml.h>

Public Member Functions

 toml_writer (std::ostream &s, const std::string &indent_space="\t")
 Construct a toml_writer that will write to the given stream.
template<class T>
void visit (const value< T > &v, bool=false)
 Output a base value of the TOML tree.
void visit (const table &t, bool in_array=false)
 Output a table element of the TOML tree.
void visit (const array &a, bool=false)
 Output an array element of the TOML tree.
void visit (const table_array &t, bool=false)
 Output a table_array element of the TOML tree.

Static Public Member Functions

static std::string escape_string (const std::string &str)
 Escape a string for output.

Protected Member Functions

void write (const value< std::string > &v)
 Write out a string.
void write (const value< double > &v)
 Write out a double.
template<class T>
std::enable_if< is_one_of< T, int64_t, local_date, local_time, local_datetime, offset_datetime >::value >::type write (const value< T > &v)
 Write out an integer, local_date, local_time, local_datetime, or offset_datetime.
void write (const value< bool > &v)
 Write out a boolean.
void write_table_header (bool in_array=false)
 Write out the header of a table.
void write_table_item_header (const base &b)
 Write out the identifier for an item in a table.

Private Member Functions

void indent ()
 Indent the proper number of tabs given the size of the path.
template<class T>
void write (const T &v)
 Write a value out to the stream.
void endline ()
 Write an endline out to the stream.

Private Attributes

std::ostream & stream_
const std::string indent_
std::vector< std::string > path_
bool has_naked_endline_

Detailed Description

Writer that can be passed to accept() functions of cpptoml objects and will output valid TOML to a stream.


The documentation for this class was generated from the following file: