BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt_print.h
Go to the documentation of this file.
1/// @file bslfmt_print.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslfmt_print.h -*-C++-*-
8#ifndef INCLUDED_BSLFMT_PRINT
9#define INCLUDED_BSLFMT_PRINT
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslfmt_print bslfmt_print
15/// @brief Provide a standard compliant `print(FILE)` implementation.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslfmt
19/// @{
20/// @addtogroup bslfmt_print
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslfmt_print-purpose"> Purpose</a>
25/// * <a href="#bslfmt_print-classes"> Classes </a>
26/// * <a href="#bslfmt_print-canonical-header"> Canonical Header </a>
27/// * <a href="#bslfmt_print-description"> Description </a>
28///
29/// # Purpose {#bslfmt_print-purpose}
30/// Provide a standard compliant `print(FILE)` implementation.
31///
32/// # Classes {#bslfmt_print-classes}
33///
34///
35/// # Canonical Header {#bslfmt_print-canonical-header}
36/// bsl_print.h
37///
38/// @see ISO C++ Standard, <print>
39///
40/// # Description {#bslfmt_print-description}
41/// This component will provide, in the `bsl` namespace, wrappers
42/// around the functions exposed by the standard <print> header, where they are
43/// available, otherwise aliases to the `bslfmt` implementation.
44///
45/// Where a BDE implementation is provided, functionality is limited to that
46/// provided by C++23 and excludes the following features:
47///
48/// * Unicode support for Windows console
49/// * Support for @ref enable_nonlocking_formatter_optimization
50///
51/// Also, when using it, all limitations of the underlying `bslfmt`
52/// implementation apply.
53/// @}
54/** @} */
55/** @} */
56
57/** @addtogroup bsl
58 * @{
59 */
60/** @addtogroup bslfmt
61 * @{
62 */
63/** @addtogroup bslfmt_print
64 * @{
65 */
66
67#include <bslscm_version.h>
68
70#include <bsls_platform.h>
71
72#ifdef BSLS_LIBRARYFEATURES_HAS_CPP23_PRINT
73# ifdef BSLS_PLATFORM_CMP_MSVC
74# include <cstdio> // `stdout`
75# endif
76# include <print>
77#else
78# include <bslfmt_print_imp.h>
79#endif
80
81namespace bsl {
82
83#ifdef BSLS_LIBRARYFEATURES_HAS_CPP23_PRINT
84
85using std::print;
86using std::println;
87using std::vprint_nonunicode;
88using std::vprint_nonunicode_buffered;
89using std::vprint_unicode;
90using std::vprint_unicode_buffered;
91
92#ifdef BSLS_PLATFORM_CMP_MSVC
93// MSVC++ 18.1 (VS 2026) does not provide these overloads
94inline
95void vprint_nonunicode(std::string_view fmt, std::format_args args)
96{
97 return std::vprint_nonunicode(stdout, fmt, args);
98}
99
100inline
101void vprint_unicode(std::string_view fmt, std::format_args args)
102{
103 return std::vprint_unicode(stdout, fmt, args);
104}
105#endif // BSLS_PLATFORM_CMP_MSVC
106
107#else
108
109using BloombergLP::bslfmt::print;
110using BloombergLP::bslfmt::println;
111using BloombergLP::bslfmt::vprint_nonunicode;
112using BloombergLP::bslfmt::vprint_nonunicode_buffered;
113using BloombergLP::bslfmt::vprint_unicode;
114using BloombergLP::bslfmt::vprint_unicode_buffered;
115
116#endif // BSLS_LIBRARYFEATURES_HAS_CPP23_PRINT
117
118} // close namespace bsl
119
120#endif
121
122// ----------------------------------------------------------------------------
123// Copyright 2025 Bloomberg Finance L.P.
124//
125// Licensed under the Apache License, Version 2.0 (the "License");
126// you may not use this file except in compliance with the License.
127// You may obtain a copy of the License at
128//
129// http://www.apache.org/licenses/LICENSE-2.0
130//
131// Unless required by applicable law or agreed to in writing, software
132// distributed under the License is distributed on an "AS IS" BASIS,
133// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134// See the License for the specific language governing permissions and
135// limitations under the License.
136// ----------------------------- END-OF-FILE ----------------------------------
137
138/** @} */
139/** @} */
140/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlat_valuetypefunctions.h:939
void vprint_unicode(bsl::string_view fmt, bsl::format_args args)
Definition bslfmt_print_imp.h:300
void vprint_nonunicode(bsl::string_view fmt, bsl::format_args args)
Definition bslfmt_print_imp.h:294