xo-umbrella2/xo-ppsink/include/xo/ppsink/quoted_char_ostream.hpp
Roland Conybeare 848b1ed6f0
Some checks failed
cmake-docker / cmake-build (clang, clang++) (push) Failing after 4m2s
cmake-docker / cmake-build (gcc, g++) (push) Failing after 4m25s
CI / smoke-test (push) Failing after 3m41s
xo-ppsink: include tidy to remove ostream refs [HYGIENE]
2026-08-22 16:17:51 -04:00

36 lines
1.1 KiB
C++

/** @file quoted_char_ostream.hpp
*
* @author Roland Conybeare, Jul 2026
*
* operator<<(std::ostream&, quoted_char): render a quoted_char to an ostream.
*
* A migration bridge, mirroring tag_ostream.hpp: the legacy
* @c os << quoted_char(ch) idiom appears in ostream-based diagnostics, and
* this lets such a site move to xo::pp::quoted_char without being rewritten.
* Routes through a FlatSink wrapping @p os, reusing Prettifier<quoted_char>.
*
* Segregated from quoted_char.hpp (which stays free of <ostream>, like
* tag.hpp vs tag_ostream.hpp). Unlike tag_ostream.hpp this does not need
* pretty_ostream.hpp: a quoted_char always bottoms out in put_with_escape(),
* so the operator<< fallback in pretty() is never instantiated.
**/
#pragma once
#include "FlatSink.hpp"
#include "pretty.hpp" /* PpSink::pp */
#include "quoted_char.hpp"
#include <ostream>
namespace xo::pp {
inline std::ostream &
operator<<(std::ostream & os, const quoted_char & x) {
FlatSink sink(os.rdbuf());
sink.pp(x);
return os;
}
} /*namespace xo::pp*/
/* end quoted_char_ostream.hpp */