From cc1fdf725b80026aedeb029d7524d0017b8b3aee Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 3 Apr 2024 23:38:13 -0400 Subject: [PATCH] Correct some of the underlying-forwarding parts of stream stacks. --- IOStreams/StackableStreambuf.h | 36 +++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/IOStreams/StackableStreambuf.h b/IOStreams/StackableStreambuf.h index ab608d7..a1eb219 100644 --- a/IOStreams/StackableStreambuf.h +++ b/IOStreams/StackableStreambuf.h @@ -32,19 +32,27 @@ namespace Alepha::Hydrogen::IOStreams ::detail:: StackableStreambuf_m protected: // EEEW. But to sidestep/circumvent, all this below is necessary. auto - forwardOverflow( const int ch ) const + forwardOverflow( const int ch ) { int (std::streambuf::*ov)( int )= &StackableStreambufUnderlyingShim::overflow; return ( getUnderlying()->*ov )( ch ); } auto - forwardUnderflow() const + forwardUnderflow() { int (std::streambuf::*uf)()= &StackableStreambufUnderlyingShim::underflow; return (getUnderlying()->*uf)(); } + auto + underlying_sbumpc() const + { + int (std::streambuf::*sbc)()= &StackableStreambufUnderlyingShim::sbumpc; + return (getUnderlying()->*sbc)(); + } + + auto underlying_eback() const { @@ -72,6 +80,28 @@ namespace Alepha::Hydrogen::IOStreams ::detail:: StackableStreambuf_m void (std::streambuf::*sg)( char *, char *, char * )= &StackableStreambufUnderlyingShim::setg; return (getUnderlying()->*sg)( b, g, e ); } + + + auto + underlying_pbase() const + { + char *(std::streambuf::*pb)() const= &StackableStreambufUnderlyingShim::pbase; + return (getUnderlying()->*pb)(); + } + + auto + underlying_pptr() const + { + char *(std::streambuf::*pp)() const= &StackableStreambufUnderlyingShim::pptr; + return (getUnderlying()->*pp)(); + } + + auto + underlying_epptr() const + { + char *(std::streambuf::*ep)() const= &StackableStreambufUnderlyingShim::epptr; + return (getUnderlying()->*ep)(); + } }; struct exports::StackableStreambuf @@ -94,7 +124,7 @@ namespace Alepha::Hydrogen::IOStreams ::detail:: StackableStreambuf_m void unhook( std::istream &is ) const; protected: - std::ostream &out( std::ostream &&res= std::ostream{nullptr} ) const; + std::ostream &out( std::ostream &&res= std::ostream{ nullptr } ) const; int overflow( const int ch ) override;