added comments to pipestream, including WEXITSTATUS
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 30 Nov 2015 08:27:38 +0000 (09:27 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 30 Nov 2015 08:27:38 +0000 (09:27 +0100)
src/pipestream.hxx

index 211ee5d..1fca37e 100644 (file)
@@ -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: