doc
This commit is contained in:
@@ -66,7 +66,7 @@
|
|||||||
//! a.out --debug -c --value 10
|
//! a.out --debug -c --value 10
|
||||||
//! \endcode
|
//! \endcode
|
||||||
//!
|
//!
|
||||||
//! /}
|
//! \}
|
||||||
|
|
||||||
|
|
||||||
PICLI::PICLI(int argc, char * argv[]) {
|
PICLI::PICLI(int argc, char * argv[]) {
|
||||||
|
|||||||
@@ -85,8 +85,8 @@
|
|||||||
//! \~english Class for emit notifications of PICout
|
//! \~english Class for emit notifications of PICout
|
||||||
//! \~russian Класс для посылки событий от PICout
|
//! \~russian Класс для посылки событий от PICout
|
||||||
//!
|
//!
|
||||||
//! \~english \section PICout_sec0 Synopsis
|
//! \~english \section PICoutNotifier_sec0 Synopsis
|
||||||
//! \~russian \section PICout_sec0 Краткий обзор
|
//! \~russian \section PICoutNotifier_sec0 Краткий обзор
|
||||||
//! \~english
|
//! \~english
|
||||||
//! This class used as PICout events emitter. When
|
//! This class used as PICout events emitter. When
|
||||||
//! PICout constructs with external PIString* buffer
|
//! PICout constructs with external PIString* buffer
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
//! \~russian Элемент PIPropertyStorage
|
//! \~russian Элемент PIPropertyStorage
|
||||||
//!
|
//!
|
||||||
//! \~\details
|
//! \~\details
|
||||||
//! \~english \section PIPropertyStorage_sec0 Synopsis
|
//! \~english \section PIPropertyStorage_sec1 Synopsis
|
||||||
//! \~russian \section PIPropertyStorage_sec0 Краткий обзор
|
//! \~russian \section PIPropertyStorage_sec1 Краткий обзор
|
||||||
//!
|
//!
|
||||||
//! \~english
|
//! \~english
|
||||||
//! Key-value storage, based on PIVector with PIPropertyStorage::Property elements. Each element in vector
|
//! Key-value storage, based on PIVector with PIPropertyStorage::Property elements. Each element in vector
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
//!
|
//!
|
||||||
//! \~\details
|
//! \~\details
|
||||||
//! \~english
|
//! \~english
|
||||||
|
//! This class able to start external executables, watch for them,
|
||||||
|
//! grab output and exit code.
|
||||||
//!
|
//!
|
||||||
//! \~russian
|
//! \~russian
|
||||||
//!
|
//!
|
||||||
@@ -47,6 +49,11 @@
|
|||||||
//! \~english \section PIProcess_sec0 Synopsis
|
//! \~english \section PIProcess_sec0 Synopsis
|
||||||
//! \~russian \section PIProcess_sec0 Краткий обзор
|
//! \~russian \section PIProcess_sec0 Краткий обзор
|
||||||
//! \~english
|
//! \~english
|
||||||
|
//! External executable can be started with control or fully independent
|
||||||
|
//! from application.\n
|
||||||
|
//! Start with control allow you to wait for finish, grab output
|
||||||
|
//! and terminate it at any time.\n
|
||||||
|
//! You can change working directory and environment of executable.\n
|
||||||
//!
|
//!
|
||||||
//! \~russian
|
//! \~russian
|
||||||
//!
|
//!
|
||||||
@@ -55,6 +62,7 @@
|
|||||||
//! \~russian \section PIProcess_sec1 Использование
|
//! \~russian \section PIProcess_sec1 Использование
|
||||||
//! \~english
|
//! \~english
|
||||||
//!
|
//!
|
||||||
|
//!
|
||||||
//! \~russian
|
//! \~russian
|
||||||
//!
|
//!
|
||||||
//! \}
|
//! \}
|
||||||
|
|||||||
@@ -36,34 +36,94 @@ class PIP_EXPORT PIProcess: public PIThread
|
|||||||
{
|
{
|
||||||
PIOBJECT_SUBCLASS(PIProcess, PIThread)
|
PIOBJECT_SUBCLASS(PIProcess, PIThread)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//! \~english Construct empty %PIProcess
|
||||||
|
//! \~russian Создает пустой %PIProcess
|
||||||
PIProcess();
|
PIProcess();
|
||||||
|
|
||||||
virtual ~PIProcess();
|
virtual ~PIProcess();
|
||||||
|
|
||||||
|
|
||||||
|
//! \~english Returns last attached execution exit code
|
||||||
|
//! \~russian
|
||||||
int exitCode() const {return exit_code;}
|
int exitCode() const {return exit_code;}
|
||||||
|
|
||||||
|
//! \~english Returns current attached execution process ID
|
||||||
|
//! \~russian
|
||||||
int pID() const;
|
int pID() const;
|
||||||
|
|
||||||
void setGrabInput(bool yes) {g_in = yes;}
|
void setGrabInput(bool yes) {g_in = yes;}
|
||||||
|
|
||||||
|
//! \~english Set attached execution grab output stream enabled
|
||||||
|
//! \~russian
|
||||||
void setGrabOutput(bool yes) {g_out = yes;}
|
void setGrabOutput(bool yes) {g_out = yes;}
|
||||||
|
|
||||||
|
//! \~english Set attached execution grab error stream enabled
|
||||||
|
//! \~russian
|
||||||
void setGrabError(bool yes) {g_err = yes;}
|
void setGrabError(bool yes) {g_err = yes;}
|
||||||
|
|
||||||
void setInputFile(const PIString & path) {f_in.setPath(path);}
|
void setInputFile(const PIString & path) {f_in.setPath(path);}
|
||||||
|
|
||||||
|
//! \~english Set attached execution grab output stream file
|
||||||
|
//! \~russian
|
||||||
void setOutputFile(const PIString & path) {f_out.setPath(path);}
|
void setOutputFile(const PIString & path) {f_out.setPath(path);}
|
||||||
|
|
||||||
|
//! \~english Set attached execution grab error stream file
|
||||||
|
//! \~russian
|
||||||
void setErrorFile(const PIString & path) {f_err.setPath(path);}
|
void setErrorFile(const PIString & path) {f_err.setPath(path);}
|
||||||
|
|
||||||
void unsetInputFile() {f_in.setPath("");}
|
void unsetInputFile() {f_in.setPath("");}
|
||||||
|
|
||||||
|
//! \~english Reset attached execution grab output stream file
|
||||||
|
//! \~russian
|
||||||
void unsetOutputFile() {f_out.setPath("");}
|
void unsetOutputFile() {f_out.setPath("");}
|
||||||
|
|
||||||
|
//! \~english Reset attached execution grab error stream file
|
||||||
|
//! \~russian
|
||||||
void unsetErrorFile() {f_err.setPath("");}
|
void unsetErrorFile() {f_err.setPath("");}
|
||||||
|
|
||||||
|
//! \~english Returns current attached execution working directory or empty string if it wasn`t set
|
||||||
|
//! \~russian
|
||||||
PIString workingDirectory() const {return wd;}
|
PIString workingDirectory() const {return wd;}
|
||||||
|
|
||||||
|
//! \~english Set attached execution working directory
|
||||||
|
//! \~russian
|
||||||
void setWorkingDirectory(const PIString & path) {wd = path;}
|
void setWorkingDirectory(const PIString & path) {wd = path;}
|
||||||
|
|
||||||
|
//! \~english Rseet attached execution working directory, application working dir will be used
|
||||||
|
//! \~russian
|
||||||
void resetWorkingDirectory() {wd.clear();}
|
void resetWorkingDirectory() {wd.clear();}
|
||||||
|
|
||||||
|
//! \~english Returns all attached execution output stream
|
||||||
|
//! \~russian
|
||||||
PIByteArray readOutput() {f_out.open(PIIODevice::ReadOnly); return f_out.readAll();}
|
PIByteArray readOutput() {f_out.open(PIIODevice::ReadOnly); return f_out.readAll();}
|
||||||
|
|
||||||
|
//! \~english Returns all attached execution error stream
|
||||||
|
//! \~russian
|
||||||
PIByteArray readError() {f_err.open(PIIODevice::ReadOnly); return f_err.readAll();}
|
PIByteArray readError() {f_err.open(PIIODevice::ReadOnly); return f_err.readAll();}
|
||||||
|
|
||||||
|
|
||||||
|
//! \~english Returns current attached execution environment
|
||||||
|
//! \~russian
|
||||||
PIStringList environment() {return env;}
|
PIStringList environment() {return env;}
|
||||||
|
|
||||||
|
//! \~english Clear current attached execution environment. Call before \a exec()
|
||||||
|
//! \~russian
|
||||||
void clearEnvironment() {env.clear();}
|
void clearEnvironment() {env.clear();}
|
||||||
|
|
||||||
|
//! \~english Remove variable "variable" from current attached execution environment. Call before \a exec()
|
||||||
|
//! \~russian
|
||||||
void removeEnvironmentVariable(const PIString & variable);
|
void removeEnvironmentVariable(const PIString & variable);
|
||||||
|
|
||||||
|
//! \~english Set variable "variable" to "value" in current attached execution environment. Call before \a exec()
|
||||||
|
//! \~russian
|
||||||
void setEnvironmentVariable(const PIString & variable, const PIString & value);
|
void setEnvironmentVariable(const PIString & variable, const PIString & value);
|
||||||
|
|
||||||
EVENT_HANDLER1(void, exec, const PIString & , program) {args.clear(); args << program; exec_();}
|
//! \~english Start attached execution "program" with one argument "arg"
|
||||||
|
//! \~russian
|
||||||
void exec(const PIString & program, const PIString & arg) {args.clear(); args << program << arg; exec_();}
|
void exec(const PIString & program, const PIString & arg) {args.clear(); args << program << arg; exec_();}
|
||||||
|
|
||||||
|
EVENT_HANDLER1(void, exec, const PIString & , program) {args.clear(); args << program; exec_();}
|
||||||
EVENT_HANDLER2(void, exec, const PIString & , program, const PIStringList & , args_) {args.clear(); args << program << args_; exec_();}
|
EVENT_HANDLER2(void, exec, const PIString & , program, const PIStringList & , args_) {args.clear(); args << program << args_; exec_();}
|
||||||
EVENT_HANDLER(void, terminate);
|
EVENT_HANDLER(void, terminate);
|
||||||
EVENT_HANDLER(bool, waitForFinish) {return waitForFinish(60000);}
|
EVENT_HANDLER(bool, waitForFinish) {return waitForFinish(60000);}
|
||||||
@@ -72,14 +132,69 @@ public:
|
|||||||
EVENT1(execStarted, PIString, program)
|
EVENT1(execStarted, PIString, program)
|
||||||
EVENT2(execFinished, PIString, program, int, exit_code)
|
EVENT2(execFinished, PIString, program, int, exit_code)
|
||||||
|
|
||||||
static void execIndependent(const PIString & program) {execIndependent(program, PIStringList());}
|
|
||||||
static void execIndependent(const PIString & program, const PIString & arg) {execIndependent(program, PIStringList() << arg);}
|
|
||||||
static void execIndependent(const PIString & program, const PIStringList & args_);
|
|
||||||
|
|
||||||
|
//! \~english Start detached execution "program" without arguments
|
||||||
|
//! \~russian
|
||||||
|
static void execIndependent(const PIString & program) {execIndependent(program, PIStringList());}
|
||||||
|
|
||||||
|
//! \~english Start detached execution "program" with one argument "arg"
|
||||||
|
//! \~russian
|
||||||
|
static void execIndependent(const PIString & program, const PIString & arg) {execIndependent(program, PIStringList() << arg);}
|
||||||
|
|
||||||
|
//! \~english Start detached execution "program" with arguments "args"
|
||||||
|
//! \~russian
|
||||||
|
static void execIndependent(const PIString & program, const PIStringList & args);
|
||||||
|
|
||||||
|
|
||||||
|
//! \~english Returns application environment
|
||||||
|
//! \~russian
|
||||||
static PIStringList currentEnvironment();
|
static PIStringList currentEnvironment();
|
||||||
|
|
||||||
|
//! \~english Returns application process ID
|
||||||
|
//! \~russian
|
||||||
static int currentPID();
|
static int currentPID();
|
||||||
|
|
||||||
|
//! \~english Returns variable "variable" value from application environment
|
||||||
|
//! \~russian
|
||||||
static PIString getEnvironmentVariable(const PIString & variable);
|
static PIString getEnvironmentVariable(const PIString & variable);
|
||||||
|
|
||||||
|
//! \handlers
|
||||||
|
//! \{
|
||||||
|
|
||||||
|
//! \fn void exec(const PIString & program)
|
||||||
|
//! \~english Start attached execution "program" without arguments
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \fn void exec(const PIString & program, const PIStringList & args)
|
||||||
|
//! \~english Start attached execution "program" with arguments "args"
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \fn void terminate()
|
||||||
|
//! \~english Immediately terminate attached execution
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \fn bool waitForFinish()
|
||||||
|
//! \~english Wait for attached execution finish maximum for 60 seconds
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \fn bool waitForFinish(int timeout_msecs)
|
||||||
|
//! \~english Wait for attached execution finish maximum for "timeout_msecs" milliseconds
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \}
|
||||||
|
//! \events
|
||||||
|
//! \{
|
||||||
|
|
||||||
|
//! \fn void execStarted(PIString program)
|
||||||
|
//! \~english Raise on attached execution start
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \fn void execFinished(PIString program)
|
||||||
|
//! \~english Raise on attached execution finish
|
||||||
|
//! \~russian
|
||||||
|
|
||||||
|
//! \}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void run();
|
virtual void run();
|
||||||
void exec_();
|
void exec_();
|
||||||
|
|||||||
Reference in New Issue
Block a user