NeBuild dev
Loading...
Searching...
No Matches
print_to_stream.hpp
Go to the documentation of this file.
1//# This file is a part of toml++ and is subject to the the terms of the MIT license.
2//# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
3//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
4// SPDX-License-Identifier: MIT
5#pragma once
6
7#include "std_string.hpp"
9#include "header_start.hpp"
10
12{
13 // Q: "why does print_to_stream() exist? why not just use ostream::write(), ostream::put() etc?"
14 // A: - I'm using <charconv> to format numerics. Faster and locale-independent.
15 // - I can (potentially) avoid forcing users to drag in <sstream> and <iomanip>.
16 // - Strings in C++. Honestly.
17
19 TOML_ATTR(nonnull)
20 void TOML_CALLCONV print_to_stream(std::ostream&, const char*, size_t);
21
23 void TOML_CALLCONV print_to_stream(std::ostream&, std::string_view);
24
26 void TOML_CALLCONV print_to_stream(std::ostream&, const std::string&);
27
29 void TOML_CALLCONV print_to_stream(std::ostream&, char);
30
32 void TOML_CALLCONV print_to_stream(std::ostream&, signed char, value_flags = {}, size_t min_digits = 0);
33
35 void TOML_CALLCONV print_to_stream(std::ostream&, signed short, value_flags = {}, size_t min_digits = 0);
36
38 void TOML_CALLCONV print_to_stream(std::ostream&, signed int, value_flags = {}, size_t min_digits = 0);
39
41 void TOML_CALLCONV print_to_stream(std::ostream&, signed long, value_flags = {}, size_t min_digits = 0);
42
44 void TOML_CALLCONV print_to_stream(std::ostream&, signed long long, value_flags = {}, size_t min_digits = 0);
45
47 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned char, value_flags = {}, size_t min_digits = 0);
48
50 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned short, value_flags = {}, size_t min_digits = 0);
51
53 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned int, value_flags = {}, size_t min_digits = 0);
54
56 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned long, value_flags = {}, size_t min_digits = 0);
57
59 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned long long, value_flags = {}, size_t min_digits = 0);
60
62 void TOML_CALLCONV print_to_stream(std::ostream&, float, value_flags = {}, bool relaxed_precision = false);
63
65 void TOML_CALLCONV print_to_stream(std::ostream&, double, value_flags = {}, bool relaxed_precision = false);
66
68 void TOML_CALLCONV print_to_stream(std::ostream&, bool);
69
71 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::date&);
72
74 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::time&);
75
77 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::time_offset&);
78
80 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::date_time&);
81
83 void TOML_CALLCONV print_to_stream(std::ostream&, const source_position&);
84
86 void TOML_CALLCONV print_to_stream(std::ostream&, const source_region&);
87
88#if TOML_ENABLE_FORMATTERS
89
91 void TOML_CALLCONV print_to_stream(std::ostream&, const array&);
92
94 void TOML_CALLCONV print_to_stream(std::ostream&, const table&);
95
97 void TOML_CALLCONV print_to_stream(std::ostream&, const value<std::string>&);
98
100 void TOML_CALLCONV print_to_stream(std::ostream&, const value<int64_t>&);
101
103 void TOML_CALLCONV print_to_stream(std::ostream&, const value<double>&);
104
106 void TOML_CALLCONV print_to_stream(std::ostream&, const value<bool>&);
107
109 void TOML_CALLCONV print_to_stream(std::ostream&, const value<date>&);
110
112 void TOML_CALLCONV print_to_stream(std::ostream&, const value<time>&);
113
115 void TOML_CALLCONV print_to_stream(std::ostream&, const value<date_time>&);
116
117#endif
118
119 template <typename T, typename U>
120 inline void print_to_stream_bookended(std::ostream & stream, const T& val, const U& bookend)
121 {
122 print_to_stream(stream, bookend);
123 print_to_stream(stream, val);
124 print_to_stream(stream, bookend);
125 }
126}
128
129#include "header_end.hpp"
A TOML array.
Definition array.hpp:285
A TOML table.
Definition table.hpp:220
enum TOML_OPEN_FLAGS_ENUM value_flags
Metadata associated with TOML values.
Definition forward_declarations.hpp:272
#define TOML_CALLCONV
Calling convention to apply to exported free/static functions. \detail Not defined by default (let th...
Definition preprocessor.hpp:1134
#define TOML_EXPORTED_FREE_FUNCTION
An 'export' annotation to add to free functions. \detail Not defined by default.
Definition preprocessor.hpp:988
#define TOML_ATTR(...)
Definition preprocessor.hpp:316
TOML_EXPORTED_FREE_FUNCTION void TOML_CALLCONV print_to_stream(std::ostream &, std::string_view)
TOML_IMPL_NAMESPACE_END
Definition print_to_stream.hpp:127
TOML_IMPL_NAMESPACE_START
Definition print_to_stream.hpp:12
void print_to_stream_bookended(std::ostream &stream, const T &val, const U &bookend)
Definition print_to_stream.hpp:120
A source document line-and-column pair.
Definition source_region.hpp:43
A source document region.
Definition source_region.hpp:167