REDI_BASIC_IPSTREAM(3)
πΈ NAME πΈ
redi::basic_ipstream β the class template for Input PStreams, bestie. That's the whole vibe, that's the assignment. π
π¦ SYNOPSIS π¦
#include <pstream.h>
She inherits from std::basic_istream< CharT, std::char_traits< CharT > >, redi::pstream_common< CharT, Traits >, and redi::pstreams. Three whole lineages, main character energy fr fr. π
β¨ Public Types β¨
typedef pbase_type::pmode pmodeβ the type that says how you're connecting 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 for file descriptors.
π Public Member Functions π
basic_ipstream ()β default constructor, makes you an uninitialised stream. Baby stream. No thoughts, no process. πbasic_ipstream (const std::string &cmd, pmode mode=pstdout)β constructor that sets the stream up by starting a process.basic_ipstream (const std::string &file, const argv_type &argv, pmode mode=pstdout)β constructor that sets the stream up by starting a process.basic_ipstream (const argv_type &argv, pmode mode=pstdout)β constructor that sets the stream up by starting a process.~basic_ipstream ()β the destructor. πvoid open (const std::string &cmd, pmode mode=pstdout)β start a process.void open (const std::string &file, const argv_type &argv, pmode mode=pstdout)β start a process.basic_ipstream & out ()β point the streambuf at the process' stdout.basic_ipstream & err ()β point the streambuf at the process' stderr.int close ()bool is_open () constβ tells you whether the stream's buffer has been initialised.const std::string & command () constβ hands you back the command that initialised the stream.streambuf_type * rdbuf () constβ gives you 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β make a brand-new process group for the child process. She needs her own space, periodt.
π 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 that was used to start the process.
π« Detailed Description π«
template<typename CharT, typename Traits = std::char_traits<CharT>>
class redi::basic_ipstream< CharT, Traits >
"Class template for Input PStreams."
Okay so here's the tea: reading from an ipstream reads the command's standard output and/or standard error (which one depends on how you opened the ipstream, no cap), and the command's standard input is literally the same as the standard input of the process that created the object β unless the command itself went and changed it. So don't come for her about stdin, she's just matching the vibe of whoever made her. π«Ά
β Member Enumeration Documentation β
anonymous enum [protected], [inherited]
The enumerators, one by one:
bufszβ the size of pstreambuf buffers.pbszβ how many putback characters get kept.
π Constructor & Destructor Documentation π
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_ipstream< CharT, Traits >::basic_ipstream (const std::string & cmd, pmode mode = pstdout) [inline], [explicit]
Constructor that initialises the stream by starting a process. She sets up the stream buffer by calling do_open() with the arguments you handed her.
Parameters
- cmd β a string holding a shell command.
- mode β the I/O mode to use when opening the pipe.
See also
do_open(const std::string&, pmode)
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_ipstream< CharT, Traits >::basic_ipstream (const std::string & file, const argv_type & argv, pmode mode = pstdout) [inline]
Constructor that initialises the stream by starting a process. Again, she sets up the stream buffer by calling do_open() with whatever you passed in.
Parameters
- file β a string holding 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)
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_ipstream< CharT, Traits >::basic_ipstream (const argv_type & argv, pmode mode = pstdout) [inline], [explicit]
Constructor that initialises the stream by starting a process. This one sets up the stream buffer by calling do_open(argv[0],argv,mode|pstdout) β yes, argv[0] is the file, iconic behaviour.
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)
template<typename CharT, typename Traits = std::char_traits<CharT>>
redi::basic_ipstream< CharT, Traits >::~basic_ipstream () [inline]
Destructor. She closes the stream and waits for the child to exit β so if that child is taking forever, you are waiting, bestie, no skipping the queue. π
π₯ Member Function Documentation π₯
template<typename C, typename T> int redi::pstream_common< C, T >::close () [inline], [inherited]
Close the pipe, and hand back the program's exit status, exactly like pclose(3) does.
She calls rdbuf->close() and sets failbit if something goes wrong. Returns the process's exit status, as pclose(3) does.
References buf_.
template<typename C, typename T> const std::string & redi::pstream_common< C, T >::command () const [inline], [inherited]
Give me back the command used to initialise the stream.
Returns
a string containing the command used to initialise the stream.
References command_.
template<typename C, typename T> void redi::pstream_common< C, T >::do_open (const std::string & cmd, pmode mode) [inline], [protected], [inherited]
Start a process. She calls rdbuf()->open( cmd , mode ) and sets failbit if it goes sideways.
Parameters
- cmd β a string holding 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 is booked and busy, everyone wants her. π
template<typename C, typename T> void redi::pstream_common< C, T >::do_open (const std::string & file, const argv_type & argv, pmode mode) [inline], [protected], [inherited]
Start a process. This time she calls rdbuf()->open( file, argv, mode ) and sets failbit if it errors out.
Parameters
- file β a string holding 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_.
template<typename CharT, typename Traits = std::char_traits<CharT>>
basic_ipstream & redi::basic_ipstream< CharT, Traits >::err () [inline]
Set the streambuf to read from the process' stderr.
Returns
*this
template<typename C, typename T> bool redi::pstream_common< C, T >::is_open () const [inline], [inherited]
Report whether the stream's buffer has been initialised. Is she open? Is she available? Is she in her era?
Returns
rdbuf()->is_open().
See also
basic_pstreambuf::is_open()
References buf_.
template<typename CharT, typename Traits = std::char_traits<CharT>> void redi::basic_ipstream< CharT, Traits >::open (const std::string & cmd, pmode mode = pstdout) [inline]
Start a process. She calls do_open( cmd , mode|pstdout ) β note the |pstdout sneaking in there, she's always reading, always.
Parameters
- cmd β a string holding a shell command.
- mode β the I/O mode to use when opening the pipe.
See also
do_open(const std::string&, pmode)
template<typename CharT, typename Traits = std::char_traits<CharT>> void redi::basic_ipstream< CharT, Traits >::open (const std::string & file, const argv_type & argv, pmode mode = pstdout) [inline]
Start a process. She calls do_open( file , argv , mode|pstdout ). Same deal, same |pstdout, same energy.
Parameters
- file β a string holding 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)
template<typename CharT, typename Traits = std::char_traits<CharT>>
basic_ipstream & redi::basic_ipstream< CharT, Traits >::out () [inline]
Set the streambuf to read from the process' stdout.
Returns
*this
template<typename C, typename T> pstream_common< C, T >::streambuf_type * redi::pstream_common< C, T >::rdbuf () const [inline], [inherited]
Give me a pointer to the stream buffer.
Returns
a pointer to the private stream buffer member.
References buf_.
π Author π
Generated automatically by Doxygen for PStreams from the source code.
Okay so that's the whole page, and it's all PStreams, straight from the source β and the footer didn't hand me a date, so: no date, just vibes. Slay, you read the whole manpage, I'm so proud of you. πβ¨π¦
π¦ 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