summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-04-05 14:49:02 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-03 01:08:58 +0200
commitb97070f2c489877b650283842fbbdea708102a40 (patch)
treee681cf7fe36fbb3419c5d8e974a77422825a2118 /src/corelib/io
parent02aee5d174b0a1d0f925dc5c3243f77d0dc0c8c4 (diff)
QtCore: add member-swap to shared classes
Implemented as in other shared classes (e.g. QPen). Special case: QUrlQuery: document existing swap(). Change-Id: I4b36cc9577fbf2232d4b2a2d8822d26e41e22cad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdebug.cpp8
-rw-r--r--src/corelib/io/qdebug.h2
-rw-r--r--src/corelib/io/qdir.cpp8
-rw-r--r--src/corelib/io/qdir.h3
-rw-r--r--src/corelib/io/qfileinfo.cpp8
-rw-r--r--src/corelib/io/qfileinfo.h4
-rw-r--r--src/corelib/io/qprocess.cpp8
-rw-r--r--src/corelib/io/qprocess.h2
-rw-r--r--src/corelib/io/qurlquery.cpp7
9 files changed, 50 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 8c17a61b7e..5769323d57 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -125,6 +125,14 @@
*/
/*!
+ \fn QDebug::swap(QDebug &other)
+ \since 5.0
+
+ Swaps this debug stream instance with \a other. This function is
+ very fast and never fails.
+*/
+
+/*!
\fn QDebug &QDebug::space()
Writes a space character to the debug stream and returns a reference to
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 6b0eaef9e8..f0e59c8c65 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -91,6 +91,8 @@ public:
delete stream;
}
}
+ inline void swap(QDebug &other) { qSwap(stream, other.stream); }
+
inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; }
inline QDebug &nospace() { stream->space = false; return *this; }
inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; }
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 9a66ca2d40..b92f03a3c8 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1711,6 +1711,14 @@ QDir &QDir::operator=(const QString &path)
}
/*!
+ \fn void QDir::swap(QDir &other)
+ \since 5.0
+
+ Swaps this QDir instance with \a other. This function is very fast
+ and never fails.
+*/
+
+/*!
\fn bool QDir::operator!=(const QDir &dir) const
Returns true if directory \a dir and this directory have different
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index a5105fe2fb..a6f9b326ad 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -115,6 +115,9 @@ public:
{ qSwap(d_ptr, other.d_ptr); return *this; }
#endif
+ inline void swap(QDir &other)
+ { qSwap(d_ptr, other.d_ptr); }
+
void setPath(const QString &path);
QString path() const;
QString absolutePath() const;
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 4973ecb773..ac87e23301 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -430,6 +430,14 @@ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo)
}
/*!
+ \fn void QFileInfo::swap(QFileInfo &other)
+ \since 5.0
+
+ Swaps this file info with \a other. This function is very fast and
+ never fails.
+*/
+
+/*!
Sets the file that the QFileInfo provides information about to \a
file.
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index 0f43ebd439..41db9d711d 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -74,6 +74,10 @@ public:
inline QFileInfo&operator=(QFileInfo &&other)
{ qSwap(d_ptr, other.d_ptr); return *this; }
#endif
+
+ inline void swap(QFileInfo &other)
+ { qSwap(d_ptr, other.d_ptr); }
+
bool operator==(const QFileInfo &fileinfo) const;
inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); }
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 7228ceca78..04597f198f 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -237,6 +237,14 @@ QProcessEnvironment &QProcessEnvironment::operator=(const QProcessEnvironment &o
}
/*!
+ \fn void QProcessEnvironment::swap(QProcessEnvironment &other)
+ \since 5.0
+
+ Swaps this process environment instance with \a other. This
+ function is very fast and never fails.
+*/
+
+/*!
\fn bool QProcessEnvironment::operator !=(const QProcessEnvironment &other) const
Returns true if this and the \a other QProcessEnvironment objects are different.
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index fe5e84ccec..dbc226ef81 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -72,6 +72,8 @@ public:
~QProcessEnvironment();
QProcessEnvironment &operator=(const QProcessEnvironment &other);
+ inline void swap(QProcessEnvironment &other) { qSwap(d, other.d); }
+
bool operator==(const QProcessEnvironment &other) const;
inline bool operator!=(const QProcessEnvironment &other) const
{ return !(*this == other); }
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index f5ba15a6e8..24742e4390 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -359,6 +359,13 @@ QUrlQuery &QUrlQuery::operator =(const QUrlQuery &other)
}
/*!
+ \fn void QUrlQuery::swap(QUrlQuery &other)
+
+ Swaps this URL query instance with \a other. This function is very
+ fast and never fails.
+*/
+
+/*!
Destroys this QUrlQuery object.
*/
QUrlQuery::~QUrlQuery()