WPILibC++ 2023.4.3-108-ge5452e3
raw_ostream.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#ifndef WPIUTIL_WPI_FMT_RAW_OSTREAM_H_
6#define WPIUTIL_WPI_FMT_RAW_OSTREAM_H_
7
8#include "fmt/format.h"
9#include "wpi/raw_ostream.h"
10
12
13inline void vprint(wpi::raw_ostream& os, string_view format_str,
14 fmt::format_args args) {
16 detail::vformat_to(buffer, format_str, args);
17 os.write(buffer.data(), buffer.size());
18}
19
20/**
21 * Prints formatted data to the stream *os*.
22 */
23template <typename S, typename... Args>
24void print(wpi::raw_ostream& os, const S& format_str, Args&&... args) {
25 vprint(os, format_str, fmt::make_format_args(args...));
26}
27
29
30#endif // WPIUTIL_WPI_FMT_RAW_OSTREAM_H_
\rst A dynamically growing memory buffer for trivially copyable/constructible types with the first SI...
Definition: format.h:819
\rst A contiguous memory buffer with an optional growing ability.
Definition: core.h:862
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data.
Definition: core.h:908
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition: core.h:902
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:44
raw_ostream & write(unsigned char C)
constexpr auto make_format_args(Args &&... args) -> format_arg_store< Context, remove_cvref_t< Args >... >
\rst Constructs a ~fmtformat_arg_store object that contains references to arguments and can be implic...
Definition: core.h:1923
#define FMT_BEGIN_NAMESPACE
Definition: core.h:214
basic_format_args< format_context > format_args
An alias to basic_format_args<format_context>.
Definition: core.h:2069
#define FMT_END_NAMESPACE
Definition: core.h:217
void print(wpi::raw_ostream &os, const S &format_str, Args &&... args)
Prints formatted data to the stream os.
Definition: raw_ostream.h:24
FMT_BEGIN_NAMESPACE void vprint(wpi::raw_ostream &os, string_view format_str, fmt::format_args args)
Definition: raw_ostream.h:13
#define S(label, offset, message)
Definition: Errors.h:119
auto vformat_to(OutputIt out, const S &format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args) -> OutputIt
Definition: xchar.h:124