REDI_BASIC_OPSTREAM(3)
πΈ redi::basic_opstream πΈ
okay bestie, welcome to a page straight outta the Library Functions Manual β this is the class template for Output PStreams and she is serving. grab a boba, we're going in π
β¨ NAME β¨
redi::basic_opstream β Class template for Output PStreams π«Ά
β¨ SYNOPSIS β¨
#include <pstream.h>
Inherits std::basic_ostream< CharT, std::char_traits< CharT > >, redi::pstream_common< CharT, Traits >, and redi::pstreams. she's got so many ancestors, main character energy fr fr π
π Public Types π
typedef pbase_type::pmode pmodeβ the type you use to say how to connect to the process πtypedef pbase_type::argv_type argv_typeβ the type that holds all the arguments for a command πtypedef int fd_typeβ the type used for file descriptors, it's justintand that's iconic π
π Public Member Functions π
basic_opstream ()β default constructor, makes an uninitialised stream (so, a little empty shell, no thoughts, head empty π)basic_opstream (const std::string &cmd, pmode mode=pstdin)β constructor that initialises the stream by starting a process πbasic_opstream (const std::string &file, const argv_type &argv, pmode mode=pstdin)β constructor that initialises the stream by starting a process πbasic_opstream (const argv_type &argv, pmode mode=pstdin)β constructor that initialises the stream by starting a process π~basic_opstream ()β destructor, the farewell tour πvoid open (const std::string &cmd, pmode mode=pstdin)β start a process πvoid open (const std::string &file, const argv_type &argv, pmode mode=pstdin)β start a process πint close ()β (the docs just drop the name and ghost us, no description given, she's mysterious like that π)bool is_open () constβ reports whether the stream's buffer has been initialised πconst std::string & command () constβ returns the command used to initialise the stream π£streambuf_type * rdbuf () constβ returns a pointer to the stream buffer π―
π Static Public Attributes π
static const pmode pstdin = std::ios_base::outβ write to stdin βοΈstatic const pmode pstdout = std::ios_base::inβ read from stdout πstatic const pmode pstderr = std::ios_base::appβ read from stderr πstatic const pmode newpg = std::ios_base::truncβ create a new process group for the child process πΌ
π Protected Types π
typedef basic_pstreambuf< CharT, Traits > streambuf_typetypedef std::basic_ios< CharT, Traits > ios_typeenum { bufsz = 32, pbsz = 2 }
π Protected Member Functions π
void do_open (const std::string &cmd, pmode mode)β start a process πvoid do_open (const std::string &file, const argv_type &argv, pmode mode)β start a process π
π Protected Attributes π
std::string command_β the command used to start the process π
π Related Symbols π
(noting for the record bestie: these are not member symbols π«Ά)
template<typename C, typename T> std::basic_ostream< C, T > & peof (std::basic_ostream< C, T > &s)β manipulator to close the pipe connected to the process' stdin π
π Detailed Description π
template<typename CharT, typename Traits = std::char_traits<CharT>>
class redi::basic_opstream< CharT, Traits >
"Class template for Output PStreams.
Writing to an open opstream writes to the standard input of the command; the command's standard output is the same as that of the process that created the pstream object, unless altered by the command itself."
so like. you write into it, and it lands on the command's stdin. the command's stdout? that's just whatever the process that made the pstream already had, unless the command itself switched it up. no cap π―
π Member Enumeration Documentation π
anonymous enum [protected], [inherited]
Enumerator π
bufszβ Size of pstreambuf buffers π¦pbszβ Number of putback characters kept β©οΈ
π Constructor & Destructor Documentation π
π basic_opstream (const std::string & cmd, pmode mode = pstdin) [inline], [explicit]
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_opstream< CharT, Traits >::basic_opstream (const std::string & cmd, pmode mode = pstdin)
Constructor that initialises the stream by starting a process. π she initialises the stream buffer by calling do_open() with the args you handed her.
Parameters
- cmd β a string containing a shell command π
- mode β the I/O mode to use when opening the pipe π§
See also
do_open(const std::string&, pmode)
π basic_opstream (const std::string & file, const argv_type & argv, pmode mode = pstdin) [inline]
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_opstream< CharT, Traits >::basic_opstream (const std::string & file, const argv_type & argv, pmode mode = pstdin)
Constructor that initialises the stream by starting a process. π same vibe: calls do_open() with the supplied arguments.
Parameters
- file β a string containing the pathname of a program to execute π
- argv β a vector of argument strings passed to the new program π
- mode β the I/O mode to use when opening the pipe π§
See also
do_open(const std::string&, const argv_type&, pmode)
π basic_opstream (const argv_type & argv, pmode mode = pstdin) [inline], [explicit]
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_opstream< CharT, Traits >::basic_opstream (const argv_type & argv, pmode mode = pstdin)
Constructor that initialises the stream by starting a process. π this one calls do_open(argv[0],argv,mode|pstdin) β yes, exactly like that, argv[0] and everything, periodt.
Parameters
- argv β a vector of argument strings passed to the new program π
- mode β the I/O mode to use when opening the pipe π§
See also
do_open(const std::string&, const argv_type&, pmode)
π ~basic_opstream () [inline]
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_opstream< CharT, Traits >::~basic_opstream ()
Destructor. Closes the stream and waits for the child to exit. π the emotional goodbye β she closes up and waits for the child, very responsible queen π
π Member Function Documentation π
π close () [inline], [inherited]
template<typename C, typename T> int redi::pstream_common< C, T >::close ()
Close the pipe, returning the program's exit status, as pclose(3) does. π
Calls rdbuf->close() and sets failbit on error. Returns process's exit status, as pclose(3) does.
References buf_.
π command () const [inline], [inherited]
template<typename C, typename T> const std::string & redi::pstream_common< C, T >::command () const
Return the command used to initialise the stream. π£
Returns
- a string containing the command used to initialise the stream π«Ά
References command_.
π do_open (const std::string & cmd, pmode mode) [inline], [protected], [inherited]
template<typename C, typename T> void redi::pstream_common< C, T >::do_open (const std::string & cmd, pmode mode)
Start a process. Calls rdbuf()->open( cmd , mode ) and sets failbit on error. π
Parameters
- cmd β a string containing a shell command π
- mode β the I/O mode to use when opening the pipe π§
See also
basic_pstreambuf::open(const std::string&, pmode)
References buf_, and command_.
Referenced by redi::basic_ipstream< char >::open(), redi::basic_ipstream< char >::open(), redi::basic_opstream< char >::open(), redi::basic_opstream< char >::open(), redi::basic_pstream< char >::open(), redi::basic_pstream< char >::open(), redi::basic_rpstream< char >::open(), redi::basic_rpstream< char >::open(), pstream_common(), and pstream_common(). (she's everywhere, the social butterfly of this library π¦)
π do_open (const std::string & file, const argv_type & argv, pmode mode) [inline], [protected], [inherited]
template<typename C, typename T> void redi::pstream_common< C, T >::do_open (const std::string & file, const argv_type & argv, pmode mode)
Start a process. Calls rdbuf()->open( file, argv, mode ) and sets failbit on error. π
Parameters
- file β a string containing the pathname of a program to execute π
- argv β a vector of argument strings passed to the new program π
- mode β the I/O mode to use when opening the pipe π§
See also
basic_pstreambuf::open(const std::string&, const argv_type&, pmode)
References buf_, and command_.
π is_open () const [inline], [inherited]
template<typename C, typename T> bool redi::pstream_common< C, T >::is_open () const
Report whether the stream's buffer has been initialised. π
Returns
rdbuf()->is_open()
See also
basic_pstreambuf::is_open()
References buf_.
π open (const std::string & cmd, pmode mode = pstdin) [inline]
template<typename CharT, typename Traits = std::char_traits<CharT>> void
redi::basic_opstream< CharT, Traits >::open (const std::string & cmd, pmode mode = pstdin)
Start a process. Calls do_open( cmd , mode|pstdin ). π notice the |pstdin bestie, don't lose it β¨
Parameters
- cmd β a string containing a shell command π
- mode β the I/O mode to use when opening the pipe π§
See also
do_open(const std::string&, pmode)
π open (const std::string & file, const argv_type & argv, pmode mode = pstdin) [inline]
template<typename CharT, typename Traits = std::char_traits<CharT>> void
redi::basic_opstream< CharT, Traits >::open (const std::string & file, const argv_type & argv, pmode mode = pstdin)
Start a process. Calls do_open( file , argv , mode|pstdin ). π again with the |pstdin β it's part of the fit, it stays π
Parameters
- file β a string containing the pathname of a program to execute π
- argv β a vector of argument strings passed to the new program π
- mode β the I/O mode to use when opening the pipe π§
See also
do_open(const std::string&, const argv_type&, pmode)
π rdbuf () const [inline], [inherited]
template<typename C, typename T> pstream_common< C, T >::streambuf_type *
redi::pstream_common< C, T >::rdbuf () const
Return a pointer to the stream buffer. π―
Returns
- a pointer to the private stream buffer member π
References buf_.
π Friends And Related Symbol Documentation π
π peof (std::basic_ostream< C, T > & s) [related]
template<typename C, typename T> std::basic_ostream< C, T > & peof
(std::basic_ostream< C, T > & s)
Manipulator to close the pipe connected to the process' stdin. When inserted into an output pstream the manipulator calls basic_pstreambuf<C,T>::peof() to close the output pipe, causing the child process to receive the end-of-file indicator on subsequent reads from its stdin stream. πβ¨
Parameters
- s β An output PStream class π«Ά
Returns
- The stream object the manipulator was invoked on β©οΈ
See also
basic_pstreambuf<C,T>::peof()basic_pstreambasic_rpstream
π Author π
Generated automatically by Doxygen for PStreams from the source code. π€ (not a human author bestie, it's the robot doing the typing β¨)
and that's the whole page, bestie!! π this came out of PStreams, living in section 3 of the manual (redi::basi...T, Traits >(3), the header and footer doing their little matching fit π). every single flag, type, default, param and reference is still here, i just gave it a makeover. mwah π
π¦ where this page comes from
- ubuntu resolute: libpstreams-dev 1.0.4-2 Β· BSL-1.0
- ubuntu stonking: libpstreams-dev 1.0.4-2 Β· BSL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms