summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_p.h
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-05-02 11:06:27 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:53 +0200
commit95e57339a9c02943edbd0cc7d4470a2ed044a7c2 (patch)
tree6b38b176bbe29eb1c7cea3f4047ef19bf31e982b /src/corelib/io/qprocess_p.h
parent4d8cf471783a6e4c5e551c6ddf208acb03453e61 (diff)
fix build on symbian
Error: #793: explicit specialization of class "QTypeInfo<QProcessEnvironmentPrivate::Key>" must precede its first use just un-nest QProcessEnvironmentPrivate::{Key,Value} Reviewed-by: thiago (cherry picked from commit 167044693cc1d16684a5732b05e3926d0af61960)
Diffstat (limited to 'src/corelib/io/qprocess_p.h')
-rw-r--r--src/corelib/io/qprocess_p.h122
1 files changed, 60 insertions, 62 deletions
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 251f8bc772..f70579bd17 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -81,68 +81,76 @@ class QTimer;
class RProcess;
#endif
-class QProcessEnvironmentPrivate: public QSharedData
+#ifdef Q_OS_WIN
+class QProcEnvKey : public QString
{
public:
-#ifdef Q_OS_WIN
- class Key : public QString
+ QProcEnvKey() {}
+ explicit QProcEnvKey(const QString &other) : QString(other) {}
+ QProcEnvKey(const QProcEnvKey &other) : QString(other) {}
+ bool operator==(const QProcEnvKey &other) const { return !compare(other, Qt::CaseInsensitive); }
+};
+inline uint qHash(const QProcEnvKey &key) { return qHash(key.toCaseFolded()); }
+
+typedef QString QProcEnvValue;
+#else
+class QProcEnvKey
+{
+public:
+ QProcEnvKey() : hash(0) {}
+ explicit QProcEnvKey(const QByteArray &other) : key(other), hash(qHash(key)) {}
+ QProcEnvKey(const QProcEnvKey &other) { *this = other; }
+ bool operator==(const QProcEnvKey &other) const { return key == other.key; }
+
+ QByteArray key;
+ uint hash;
+};
+inline uint qHash(const QProcEnvKey &key) { return key.hash; }
+
+class QProcEnvValue
+{
+public:
+ QProcEnvValue() {}
+ QProcEnvValue(const QProcEnvValue &other) { *this = other; }
+ explicit QProcEnvValue(const QString &value) : stringValue(value) {}
+ explicit QProcEnvValue(const QByteArray &value) : byteValue(value) {}
+ bool operator==(const QProcEnvValue &other) const
{
- public:
- Key() {}
- explicit Key(const QString &other) : QString(other) {}
- Key(const Key &other) : QString(other) {}
- bool operator==(const Key &other) const { return !compare(other, Qt::CaseInsensitive); }
- };
+ return byteValue.isEmpty() && other.byteValue.isEmpty()
+ ? stringValue == other.stringValue
+ : bytes() == other.bytes();
+ }
+ QByteArray bytes() const
+ {
+ if (byteValue.isEmpty() && !stringValue.isEmpty())
+ byteValue = stringValue.toLocal8Bit();
+ return byteValue;
+ }
+ QString string() const
+ {
+ if (stringValue.isEmpty() && !byteValue.isEmpty())
+ stringValue = QString::fromLocal8Bit(byteValue);
+ return stringValue;
+ }
- typedef QString Value;
+ mutable QByteArray byteValue;
+ mutable QString stringValue;
+};
+Q_DECLARE_TYPEINFO(QProcEnvValue, Q_MOVABLE_TYPE);
+#endif
+Q_DECLARE_TYPEINFO(QProcEnvKey, Q_MOVABLE_TYPE);
+class QProcessEnvironmentPrivate: public QSharedData
+{
+public:
+ typedef QProcEnvKey Key;
+ typedef QProcEnvValue Value;
+#ifdef Q_OS_WIN
inline Key prepareName(const QString &name) const { return Key(name); }
inline QString nameToString(const Key &name) const { return name; }
inline Value prepareValue(const QString &value) const { return value; }
inline QString valueToString(const Value &value) const { return value; }
#else
- class Key
- {
- public:
- Key() : hash(0) {}
- explicit Key(const QByteArray &other) : key(other), hash(qHash(key)) {}
- Key(const Key &other) { *this = other; }
- bool operator==(const Key &other) const { return key == other.key; }
-
- QByteArray key;
- uint hash;
- };
-
- class Value
- {
- public:
- Value() {}
- Value(const Value &other) { *this = other; }
- explicit Value(const QString &value) : stringValue(value) {}
- explicit Value(const QByteArray &value) : byteValue(value) {}
- bool operator==(const Value &other) const
- {
- return byteValue.isEmpty() && other.byteValue.isEmpty()
- ? stringValue == other.stringValue
- : bytes() == other.bytes();
- }
- QByteArray bytes() const
- {
- if (byteValue.isEmpty() && !stringValue.isEmpty())
- byteValue = stringValue.toLocal8Bit();
- return byteValue;
- }
- QString string() const
- {
- if (stringValue.isEmpty() && !byteValue.isEmpty())
- stringValue = QString::fromLocal8Bit(byteValue);
- return stringValue;
- }
-
- mutable QByteArray byteValue;
- mutable QString stringValue;
- };
-
inline Key prepareName(const QString &name) const
{
Key &ent = nameMap[name];
@@ -173,16 +181,6 @@ public:
QStringList keys() const;
void insert(const QProcessEnvironmentPrivate &other);
};
-Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Key, Q_MOVABLE_TYPE);
-#ifdef Q_OS_UNIX
-Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Value, Q_MOVABLE_TYPE);
-#endif
-
-#ifdef Q_OS_WIN
-inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return qHash(key.toCaseFolded()); }
-#else
-inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return key.hash; }
-#endif
class QProcessPrivate : public QIODevicePrivate
{