Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 AQSProcess_p.h 00003 ------------------- 00004 begin : 20/11/2011 00005 copyright : (C) 2003-2011 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef AQSPROCESS_P_H_ 00020 #define AQSPROCESS_P_H_ 00021 00022 #include "AQSObject_p.h" 00023 #include "AQSDir_p.h" 00024 #include <qprocess.h> 00025 00026 class AQSProcess : public AQSObject 00027 { 00028 Q_OBJECT 00029 00030 AQ_DECLARE_AQS_OBJECT(Process, Object); 00031 00032 //@AQ_BEGIN_DEF_PUB_SLOTS@ 00033 public slots: 00034 QStringList arguments() const; 00035 void clearArguments(); 00036 virtual void setArguments(const QStringList &); 00037 virtual void addArgument(const QString &); 00038 QDir *workingDirectory() const; 00039 virtual void setWorkingDirectory(QDir *); 00040 virtual void setWorkingDirectory(AQSDir *); 00041 void setCommunication(int); 00042 uint communication() const; 00043 virtual bool start(QStringList* = 0); 00044 virtual bool launch(const QString &, QStringList* = 0); 00045 virtual bool launch(const QByteArray &, QStringList* = 0); 00046 bool isRunning() const; 00047 bool normalExit() const; 00048 int exitStatus() const; 00049 virtual QByteArray readStdout(); 00050 virtual QByteArray readStderr(); 00051 bool canReadLineStdout() const; 00052 bool canReadLineStderr() const; 00053 virtual QString readLineStdout(); 00054 virtual QString readLineStderr(); 00055 00056 protected: 00057 static void *construct(const QSArgumentList &args) { 00058 QMap<int, QStringList> candidates; 00059 candidates[0].append(QString::null); 00060 candidates[1].append(QString::fromLatin1("QObject*")); 00061 candidates[2].append(QString::fromLatin1("QObject*,QString")); 00062 candidates[1].append(QString::fromLatin1("QString")); 00063 candidates[2].append(QString::fromLatin1("QString,QObject*")); 00064 candidates[3].append(QString::fromLatin1("QString,QObject*,QString")); 00065 candidates[1].append(QString::fromLatin1("QStringList")); 00066 candidates[2].append(QString::fromLatin1("QStringList,QObject*")); 00067 candidates[3].append(QString::fromLatin1("QStringList,QObject*,QString")); 00068 QString sgt(castArgsSignature(args, candidates)); 00069 if (sgt.isEmpty()) 00070 return new QProcess; 00071 if (sgt == QString::fromLatin1("QObject*")) 00072 return new QProcess(argValue<QObject *>(args[0])); 00073 if (sgt == QString::fromLatin1("QObject*,QString")) 00074 return new QProcess(argValue<QObject *>(args[0]), 00075 *(argValue<QString *>(args[1]))); 00076 if (sgt == QString::fromLatin1("QString")) 00077 return new QProcess(*(argValue<QString *>(args[0]))); 00078 if (sgt == QString::fromLatin1("QString,QObject*")) 00079 return new QProcess(*(argValue<QString *>(args[0])), 00080 argValue<QObject *>(args[1])); 00081 if (sgt == QString::fromLatin1("QString,QObject*,QString")) 00082 return new QProcess(*(argValue<QString *>(args[0])), 00083 argValue<QObject *>(args[1]), 00084 *(argValue<QString *>(args[2]))); 00085 if (sgt == QString::fromLatin1("QStringList")) 00086 return new QProcess(*(argValue<QStringList *>(args[0]))); 00087 if (sgt == QString::fromLatin1("QStringList,QObject*")) 00088 return new QProcess(*(argValue<QStringList *>(args[0])), 00089 argValue<QObject *>(args[1])); 00090 if (sgt == QString::fromLatin1("QStringList,QObject*,QString")) 00091 return new QProcess(*(argValue<QStringList *>(args[0])), 00092 argValue<QObject *>(args[1]), 00093 *(argValue<QString *>(args[2]))); 00094 return 0; 00095 } 00096 00097 public: 00098 static QMap<int, QStringList> candidateConstructors() { 00099 QMap<int, QStringList> candidates; 00100 candidates[0].append(QString::null); 00101 candidates[1].append(QString::fromLatin1("QObject*")); 00102 candidates[2].append(QString::fromLatin1("QObject*,QString")); 00103 candidates[1].append(QString::fromLatin1("QString")); 00104 candidates[2].append(QString::fromLatin1("QString,QObject*")); 00105 candidates[3].append(QString::fromLatin1("QString,QObject*,QString")); 00106 candidates[1].append(QString::fromLatin1("QStringList")); 00107 candidates[2].append(QString::fromLatin1("QStringList,QObject*")); 00108 candidates[3].append(QString::fromLatin1("QStringList,QObject*,QString")); 00109 return candidates; 00110 } 00111 //@AQ_END_DEF_PUB_SLOTS@ 00112 }; 00113 00114 //@AQ_BEGIN_IMP_PUB_SLOTS@ 00115 inline QStringList AQSProcess::arguments() const 00116 { 00117 AQ_CALL_RET_V(arguments(), QStringList); 00118 } 00119 inline void AQSProcess::clearArguments() 00120 { 00121 AQ_CALL_VOID(clearArguments()); 00122 } 00123 inline void AQSProcess::setArguments(const QStringList &arg0) 00124 { 00125 AQ_CALL_VOID(setArguments(arg0)); 00126 } 00127 inline void AQSProcess::addArgument(const QString &arg0) 00128 { 00129 AQ_CALL_VOID(addArgument(arg0)); 00130 } 00131 inline QDir *AQSProcess::workingDirectory() const 00132 { 00133 AQ_CALL_RET_PTR(workingDirectory(), QDir); 00134 } 00135 inline void AQSProcess::setWorkingDirectory(QDir *arg0) 00136 { 00137 AQ_CALL_VOID(setWorkingDirectory(*arg0)); 00138 } 00139 inline void AQSProcess::setWorkingDirectory(AQSDir *arg0) 00140 { 00141 AQ_CALL_VOID(setWorkingDirectory(*arg0)); 00142 } 00143 inline void AQSProcess::setCommunication(int arg0) 00144 { 00145 AQ_CALL_VOID(setCommunication(arg0)); 00146 } 00147 inline uint AQSProcess::communication() const 00148 { 00149 AQ_CALL_RET_V(communication(), uint); 00150 } 00151 inline bool AQSProcess::start(QStringList *arg0) 00152 { 00153 AQ_CALL_RET_V(start(arg0), bool); 00154 } 00155 inline bool AQSProcess::launch(const QString &arg0, QStringList *arg1) 00156 { 00157 AQ_CALL_RET_V(launch(arg0, arg1), bool); 00158 } 00159 inline bool AQSProcess::launch(const QByteArray &arg0, QStringList *arg1) 00160 { 00161 AQ_CALL_RET_V(launch(arg0, arg1), bool); 00162 } 00163 inline bool AQSProcess::isRunning() const 00164 { 00165 AQ_CALL_RET_V(isRunning(), bool); 00166 } 00167 inline bool AQSProcess::normalExit() const 00168 { 00169 AQ_CALL_RET_V(normalExit(), bool); 00170 } 00171 inline int AQSProcess::exitStatus() const 00172 { 00173 AQ_CALL_RET_V(exitStatus(), int); 00174 } 00175 inline QByteArray AQSProcess::readStdout() 00176 { 00177 AQ_CALL_RET_V(readStdout(), QByteArray); 00178 } 00179 inline QByteArray AQSProcess::readStderr() 00180 { 00181 AQ_CALL_RET_V(readStderr(), QByteArray); 00182 } 00183 inline bool AQSProcess::canReadLineStdout() const 00184 { 00185 AQ_CALL_RET_V(canReadLineStdout(), bool); 00186 } 00187 inline bool AQSProcess::canReadLineStderr() const 00188 { 00189 AQ_CALL_RET_V(canReadLineStderr(), bool); 00190 } 00191 inline QString AQSProcess::readLineStdout() 00192 { 00193 AQ_CALL_RET_V(readLineStdout(), QString); 00194 } 00195 inline QString AQSProcess::readLineStderr() 00196 { 00197 AQ_CALL_RET_V(readLineStderr(), QString); 00198 } 00199 //@AQ_END_IMP_PUB_SLOTS@ 00200 00201 #endif /* AQSPROCESS_P_H_ */ 00202 // @AQSOBJECT@