summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-21 17:04:02 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-29 10:59:53 (GMT)
commita2d70d71c8c7652ded41d5d603672c3927df44e6 (patch)
tree2867a1fb11d203b775496fe613a3a0847b1db4fe /src/corelib/io
parentf3db5603871928ebed43a085a496397e65952b39 (diff)
downloadQt-a2d70d71c8c7652ded41d5d603672c3927df44e6.zip
Qt-a2d70d71c8c7652ded41d5d603672c3927df44e6.tar.gz
Qt-a2d70d71c8c7652ded41d5d603672c3927df44e6.tar.bz2
move key/value converters to the private class
this will enable them to access other members later Reviewed-by: thiago Reviewed-by: dt
Diffstat (limited to 'src/corelib/io')
-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 20efeae..ffd5ff0 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 2d4c556..14fc9f3 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;