summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-21 19:04:02 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:52 +0200
commit299d10549f5aff50cd6211eb3d3e58c17f13be81 (patch)
tree94b945347b16406b13f7730ae28e0e9b2522f583 /src/corelib
parent4212ee7ec7f9ac77a4acd0796e56dbdd1e2c7baa (diff)
move key/value converters to the private class
this will enable them to access other members later Reviewed-by: thiago Reviewed-by: dt (cherry picked from commit a2d70d71c8c7652ded41d5d603672c3927df44e6)
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qprocess.cpp29
-rw-r--r--src/corelib/io/qprocess_p.h10
2 files changed, 15 insertions, 24 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 20efeae029..ffd5ff0ff8 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -143,25 +143,6 @@ QT_BEGIN_NAMESPACE
\sa QProcess, QProcess::systemEnvironment(), QProcess::setProcessEnvironment()
*/
-#ifdef Q_OS_WIN
-static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name)
-{ return QProcessEnvironmentPrivate::Key(name); }
-static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name)
-{ return name; }
-static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value)
-{ return value; }
-static inline QString valueToString(const QProcessEnvironmentPrivate::Value &value)
-{ return value; }
-#else
-static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name)
-{ return name.toLocal8Bit(); }
-static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name)
-{ return QString::fromLocal8Bit(name); }
-static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value)
-{ return value.toLocal8Bit(); }
-static inline QString valueToString(const QProcessEnvironmentPrivate::Value &value)
-{ return QString::fromLocal8Bit(value); }
-#endif
template<> void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
{
@@ -321,7 +302,7 @@ void QProcessEnvironment::clear()
*/
bool QProcessEnvironment::contains(const QString &name) const
{
- return d ? d->hash.contains(prepareName(name)) : false;
+ return d ? d->hash.contains(d->prepareName(name)) : false;
}
/*!
@@ -343,7 +324,7 @@ bool QProcessEnvironment::contains(const QString &name) const
void QProcessEnvironment::insert(const QString &name, const QString &value)
{
// d detaches from null
- d->hash.insert(prepareName(name), prepareValue(value));
+ d->hash.insert(d->prepareName(name), d->prepareValue(value));
}
/*!
@@ -360,7 +341,7 @@ void QProcessEnvironment::insert(const QString &name, const QString &value)
void QProcessEnvironment::remove(const QString &name)
{
if (d)
- d->hash.remove(prepareName(name));
+ d->hash.remove(d->prepareName(name));
}
/*!
@@ -379,11 +360,11 @@ QString QProcessEnvironment::value(const QString &name, const QString &defaultVa
if (!d)
return defaultValue;
- QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(prepareName(name));
+ QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(d->prepareName(name));
if (it == d->hash.constEnd())
return defaultValue;
- return valueToString(it.value());
+ return d->valueToString(it.value());
}
/*!
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 2d4c55670d..14fc9f32ce 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -95,9 +95,19 @@ public:
};
typedef QString Value;
+
+ 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
typedef QByteArray Key;
typedef QByteArray Value;
+
+ inline Key prepareName(const QString &name) const { return name.toLocal8Bit(); }
+ inline QString nameToString(const Key &name) const { return QString::fromLocal8Bit(name); }
+ inline Value prepareValue(const QString &value) const { return value.toLocal8Bit(); }
+ inline QString valueToString(const Value &value) const { return QString::fromLocal8Bit(value); }
#endif
typedef QHash<Key, Value> Hash;