Qt 4.8
Macros | Functions
qprocess.cpp File Reference
#include "qprocess.h"
#include "qprocess_p.h"
#include <qbytearray.h>
#include <qelapsedtimer.h>
#include <qcoreapplication.h>
#include <qsocketnotifier.h>
#include <qtimer.h>
#include <private/qwineventnotifier_p.h>
#include <crt_externs.h>
#include "moc_qprocess.cpp"

Go to the source code of this file.

Macros

#define environ   (*_NSGetEnviron())
 

Functions

static QStringList parseCombinedArgString (const QString &program)
 

Macro Definition Documentation

◆ environ

#define environ   (*_NSGetEnviron())

Definition at line 2392 of file qprocess.cpp.

Function Documentation

◆ parseCombinedArgString()

static QStringList parseCombinedArgString ( const QString program)
static

Definition at line 2100 of file qprocess.cpp.

Referenced by QProcess::start(), and QProcess::startDetached().

2101 {
2102  QStringList args;
2103  QString tmp;
2104  int quoteCount = 0;
2105  bool inQuote = false;
2106 
2107  // handle quoting. tokens can be surrounded by double quotes
2108  // "hello world". three consecutive double quotes represent
2109  // the quote character itself.
2110  for (int i = 0; i < program.size(); ++i) {
2111  if (program.at(i) == QLatin1Char('"')) {
2112  ++quoteCount;
2113  if (quoteCount == 3) {
2114  // third consecutive quote
2115  quoteCount = 0;
2116  tmp += program.at(i);
2117  }
2118  continue;
2119  }
2120  if (quoteCount) {
2121  if (quoteCount == 1)
2122  inQuote = !inQuote;
2123  quoteCount = 0;
2124  }
2125  if (!inQuote && program.at(i).isSpace()) {
2126  if (!tmp.isEmpty()) {
2127  args += tmp;
2128  tmp.clear();
2129  }
2130  } else {
2131  tmp += program.at(i);
2132  }
2133  }
2134  if (!tmp.isEmpty())
2135  args += tmp;
2136 
2137  return args;
2138 }
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
Definition: qchar.cpp:609
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55