Function write

Summary

#include <include/cpptoml.h>

(1) void write(const value< std::string > &v)

(2) void write(const value< double > &v)

(3) 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)

(4) void write(const value< bool > &v)

Function overload

Synopsis

#include <include/cpptoml.h>

void write(const value< std::string > &v)

Description

Write out a string.

Source

Lines 3467-3472 in include/cpptoml.h.

void write(const value<std::string>& v)
{
    write("\"");
    write(escape_string(v.get()));
    write("\"");
}

Synopsis

#include <include/cpptoml.h>

void write(const value< double > &v)

Description

Write out a double.

Source

Lines 3477-3494 in include/cpptoml.h.

void write(const value<double>& v)
{
    std::stringstream ss;
    ss << std::showpoint
       << std::setprecision(std::numeric_limits<double>::max_digits10)
       << v.get();
    auto double_str = ss.str();
    auto pos = double_str.find("e0");
    if (pos != std::string::npos)
        double_str.replace(pos, 2, "e");
    pos = double_str.find("e-0");
    if (pos != std::string::npos)
        double_str.replace(pos, 3, "e-");
    stream_ << double_str;
    has_naked_endline_ = false;
}

Synopsis

#include <include/cpptoml.h>

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)

Description

Write out an integer, local_date, local_time, local_datetime, or offset_datetime.

Source

Lines 3500-3507 in include/cpptoml.h.

template <class T>
typename 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(v.get());
}

Synopsis

#include <include/cpptoml.h>

void write(const value< bool > &v)

Description

Write out a boolean.

Source

Lines 3512-3515 in include/cpptoml.h.

void write(const value<bool>& v)
{
    write((v.get() ? "true" : "false"));
}





Add Discussion as Guest

Log in