\section{KProc\-IO Class Reference}
\label{classKProcIO}\index{KProcIO@{KProcIO}}
KProc\-IO A slightly simpler interface to {\bf KProcess}{\rm (p.\,\pageref{classKProcess})}.  


{\tt \#include $<$kprocio.h$>$}

Inheritance diagram for KProc\-IO:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=47pt]{classKProcIO__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KProc\-IO:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=253pt]{classKProcIO__coll__graph}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf read\-Ready} ({\bf KProc\-IO} $\ast$pio)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KProc\-IO} ({\bf QText\-Codec} $\ast$codec=0)
\item 
{\bf $\sim$KProc\-IO} ()
\item 
void {\bf set\-Comm} ({\bf Communication} comm)
\item 
bool {\bf start} ({\bf Run\-Mode} runmode=Notify\-On\-Exit, bool include\-Stderr=false)
\item 
bool {\bf write\-Stdin} (const {\bf QString} \&line, bool appendnewline=true)
\item 
bool {\bf write\-Stdin} (const {\bf QCString} \&line, bool appendnewline)
\item 
bool {\bf write\-Stdin} (const {\bf QByte\-Array} \&data)
\item 
KDE\_\-DEPRECATED bool {\bf fputs} (const {\bf QString} \&line, bool Append\-New\-Line=true)
\item 
void {\bf close\-When\-Done} ()
\item 
int {\bf readln} ({\bf QString} \&line, bool auto\-Ack=true, bool $\ast$partial=0)
\item 
KDE\_\-DEPRECATED int {\bf fgets} ({\bf QString} \&line, bool auto\-Ack=false)
\item 
void {\bf reset\-All} ()
\item 
void {\bf ack\-Read} ()
\item 
void {\bf enable\-Read\-Signals} (bool enable)
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf received} ({\bf KProcess} $\ast$proc, char $\ast$buffer, int buflen)\label{classKProcIO_j0}

\item 
void {\bf sent} ({\bf KProcess} $\ast$)\label{classKProcIO_j1}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf controlled\-Emission} ()\label{classKProcIO_b0}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKProcIO_b1}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf QPtr\-List}$<$ {\bf QByte\-Array} $>$ {\bf outbuffer}\label{classKProcIO_p0}

\item 
{\bf QCString} {\bf recvbuffer}\label{classKProcIO_p1}

\item 
{\bf QText\-Codec} $\ast$ {\bf codec}\label{classKProcIO_p2}

\item 
int {\bf rbi}\label{classKProcIO_p3}

\item 
bool {\bf needreadsignal}\label{classKProcIO_p4}

\item 
bool {\bf readsignalon}\label{classKProcIO_p5}

\item 
bool {\bf writeready}\label{classKProcIO_p6}

\end{CompactItemize}


\subsection{Detailed Description}
KProc\-IO A slightly simpler interface to {\bf KProcess}{\rm (p.\,\pageref{classKProcess})}. 

This class provides a slightly simpler interface to the communication functions provided by {\bf KProcess}{\rm (p.\,\pageref{classKProcess})}. The simplifications are: \begin{itemize}
\item The buffer for a write is copied to an internal KProc\-IO buffer and maintained/freed appropriately. There is no need to be concerned with {\bf wrote\-Stdin()}{\rm (p.\,\pageref{classKProcess_l4})} signals \_\-at\_\-all\_\-. \item {\bf readln()}{\rm (p.\,\pageref{classKProcIO_a9})} reads a line of data and buffers any leftovers. \item Conversion from/to unicode.\end{itemize}
Basically, KProc\-IO gives you buffered I/O similar to {\bf fgets()}{\rm (p.\,\pageref{classKProcIO_a10})}/fputs().

Aside from these, and the fact that {\bf start()}{\rm (p.\,\pageref{classKProcIO_a3})} takes different parameters, use this class just like {\bf KProcess}{\rm (p.\,\pageref{classKProcess})}.

\begin{Desc}
\item[Author:]David Sweet \end{Desc}




Definition at line 50 of file kprocio.h.

\subsection{Constructor \& Destructor Documentation}
\index{KProcIO@{KProc\-IO}!KProcIO@{KProcIO}}
\index{KProcIO@{KProcIO}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KProc\-IO::KProc\-IO ({\bf QText\-Codec} $\ast$ {\em codec} = {\tt 0})}\label{classKProcIO_a0}


Constructor. 



Definition at line 38 of file kprocio.cpp.

References QText\-Codec::codec\-For\-Name(), endl(), and QPtr\-List::set\-Auto\-Delete().\index{KProcIO@{KProc\-IO}!~KProcIO@{$\sim$KProcIO}}
\index{~KProcIO@{$\sim$KProcIO}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KProc\-IO::$\sim${\bf KProc\-IO} ()}\label{classKProcIO_a1}


Destructor. 



Definition at line 55 of file kprocio.cpp.

\subsection{Member Function Documentation}
\index{KProcIO@{KProc\-IO}!setComm@{setComm}}
\index{setComm@{setComm}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProc\-IO::set\-Comm ({\bf Communication} {\em comm})}\label{classKProcIO_a2}


Sets the communication mode to be passed to {\bf KProcess::start()}{\rm (p.\,\pageref{classKProcess_a9})} by {\bf start()}{\rm (p.\,\pageref{classKProcIO_a3})}. 

The default communication mode is KProcess::All. You probably want to use this function in conjunction with KProcess::set\-Use\-Pty(). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em comm}]the communication mode \end{description}
\end{Desc}


Definition at line 83 of file kprocio.cpp.\index{KProcIO@{KProc\-IO}!start@{start}}
\index{start@{start}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProc\-IO::start ({\bf Run\-Mode} {\em runmode} = {\tt NotifyOnExit}, bool {\em include\-Stderr} = {\tt false})}\label{classKProcIO_a3}


Starts the process. 

It will fail in the following cases: \begin{itemize}
\item The process is already running. \item The command line argument list is empty. \item The starting of the process failed (could not fork). \item The executable was not found.\end{itemize}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em runmode}]For a detailed description of the various run modes, have a look at the general description of the {\bf KProcess}{\rm (p.\,\pageref{classKProcess})} class. \item[{\em include\-Stderr}]If true, data from both stdout and stderr is listened to. If false, only stdout is listened to. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success, false on error. \end{Desc}


Definition at line 88 of file kprocio.cpp.

References QObject::connect(), KProcess::start(), and KProcess::wrote\-Stdin().\index{KProcIO@{KProc\-IO}!writeStdin@{writeStdin}}
\index{writeStdin@{writeStdin}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProc\-IO::write\-Stdin (const {\bf QString} \& {\em line}, bool {\em appendnewline} = {\tt true})}\label{classKProcIO_a4}


Writes text to stdin of the process. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em line}]Text to write. \item[{\em appendnewline}]if true, a newline '$\backslash$n' is appended. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}


Definition at line 105 of file kprocio.cpp.

References QText\-Codec::from\-Unicode().\index{KProcIO@{KProc\-IO}!writeStdin@{writeStdin}}
\index{writeStdin@{writeStdin}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProc\-IO::write\-Stdin (const {\bf QCString} \& {\em line}, bool {\em appendnewline})}\label{classKProcIO_a5}


Writes text to stdin of the process. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em line}]Text to write. \item[{\em appendnewline}]if true, a newline '$\backslash$n' is appended. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}


Definition at line 110 of file kprocio.cpp.

References QPtr\-List::append(), QCString::length(), and KProcess::write\-Stdin().\index{KProcIO@{KProc\-IO}!writeStdin@{writeStdin}}
\index{writeStdin@{writeStdin}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KProc\-IO::write\-Stdin (const {\bf QByte\-Array} \& {\em data})}\label{classKProcIO_a6}


Writes data to stdin of the process. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Data to write. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}


Definition at line 139 of file kprocio.cpp.

References QPtr\-List::append(), and KProcess::write\-Stdin().\index{KProcIO@{KProc\-IO}!fputs@{fputs}}
\index{fputs@{fputs}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDE\_\-DEPRECATED bool KProc\-IO::fputs (const {\bf QString} \& {\em line}, bool {\em Append\-New\-Line} = {\tt true})\hspace{0.3cm}{\tt  [inline]}}\label{classKProcIO_a7}


This function just calls {\bf write\-Stdin()}{\rm (p.\,\pageref{classKProcIO_a4})}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em line}]Text to write. \item[{\em Append\-New\-Line}]if true, a newline '$\backslash$n' is appended. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}
\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}


Definition at line 123 of file kprocio.h.

References KProcess::write\-Stdin().\index{KProcIO@{KProc\-IO}!closeWhenDone@{closeWhenDone}}
\index{closeWhenDone@{closeWhenDone}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProc\-IO::close\-When\-Done ()}\label{classKProcIO_a8}


Closes stdin after all data has been send. 



Definition at line 154 of file kprocio.cpp.

References QPtr\-List::append(), and KProcess::close\-Stdin().\index{KProcIO@{KProc\-IO}!readln@{readln}}
\index{readln@{readln}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KProc\-IO::readln ({\bf QString} \& {\em line}, bool {\em auto\-Ack} = {\tt true}, bool $\ast$ {\em partial} = {\tt 0})}\label{classKProcIO_a9}


Reads a line of text (up to and including '$\backslash$n'). 

Use {\bf readln()}{\rm (p.\,\pageref{classKProcIO_a9})} in response to a {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})} signal. You may use it multiple times if more than one line of data is available. Be sure to use {\bf ack\-Read()}{\rm (p.\,\pageref{classKProcIO_a12})} when you have finished processing the {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})} signal. This informs KProc\-IO that you are ready for another {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})} signal.

{\bf readln()}{\rm (p.\,\pageref{classKProcIO_a9})} never blocks.

auto\-Ack==true makes these functions call {\bf ack\-Read()}{\rm (p.\,\pageref{classKProcIO_a12})} for you.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em line}]is used to store the line that was read. \item[{\em auto\-Ack}]when true, {\bf ack\-Read()}{\rm (p.\,\pageref{classKProcIO_a12})} is called for you. \item[{\em partial}]when provided the line is returned even if it does not contain a '$\backslash$n'. $\ast$partial will be set to false if the line contains a '$\backslash$n' and false otherwise. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of characters read, or -1 if no data is available. \end{Desc}


Definition at line 225 of file kprocio.cpp.

References QCString::find(), QCString::length(), QCString::mid(), and QText\-Codec::to\-Unicode().\index{KProcIO@{KProc\-IO}!fgets@{fgets}}
\index{fgets@{fgets}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDE\_\-DEPRECATED int KProc\-IO::fgets ({\bf QString} \& {\em line}, bool {\em auto\-Ack} = {\tt false})\hspace{0.3cm}{\tt  [inline]}}\label{classKProcIO_a10}


This function calls {\bf readln()}{\rm (p.\,\pageref{classKProcIO_a9})}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em line}]is used to store the line that was read. \item[{\em auto\-Ack}]when true, {\bf ack\-Read()}{\rm (p.\,\pageref{classKProcIO_a12})} is called for you. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of characters read, or -1 if no data is available. \end{Desc}


\begin{Desc}
\item[{\bf Deprecated}]use readln. Note that it has an inverted auto\-Ack default, though. \end{Desc}


Definition at line 162 of file kprocio.h.\index{KProcIO@{KProc\-IO}!resetAll@{resetAll}}
\index{resetAll@{resetAll}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProc\-IO::reset\-All ()}\label{classKProcIO_a11}


Reset the class. 

Doesn't kill the process. 

Definition at line 61 of file kprocio.cpp.

References QPtr\-List::clear(), KProcess::clear\-Arguments(), QObject::disconnect(), KProcess::is\-Running(), KProcess::kill(), and KProcess::wrote\-Stdin().\index{KProcIO@{KProc\-IO}!ackRead@{ackRead}}
\index{ackRead@{ackRead}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProc\-IO::ack\-Read ()}\label{classKProcIO_a12}


Call this after you have finished processing a {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})} signal. 

This call need not be made in the slot that was signalled by {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})}. You won't receive any more {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})} signals until you acknowledge with {\bf ack\-Read()}{\rm (p.\,\pageref{classKProcIO_a12})}. This prevents your slot from being reentered while you are still processing the current data. If this doesn't matter, then call {\bf ack\-Read()}{\rm (p.\,\pageref{classKProcIO_a12})} right away in your {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})}-processing slot. 

Definition at line 196 of file kprocio.cpp.

References QCString::length().\index{KProcIO@{KProc\-IO}!enableReadSignals@{enableReadSignals}}
\index{enableReadSignals@{enableReadSignals}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProc\-IO::enable\-Read\-Signals (bool {\em enable})}\label{classKProcIO_a13}


Turns {\bf read\-Ready()}{\rm (p.\,\pageref{classKProcIO_l0})} signals on and off. 

You can turn this off at will and not worry about losing any data. (as long as you turn it back on at some point...) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]true to turn the signals on, false to turn them off \end{description}
\end{Desc}


Definition at line 217 of file kprocio.cpp.

References read\-Ready().\index{KProcIO@{KProc\-IO}!readReady@{readReady}}
\index{readReady@{readReady}!KProcIO@{KProc\-IO}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KProc\-IO::read\-Ready ({\bf KProc\-IO} $\ast$ {\em pio})\hspace{0.3cm}{\tt  [signal]}}\label{classKProcIO_l0}


Emitted when the process is ready for reading. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pio}]the process that emitted the signal \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf enable\-Read\-Signals()}{\rm (p.\,\pageref{classKProcIO_a13})} \end{Desc}


Referenced by enable\-Read\-Signals().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kprocio.h\item 
kprocio.cpp\end{CompactItemize}
