summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2008-11-25 16:44:11 +0100
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-21 15:03:05 +0200
commit02ef8fab7e511f50e901676eac15229eb456b01c (patch)
tree107d58effefa02942f3a715b8b60894852aee83d /src/corelib/io/qprocess_p.h
parentf13908359f08d856c2825988e65651dbf744c0e4 (diff)
Add a new class for handling a process's environment variables.
First of all, make it a lot easier to access individual variables by having them in an associative container (a QHash). This fixes task 232427, albeit one release later than I had originally planned. On Windows, the variable names in the environment are case-insensitive, so a direct QHash isn't a good solution. Implement code that does the uppercasing on Windows and leaves untransformed on other platforms. Since we're doing this anyways, use QByteArray on Unix systems, since, in theory, the environment could contain any random binary data, which is not representable in QString. Task-number: 232427
Diffstat (limited to 'src/corelib/io/qprocess_p.h')
-rw-r--r--src/corelib/io/qprocess_p.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 5482871c2b..3b04d88dff 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -55,6 +55,7 @@
#include "QtCore/qprocess.h"
#include "QtCore/qstringlist.h"
+#include "QtCore/qhash.h"
#include "private/qringbuffer_p.h"
#include "private/qiodevice_p.h"
@@ -76,6 +77,20 @@ class QWindowsPipeWriter;
class QWinEventNotifier;
class QTimer;
+class QProcessEnvironmentPrivate: public QSharedData
+{
+public:
+#ifdef Q_OS_WIN
+ typedef QString Unit;
+#else
+ typedef QByteArray Unit;
+#endif
+ QHash<Unit, Unit> hash;
+
+ static QProcessEnvironment fromList(const QStringList &list);
+ QStringList toList() const;
+};
+
class QProcessPrivate : public QIODevicePrivate
{
public:
@@ -161,7 +176,7 @@ public:
QString program;
QStringList arguments;
- QHash<QString, QString> *environment;
+ QProcessEnvironment environment;
QRingBuffer outputReadBuffer;
QRingBuffer errorReadBuffer;