REDI_BASIC_IPSTREAM(3)

πŸ“¦
version 1.0.4 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

🌸 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_type
  • typedef std::basic_ios< CharT, Traits > ios_type
  • enum { 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