From: Christian Herdtweck Date: Mon, 30 Nov 2015 08:27:38 +0000 (+0100) Subject: added comments to pipestream, including WEXITSTATUS X-Git-Tag: v2.8~23 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=bf4c487cd7df968218d61086dc87b6b8374c6620;p=libi2ncommon added comments to pipestream, including WEXITSTATUS --- diff --git a/src/pipestream.hxx b/src/pipestream.hxx index 211ee5d..1fca37e 100644 --- a/src/pipestream.hxx +++ b/src/pipestream.hxx @@ -37,10 +37,15 @@ on this file might be covered by the GNU General Public License. #include "exception.hxx" -// ATTENTION: A lot of mysterious STL bugs occured -// with a "real" buffer (buffer larger than 1 byte and up to 100 bytes) -// -> Keep it slow and working! - +/** @brief runs command and provides buffered input for it through pipe + * + * opens pipe to command using popen; exit status available after destruction + * (use WEXITSTATUS to get the "regular" return code (lowest byte)) + * + * ATTENTION: A lot of mysterious STL bugs occured + * with a "real" buffer (buffer larger than 1 byte and up to 100 bytes) + * -> Keep it slow and working! + */ class inpipebuf : public std::streambuf { protected: @@ -79,6 +84,7 @@ public: } } + /** note: exit status only available after destruction */ void store_exit_status(bool *_status_set, int *_exit_status) { status_set = _status_set; exit_status = _exit_status; } @@ -101,6 +107,7 @@ protected: } }; +/** @brief stream around inpipebuf -- see comment there */ class inpipestream : public std::istream { protected: @@ -115,6 +122,12 @@ public: { buf.store_exit_status(_status_set, _exit_status); } }; + +/** @brief runs command and provides buffered ouptput from it through pipe + * + * opens pipe to command using popen; exit status available after destruction + * (use WEXITSTATUS to get the "regular" return code (lowest byte)) + */ class outpipebuf : public std::streambuf { protected: @@ -149,6 +162,7 @@ public: } } + /** note: exit status only available after destruction */ void store_exit_status(bool *_status_set, int *_exit_status) { status_set = _status_set; exit_status = _exit_status; } @@ -169,6 +183,8 @@ protected: } }; + +/** @brief stream around outpipebuf -- see comment there */ class outpipestream : public std::ostream { protected: