⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kprocess.h

📁 pixil 最新的嵌入linux 應用程序集,別的地方很難下載
💻 H
📖 第 1 页 / 共 2 页
字号:
   /**     These signals get emitted, when output from the child process has	 been received on stdout. -- To actually get	 these signals, the respective communication link (stdout/stderr)	 has to be turned on in "start".      "buffer" contains the data, and "buflen" bytes are available from	 the client.      You should copy the information contained in "buffer" to your private     data structures before returning from this slot.  */  void receivedStdout(KProcess *proc, char *buffer, int buflen);  /**     These signals get emitted, when output from the child process has	 been received on stderr. -- To actually get	 these signals, the respective communication link (stdout/stderr)	 has to be turned on in "start".      "buffer" contains the data, and "buflen" bytes are available from	 the client.      You should copy the information contained in "buffer" to your private     data structures before returning from this slot.  */  void receivedStderr(KProcess *proc, char *buffer, int buflen);  /**     This signal gets emitted after all the data that has been	 specified by a prior call to "writeStdin" has actually been	 written to the child process.   */  void wroteStdin(KProcess *proc);protected slots: /**   This slot gets activated when data from the child's stdout arrives.   It usually calls "childOutput"  */  void slotChildOutput(int fdno); /**   This slot gets activated when data from the child's stderr arrives.   It usually calls "childError"  */  void slotChildError(int fdno);  /*	Slot functions for capturing stdout and stderr of the child   */  /**	Called when another bulk of data can be sent to the child's	stdin. If there is no more data to be sent to stdin currently	available, this function must disable the QSocketNotifier "innot".  */  void slotSendData(int dummy);protected:  /**     The list of the process' command line arguments. The first entry     in this list is the executable itself.  */  QStrList arguments;  /**     How to run the process (Block, NotifyOnExit, DontCare). You should     not modify this data member directly from derived classes.  */  RunMode run_mode;  /**      TRUE if the process is currently running. You should not      modify this data member directly from derived classes. For     reading the value of this data member, please use "isRunning()"     since "runs" will probably be made private in later versions     of KProcess.  */  bool runs;  /**       The PID of the currently running process (see "getPid()").      You should not modify this data member in derived classes.      Please use "getPid()" instead of directly accessing this      member function since it will probably be made private in      later versions of KProcess.  */  pid_t pid;  /** The process' exit status as returned by "waitpid". You should not       modify the value of this data member from derived classes. You should      rather use "getStatus()" than accessing this data member directly      since it will probably be made private in further versions of      KProcess.  */  int status;  /*	Functions for setting up the sockets for communication.	setupCommunication 	-- is called from "start" before "fork"ing.	commSetupDoneP	-- completes communcation socket setup in the parent	commSetupDoneC	-- completes communication setup in the child process	commClose	-- frees all allocated communication ressources in the parent	after the process has exited  */  /**    This function is called from "KProcess::start" right before a "fork" takes     place. According to    the "comm" parameter this function has to initialize the "in", "out" and    "err" data member of KProcess.    This function should return 0 if setting the needed communication channels    was successful.     The default implementation is to create UNIX STREAM sockets for the communication,    but you could overload this function and establish a TCP/IP communication for    network communication, for example.   */        virtual int setupCommunication(Communication comm);  /**     Called right after a (successful) fork on the parent side. This function     will usually do some communications cleanup, like closing the reading end     of the "stdin" communication channel.     Furthermore, it must also create the QSocketNotifiers "innot", "outnot" and     "errnot" and connect their Qt slots to the respective KProcess member functions.     For a more detailed explanation, it is best to have a look at the default     implementation of "setupCommunication" in @ref kprocess.cpp.  */  virtual int commSetupDoneP();   /**     Called right after a (successful) fork, but before an "exec" on the child     process' side. It usually just closes the unused communication ends of     "in", "out" and "err" (like the writing end of the "in" communication     channel.  */  virtual int commSetupDoneC();  /**     Immediately called after a process has exited. This function normally calls commClose     to close all open communication channels to this process and emits the "processExited"     signal (if the process was not running in the "DontCare" mode).  */  virtual void processHasExited(int state);  /**     Should clean up the communication links to the child after it has exited. Should     be called from "processHasExited".  */  virtual void commClose();    int out[2], in[2], err[2];  /* the socket descriptors for stdin/stdout/stderr */  QSocketNotifier *innot, *outnot, *errnot;  /* The socket notifiers for the above socket descriptors */  /**     Lists the communication links that are activated for the child process.     Should not be modified from derived classes.  */  Communication communication;		  /**     Called by "slotChildOutput" this function copies data arriving from the     child process's stdout to the respective buffer and emits the signal     "receivedStderr"  */  int childOutput(int fdno);  /**     Called by "slotChildOutput" this function copies data arriving from the     child process's stdout to the respective buffer and emits the signal     "receivedStderr"  */  int childError(int fdno);     // information about the data that has to be sent to the child:  char *input_data;  // the buffer holding the data  int input_sent;    // # of bytes already transmitted  int input_total;   // total length of input_data  /**    @ref KProcessController is a friend fo KProcess because it has to have    access to various data members.  */  friend class KProcessController;private:  // Disallow assignment and copy-construction  KProcess( const KProcess& );  KProcess& operator= ( const KProcess& );};/**  @short A class derived from @ref KProcess to start child processes through a shell  @author Christian Czezakte e9025461@student.tuwien.ac.atThis class is similar to @ref KProcess. The only difference is that KShellProcess runs the specified executable through a UN*X shell so that standard shell mechanisms likewildcard matching, use of pipes and environment variable expansion will work.For example, you could run commands like the following through KShellProcess:<pre>  ls ~/HOME/ *.lyx | sort | uniq |wc -l </pre>KShellProcess tries really hard to find a valid executable shell. Here is the algorithm used for finding an executable shell:	   +) Try to use executable pointed to by the "SHELL" environment variable	   +) Try the executable pointed to by the "SHELL" environment variable withwhitespaces stripped off	   +) "/bin/sh" as a last ressort.*/class KShellProcess: public KProcess{  Q_OBJECTpublic:  /**      Constructor      By specifying the name of a shell (like "/bin/bash") you can override      the mechanism for finding a valid shell as described in the detailed      description of this class.  */  KShellProcess(const char *shellname=NULL);  ~KShellProcess();  /**     Starts up the process. -- For a detailed description    have a look at the "start" member function and the detailed    description of @ref KProcess .  */  virtual bool start(RunMode  runmode = NotifyOnExit, Communication comm = NoCommunication);private:  /** searches for a valid shell. See the general description of this class for      information on how the search is actually performed.  */  char *searchShell();  /** used by "searchShell" in order to find out whether the shell found is actually      executable at all.  */  bool isExecutable(const char *fname);  char *shell;  // Disallow assignment and copy-construction  KShellProcess( const KShellProcess& );  KShellProcess& operator= ( const KShellProcess& );};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -