WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
raw_ostream.hpp
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#pragma once
6
7#include <fmt/format.h>
8
9#include "wpi/util/raw_ostream.hpp"
10
11namespace wpi::util {
12
13inline void vprint(wpi::util::raw_ostream& os, fmt::string_view format_str,
14 fmt::format_args args) {
15 fmt::memory_buffer buffer;
16 fmt::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::util::raw_ostream& os, const S& format_str, Args&&... args) {
25 vprint(os, format_str, fmt::make_format_args(args...));
26}
27
28} // namespace wpi::util
#define S(label, offset, message)
Definition Errors.hpp:113
Definition raw_os_ostream.hpp:19
void vprint(wpi::util::raw_ostream &os, fmt::string_view format_str, fmt::format_args args)
Definition raw_ostream.hpp:13
void print(wpi::util::raw_ostream &os, const S &format_str, Args &&... args)
Prints formatted data to the stream os.
Definition raw_ostream.hpp:24