86 #include <string_view>
110 static constexpr
size_t kDefaultBufferSize{1024 * 1024 * 1};
169 void init() noexcept;
176 [[nodiscard]]
bool is_tty() const noexcept;
183 [[nodiscard]]
bool is_initialized() const noexcept;
314 static
int default_stdout_fd() noexcept;
316 void flush_unlocked() noexcept;
318 void write_to_buffer(const
char* data,
size_t len) noexcept;
321 TerminalStream& write_unsigned(
unsigned long long value) noexcept;
326 std::atomic_bool initialized_{
false};
327 std::atomic_bool is_tty_{
false};
329 mutable std::mutex mutex_;
330 std::vector<char> buffer_;
331 size_t write_pos_{0};
332 int fd_{default_stdout_fd()};
337 #ifndef VLINK_TERM_OUT
338 #define VLINK_TERM_OUT vlink::TerminalStream::get()
Process-wide buffered stdout writer with TTY detection, ANSI support, and a 1 MiB buffer.
Definition: terminal_stream.h:101
static TerminalStream & get() noexcept
Returns the process-wide singleton, building it on the first call.
TerminalStream &(*)(TerminalStream &) ManipType
Function-pointer type accepted by operator<<(ManipType) for custom manipulators.
Definition: terminal_stream.h:115
Cross-platform macros for visibility, branch hints, copy prevention, singletons and string helpers.
#define VLINK_EXPORT
Definition: macros.h:81