summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2011-06-07 18:48:58 +1000
committerabcd <qt-info@nokia.com>2011-06-07 18:48:58 +1000
commitf55b614ed12ddd4ac35b1e45729989f9dcff4aa8 (patch)
treef0ee115325052979de549bdbfeac4bfc6437f91d /src
parentecd593f856859d750f0a0e4085d48238bad5a6d7 (diff)
downloadqtlocation-f55b614ed12ddd4ac35b1e45729989f9dcff4aa8.tar.gz
Refactor private classes to mirror inheritance of public classes
Essentially this is to have something like the bridge design pattern.
Diffstat (limited to 'src')
-rw-r--r--src/location/places/places.pri3
-rw-r--r--src/location/places/qplacedetailsreply.cpp8
-rw-r--r--src/location/places/qplacedetailsreply.h3
-rw-r--r--src/location/places/qplacemediareply.cpp13
-rw-r--r--src/location/places/qplacemediareply.h5
-rw-r--r--src/location/places/qplacereply.cpp31
-rw-r--r--src/location/places/qplacereply.h6
-rw-r--r--src/location/places/qplacereviewreply.cpp13
-rw-r--r--src/location/places/qplacereviewreply.h6
-rw-r--r--src/location/places/qplacesearchreply.cpp11
-rw-r--r--src/location/places/qplacesearchreply.h3
-rw-r--r--src/location/places/qplacetextpredictionreply.cpp11
-rw-r--r--src/location/places/qplacetextpredictionreply.h3
13 files changed, 61 insertions, 55 deletions
diff --git a/src/location/places/places.pri b/src/location/places/places.pri
index d017dc54..f3ef3212 100644
--- a/src/location/places/places.pri
+++ b/src/location/places/places.pri
@@ -56,7 +56,8 @@ PRIVATE_HEADERS += \
places/qplacereview_p.h \
places/qplacesupplier_p.h \
places/qplaceweekdayhours_p.h \
- places/qplacesearchresult_p.h
+ places/qplacesearchresult_p.h \
+ places/qplacereply_p.h
SOURCES += \
#data classes
diff --git a/src/location/places/qplacedetailsreply.cpp b/src/location/places/qplacedetailsreply.cpp
index 36510b10..f353b7fa 100644
--- a/src/location/places/qplacedetailsreply.cpp
+++ b/src/location/places/qplacedetailsreply.cpp
@@ -1,7 +1,8 @@
#include "qplacedetailsreply.h"
+#include "qplacereply_p.h"
QTM_BEGIN_NAMESPACE
-class QPlaceDetailsReplyPrivate
+class QPlaceDetailsReplyPrivate : public QPlaceReplyPrivate
{
public:
QPlaceDetailsReplyPrivate() {}
@@ -28,7 +29,7 @@ QTM_USE_NAMESPACE
Constructs a search reply with a given \a parent.
*/
QPlaceDetailsReply::QPlaceDetailsReply(QObject *parent)
- : QPlaceReply(parent)
+ : QPlaceReply(new QPlaceDetailsReplyPrivate, parent)
{
}
@@ -37,7 +38,6 @@ QPlaceDetailsReply::QPlaceDetailsReply(QObject *parent)
*/
QPlaceDetailsReply::~QPlaceDetailsReply()
{
- delete d;
}
/*!
@@ -53,6 +53,7 @@ QPlaceReply::Type QPlaceDetailsReply::type() const
*/
QPlace QPlaceDetailsReply::result() const
{
+ Q_D(const QPlaceDetailsReply);
return d->result;
}
@@ -61,5 +62,6 @@ QPlace QPlaceDetailsReply::result() const
*/
void QPlaceDetailsReply::setResult(const QPlace &result)
{
+ Q_D(QPlaceDetailsReply);
d->result = result;
}
diff --git a/src/location/places/qplacedetailsreply.h b/src/location/places/qplacedetailsreply.h
index 4153de62..55526f0e 100644
--- a/src/location/places/qplacedetailsreply.h
+++ b/src/location/places/qplacedetailsreply.h
@@ -21,7 +21,8 @@ public:
protected:
void setResult(const QPlace &result);
private:
- QPlaceDetailsReplyPrivate *d;
+ Q_DISABLE_COPY(QPlaceDetailsReply)
+ Q_DECLARE_PRIVATE(QPlaceDetailsReply)
};
QTM_END_NAMESPACE
diff --git a/src/location/places/qplacemediareply.cpp b/src/location/places/qplacemediareply.cpp
index 935c6111..b1b2e729 100644
--- a/src/location/places/qplacemediareply.cpp
+++ b/src/location/places/qplacemediareply.cpp
@@ -1,9 +1,10 @@
#include "qplacemediareply.h"
+#include "qplacereply_p.h"
#include "qplace.h"
QTM_BEGIN_NAMESPACE
-class QPlaceMediaReplyPrivate
+class QPlaceMediaReplyPrivate : public QPlaceReplyPrivate
{
public:
QPlaceMediaReplyPrivate() {}
@@ -30,9 +31,8 @@ QTM_USE_NAMESPACE
Constructs a media reply with a given \a parent.
*/
QPlaceMediaReply::QPlaceMediaReply(QObject *parent)
- : QPlaceReply(parent)
+ : QPlaceReply(new QPlaceMediaReplyPrivate, parent)
{
- d = new QPlaceMediaReplyPrivate;
}
/*!
@@ -40,7 +40,6 @@ QPlaceMediaReply::QPlaceMediaReply(QObject *parent)
*/
QPlaceMediaReply::~QPlaceMediaReply()
{
- delete d;
}
/*!
@@ -48,6 +47,7 @@ QPlaceMediaReply::~QPlaceMediaReply()
*/
QList<QPlaceMediaObject> QPlaceMediaReply::mediaObjects() const
{
+ Q_D(const QPlaceMediaReply);
return d->mediaObjects;
}
@@ -64,6 +64,7 @@ QPlaceReply::Type QPlaceMediaReply::type() const
*/
void QPlaceMediaReply::setMediaObjects(const QList<QPlaceMediaObject> &objects)
{
+ Q_D(QPlaceMediaReply);
d->mediaObjects = objects;
}
@@ -71,8 +72,9 @@ void QPlaceMediaReply::setMediaObjects(const QList<QPlaceMediaObject> &objects)
Returns the total number of media objects for a place. If the total number of
media objects cannot be counted a value of -1 is returned.
*/
-int QPlaceMediaReply::totalCount()
+int QPlaceMediaReply::totalCount() const
{
+ Q_D(const QPlaceMediaReply);
return d->totalCount;
}
@@ -81,5 +83,6 @@ int QPlaceMediaReply::totalCount()
*/
void QPlaceMediaReply::setTotalCount(int total)
{
+ Q_D(QPlaceMediaReply);
d->totalCount = total;
}
diff --git a/src/location/places/qplacemediareply.h b/src/location/places/qplacemediareply.h
index ecb8a8db..a882362a 100644
--- a/src/location/places/qplacemediareply.h
+++ b/src/location/places/qplacemediareply.h
@@ -20,14 +20,15 @@ public:
QList<QPlaceMediaObject> mediaObjects() const;
- int totalCount();
+ int totalCount() const;
protected:
void setMediaObjects(const QList<QPlaceMediaObject> &objects);
void setTotalCount(int total);
private:
- QPlaceMediaReplyPrivate *d;
+ Q_DISABLE_COPY(QPlaceMediaReply)
+ Q_DECLARE_PRIVATE(QPlaceMediaReply)
};
QTM_END_NAMESPACE
diff --git a/src/location/places/qplacereply.cpp b/src/location/places/qplacereply.cpp
index b1c4b284..f623bd23 100644
--- a/src/location/places/qplacereply.cpp
+++ b/src/location/places/qplacereply.cpp
@@ -1,23 +1,11 @@
#include "qplacereply.h"
+#include "qplacereply_p.h"
#include "qplace.h"
#include "qplacesearchresult.h"
QTM_USE_NAMESPACE
-class QPlaceReplyPrivate
-{
-public:
- QPlaceReplyPrivate() : isFinished(false) {}
- QPlaceReply::Error error;
- QString errorString;
- bool isFinished;
-};
-
-QTM_END_NAMESPACE
-
-QTM_USE_NAMESPACE
-
/*!
\class QPlaceReply
@@ -76,8 +64,8 @@ QTM_USE_NAMESPACE
/*!
Constructs a reply object with a given \a parent.
*/
-QPlaceReply::QPlaceReply(QObject *parent)
- : QObject(parent)
+QPlaceReply::QPlaceReply(QPlaceReplyPrivate *dd, QObject *parent)
+ : QObject(parent),d_ptr(dd)
{
}
@@ -89,6 +77,7 @@ QPlaceReply::~QPlaceReply()
if (!isFinished()) {
abort();
}
+ delete d_ptr;
}
/*!
@@ -96,7 +85,7 @@ QPlaceReply::~QPlaceReply()
*/
bool QPlaceReply::isFinished() const
{
- return d->isFinished;
+ return d_ptr->isFinished;
}
/*!
@@ -114,7 +103,7 @@ QPlaceReply::Type QPlaceReply::type() const
*/
void QPlaceReply::setFinished(bool finished)
{
- d->isFinished = finished;
+ d_ptr->isFinished = finished;
}
/*!
@@ -124,8 +113,8 @@ void QPlaceReply::setFinished(bool finished)
*/
void QPlaceReply::setError(QPlaceReply::Error error, const QString &errorString)
{
- d->error = error;
- d->errorString = errorString;
+ d_ptr->error = error;
+ d_ptr->errorString = errorString;
}
/*!
@@ -133,7 +122,7 @@ void QPlaceReply::setError(QPlaceReply::Error error, const QString &errorString)
*/
QString QPlaceReply::errorString() const
{
- return d->errorString;
+ return d_ptr->errorString;
}
/*!
@@ -141,7 +130,7 @@ QString QPlaceReply::errorString() const
*/
QPlaceReply::Error QPlaceReply::error() const
{
- return d->error;
+ return d_ptr->error;
}
/*!
diff --git a/src/location/places/qplacereply.h b/src/location/places/qplacereply.h
index beec52b4..6cacd6be 100644
--- a/src/location/places/qplacereply.h
+++ b/src/location/places/qplacereply.h
@@ -50,12 +50,12 @@ Q_SIGNALS:
void error(QPlaceReply::Error error, const QString &errorString = QString());
protected:
- QPlaceReply(QObject *parent = 0);
+ QPlaceReply(QPlaceReplyPrivate *, QObject *parent = 0);
void setFinished(bool finished);
void setError(QPlaceReply::Error error, const QString &errorString);
-
+ QPlaceReplyPrivate *d_ptr;
private:
- QPlaceReplyPrivate *d;
+ Q_DISABLE_COPY(QPlaceReply)
};
QTM_END_NAMESPACE
diff --git a/src/location/places/qplacereviewreply.cpp b/src/location/places/qplacereviewreply.cpp
index 7a83a1b0..e78c3791 100644
--- a/src/location/places/qplacereviewreply.cpp
+++ b/src/location/places/qplacereviewreply.cpp
@@ -1,9 +1,10 @@
#include "qplacereviewreply.h"
+#include "qplacereply_p.h"
#include "qplace.h"
QTM_BEGIN_NAMESPACE
-class QPlaceReviewReplyPrivate
+class QPlaceReviewReplyPrivate : public QPlaceReplyPrivate
{
public:
QPlaceReviewReplyPrivate() {}
@@ -30,9 +31,8 @@ QTM_USE_NAMESPACE
Constructs a review reply with a given \a parent.
*/
QPlaceReviewReply::QPlaceReviewReply(QObject *parent)
- : QPlaceReply(parent)
+ : QPlaceReply(new QPlaceReviewReplyPrivate, parent)
{
- d = new QPlaceReviewReplyPrivate;
}
/*!
@@ -40,7 +40,6 @@ QPlaceReviewReply::QPlaceReviewReply(QObject *parent)
*/
QPlaceReviewReply::~QPlaceReviewReply()
{
- delete d;
}
/*!
@@ -56,6 +55,7 @@ QPlaceReply::Type QPlaceReviewReply::type() const
*/
QList<QPlaceReview> QPlaceReviewReply::reviews() const
{
+ Q_D(const QPlaceReviewReply);
return d->reviews;
}
@@ -64,6 +64,7 @@ QList<QPlaceReview> QPlaceReviewReply::reviews() const
*/
void QPlaceReviewReply::setReviews(const QList<QPlaceReview> &reviews)
{
+ Q_D(QPlaceReviewReply);
d->reviews = reviews;
}
@@ -71,8 +72,9 @@ void QPlaceReviewReply::setReviews(const QList<QPlaceReview> &reviews)
Returns the total number of reviews for a place. If the total number of
reviews cannot be counted a value of -1 is returned.
*/
-int QPlaceReviewReply::totalCount()
+int QPlaceReviewReply::totalCount() const
{
+ Q_D(const QPlaceReviewReply);
return d->totalCount;
}
@@ -81,5 +83,6 @@ int QPlaceReviewReply::totalCount()
*/
void QPlaceReviewReply::setTotalCount(int total)
{
+ Q_D(QPlaceReviewReply);
d->totalCount = total;
}
diff --git a/src/location/places/qplacereviewreply.h b/src/location/places/qplacereviewreply.h
index ce3c1204..eed226d1 100644
--- a/src/location/places/qplacereviewreply.h
+++ b/src/location/places/qplacereviewreply.h
@@ -20,14 +20,14 @@ public:
QList<QPlaceReview> reviews() const;
- int totalCount();
+ int totalCount() const;
protected:
void setReviews(const QList<QPlaceReview> &objects);
void setTotalCount(int total);
-
private:
- QPlaceReviewReplyPrivate *d;
+ Q_DISABLE_COPY(QPlaceReviewReply)
+ Q_DECLARE_PRIVATE(QPlaceReviewReply)
};
QTM_BEGIN_NAMESPACE
diff --git a/src/location/places/qplacesearchreply.cpp b/src/location/places/qplacesearchreply.cpp
index 2908986d..499709fe 100644
--- a/src/location/places/qplacesearchreply.cpp
+++ b/src/location/places/qplacesearchreply.cpp
@@ -1,10 +1,12 @@
#include "qplacesearchreply.h"
+#include "qplacereply_p.h"
+
QTM_BEGIN_NAMESPACE
-class QPlaceSearchReplyPrivate
+class QPlaceSearchReplyPrivate : public QPlaceReplyPrivate
{
public:
- QPlaceSearchReplyPrivate();
+ QPlaceSearchReplyPrivate(){}
QList<QPlaceSearchResult> results;
};
@@ -27,7 +29,7 @@ QTM_USE_NAMESPACE
Constructs a search reply with a given \a parent.
*/
QPlaceSearchReply::QPlaceSearchReply(QObject *parent)
- : QPlaceReply(parent)
+ : QPlaceReply(new QPlaceSearchReplyPrivate, parent)
{
}
@@ -36,7 +38,6 @@ QPlaceSearchReply::QPlaceSearchReply(QObject *parent)
*/
QPlaceSearchReply::~QPlaceSearchReply()
{
- delete d;
}
/*!
@@ -52,6 +53,7 @@ QPlaceReply::Type QPlaceSearchReply::type() const
*/
QList<QPlaceSearchResult> QPlaceSearchReply::results() const
{
+ Q_D(const QPlaceSearchReply);
return d->results;
}
@@ -60,5 +62,6 @@ QList<QPlaceSearchResult> QPlaceSearchReply::results() const
*/
void QPlaceSearchReply::setResults(const QList<QPlaceSearchResult> &results)
{
+ Q_D(QPlaceSearchReply);
d->results = results;
}
diff --git a/src/location/places/qplacesearchreply.h b/src/location/places/qplacesearchreply.h
index 9d0ac343..5b1d9987 100644
--- a/src/location/places/qplacesearchreply.h
+++ b/src/location/places/qplacesearchreply.h
@@ -21,7 +21,8 @@ public:
protected:
void setResults(const QList<QPlaceSearchResult> &results);
private:
- QPlaceSearchReplyPrivate *d;
+ Q_DISABLE_COPY(QPlaceSearchReply)
+ Q_DECLARE_PRIVATE(QPlaceSearchReply)
};
QTM_END_NAMESPACE
diff --git a/src/location/places/qplacetextpredictionreply.cpp b/src/location/places/qplacetextpredictionreply.cpp
index caccedb8..2e203d5a 100644
--- a/src/location/places/qplacetextpredictionreply.cpp
+++ b/src/location/places/qplacetextpredictionreply.cpp
@@ -1,11 +1,12 @@
#include "qplacetextpredictionreply.h"
+#include "qplacereply_p.h"
QTM_BEGIN_NAMESPACE
-class QPlaceTextPredictionReplyPrivate
+class QPlaceTextPredictionReplyPrivate : public QPlaceReplyPrivate
{
public:
- QPlaceTextPredictionReplyPrivate(){};
+ QPlaceTextPredictionReplyPrivate(){}
QStringList textPredictions;
};
@@ -28,8 +29,7 @@ QTM_USE_NAMESPACE
Constructs a text prediction reply with a given \a parent.
*/
QPlaceTextPredictionReply::QPlaceTextPredictionReply(QObject *parent)
- : QPlaceReply(parent),
- d(new QPlaceTextPredictionReplyPrivate)
+ : QPlaceReply(new QPlaceTextPredictionReplyPrivate, parent)
{
}
@@ -38,7 +38,6 @@ QPlaceTextPredictionReply::QPlaceTextPredictionReply(QObject *parent)
*/
QPlaceTextPredictionReply::~QPlaceTextPredictionReply()
{
- delete d;
}
/*!
@@ -46,6 +45,7 @@ QPlaceTextPredictionReply::~QPlaceTextPredictionReply()
*/
QStringList QPlaceTextPredictionReply::textPredictions() const
{
+ Q_D(const QPlaceTextPredictionReply);
return d->textPredictions;
}
@@ -62,5 +62,6 @@ QPlaceReply::Type QPlaceTextPredictionReply::type() const
*/
void QPlaceTextPredictionReply::setTextPredictions(const QStringList &predictions)
{
+ Q_D(QPlaceTextPredictionReply);
d->textPredictions = predictions;
}
diff --git a/src/location/places/qplacetextpredictionreply.h b/src/location/places/qplacetextpredictionreply.h
index df3c5007..47b8ebc7 100644
--- a/src/location/places/qplacetextpredictionreply.h
+++ b/src/location/places/qplacetextpredictionreply.h
@@ -23,7 +23,8 @@ protected:
void setTextPredictions(const QStringList &predictions);
private:
- QPlaceTextPredictionReplyPrivate *d;
+ Q_DISABLE_COPY(QPlaceTextPredictionReply)
+ Q_DECLARE_PRIVATE(QPlaceTextPredictionReply)
};
QTM_END_NAMESPACE