Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
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
8#include "header_start.hpp"
9#include "std_string.hpp"
10
12 // Q: "why does print_to_stream() exist? why not just use ostream::write(), ostream::put() etc?"
13 // A: - I'm using <charconv> to format numerics. Faster and locale-independent.
14 // - I can (potentially) avoid forcing users to drag in <sstream> and <iomanip>.
15 // - Strings in C++. Honestly.
16
18 TOML_ATTR(nonnull)
19 void TOML_CALLCONV print_to_stream(std::ostream&, const char*, size_t);
20
22 void TOML_CALLCONV print_to_stream(std::ostream&, std::string_view);
23
25 void TOML_CALLCONV print_to_stream(std::ostream&, const std::string&);
26
28 void TOML_CALLCONV print_to_stream(std::ostream&, char);
29
31 void TOML_CALLCONV print_to_stream(std::ostream&, signed char, value_flags = {},
32 size_t min_digits = 0);
33
35 void TOML_CALLCONV print_to_stream(std::ostream&, signed short, value_flags = {},
36 size_t min_digits = 0);
37
39 void TOML_CALLCONV print_to_stream(std::ostream&, signed int, value_flags = {},
40 size_t min_digits = 0);
41
43 void TOML_CALLCONV print_to_stream(std::ostream&, signed long, value_flags = {},
44 size_t min_digits = 0);
45
47 void TOML_CALLCONV print_to_stream(std::ostream&, signed long long, value_flags = {},
48 size_t min_digits = 0);
49
51 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned char, value_flags = {},
52 size_t min_digits = 0);
53
55 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned short, value_flags = {},
56 size_t min_digits = 0);
57
59 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned int, value_flags = {},
60 size_t min_digits = 0);
61
63 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned long, value_flags = {},
64 size_t min_digits = 0);
65
67 void TOML_CALLCONV print_to_stream(std::ostream&, unsigned long long, value_flags = {},
68 size_t min_digits = 0);
69
71 void TOML_CALLCONV print_to_stream(std::ostream&, float, value_flags = {},
72 bool relaxed_precision = false);
73
75 void TOML_CALLCONV print_to_stream(std::ostream&, double, value_flags = {},
76 bool relaxed_precision = false);
77
79 void TOML_CALLCONV print_to_stream(std::ostream&, bool);
80
82 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::date&);
83
85 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::time&);
86
88 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::time_offset&);
89
91 void TOML_CALLCONV print_to_stream(std::ostream&, const toml::date_time&);
92
94 void TOML_CALLCONV print_to_stream(std::ostream&, const source_position&);
95
97 void TOML_CALLCONV print_to_stream(std::ostream&, const source_region&);
98
99#if TOML_ENABLE_FORMATTERS
100
102 void TOML_CALLCONV print_to_stream(std::ostream&, const array&);
103
105 void TOML_CALLCONV print_to_stream(std::ostream&, const table&);
106
108 void TOML_CALLCONV print_to_stream(std::ostream&, const value<std::string>&);
109
111 void TOML_CALLCONV print_to_stream(std::ostream&, const value<int64_t>&);
112
114 void TOML_CALLCONV print_to_stream(std::ostream&, const value<double>&);
115
117 void TOML_CALLCONV print_to_stream(std::ostream&, const value<bool>&);
118
120 void TOML_CALLCONV print_to_stream(std::ostream&, const value<date>&);
121
123 void TOML_CALLCONV print_to_stream(std::ostream&, const value<time>&);
124
126 void TOML_CALLCONV print_to_stream(std::ostream&, const value<date_time>&);
127
128#endif
129
130 template <typename T, typename U>
131 inline void print_to_stream_bookended(std::ostream & stream, const T& val, const U& bookend) {
132 print_to_stream(stream, bookend);
134 print_to_stream(stream, bookend);
135 }
136}
138
139#include "header_end.hpp"
#define stream
Definition 17.names.cpp:548
#define T
Definition 17.names.cpp:163
#define val
Definition 17.names.cpp:570
#define U
Definition 17.names.cpp:164
A TOML array.
Definition array.hpp:258
A TOML table.
Definition table.hpp:190
enum TOML_OPEN_FLAGS_ENUM value_flags
Metadata associated with TOML values.
#define TOML_CALLCONV
Calling convention to apply to exported free/static functions. \detail Not defined by default (let th...
#define TOML_EXPORTED_FREE_FUNCTION
An 'export' annotation to add to free functions. \detail Not defined by default.
#define TOML_ATTR(...)
TOML_EXPORTED_FREE_FUNCTION void TOML_CALLCONV print_to_stream(std::ostream &, std::string_view)
TOML_IMPL_NAMESPACE_END
TOML_IMPL_NAMESPACE_START
void print_to_stream_bookended(std::ostream &stream, const T &val, const U &bookend)
A source document line-and-column pair.
A source document region.