summaryrefslogtreecommitdiff
path: root/src/location
diff options
context:
space:
mode:
authorJean Gressmann <jean.gressmann@nokia.com>2012-03-13 18:23:20 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-15 13:34:15 +0100
commit02673fd6ca7ad85e48fe17ce329d54af101f3694 (patch)
treee5819fdb17c91439ff688a7381bca619f7d3eb62 /src/location
parentb827cee44697b3766543870be7c5bcbb89f0c692 (diff)
downloadqtlocation-02673fd6ca7ad85e48fe17ce329d54af101f3694.tar.gz
isEmpty() functions for place data classes
Task-number: QTBUG-23557 Added isEmpty() to QPlaceAttribute and QPlaceCategory. Change-Id: Ie87cc1606fc35656aa30c460ee47ab6cec71eddb Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'src/location')
-rw-r--r--src/location/places/qplaceattribute.cpp15
-rw-r--r--src/location/places/qplaceattribute.h2
-rw-r--r--src/location/places/qplaceattribute_p.h2
-rw-r--r--src/location/places/qplacecategory.cpp16
-rw-r--r--src/location/places/qplacecategory.h2
-rw-r--r--src/location/places/qplacecategory_p.h2
6 files changed, 38 insertions, 1 deletions
diff --git a/src/location/places/qplaceattribute.cpp b/src/location/places/qplaceattribute.cpp
index d5423283..caa09f69 100644
--- a/src/location/places/qplaceattribute.cpp
+++ b/src/location/places/qplaceattribute.cpp
@@ -65,6 +65,13 @@ bool QPlaceAttributePrivate::operator== (const QPlaceAttributePrivate &other) co
&& text == other.text;
}
+bool QPlaceAttributePrivate::isEmpty() const
+{
+ return label.isEmpty()
+ && text.isEmpty();
+}
+
+
/*!
\class QPlaceAttribute
\inmodule QtLocation
@@ -211,3 +218,11 @@ void QPlaceAttribute::setText(const QString &text)
{
d_ptr->text = text;
}
+
+/*!
+ Returns a boolean indicating whether the all the fields of the place attribute are empty or not.
+*/
+bool QPlaceAttribute::isEmpty() const
+{
+ return d_ptr->isEmpty();
+}
diff --git a/src/location/places/qplaceattribute.h b/src/location/places/qplaceattribute.h
index 6e108f04..e1effcb3 100644
--- a/src/location/places/qplaceattribute.h
+++ b/src/location/places/qplaceattribute.h
@@ -77,6 +77,8 @@ public:
QString text() const;
void setText(const QString &text);
+ bool isEmpty() const;
+
protected:
QSharedDataPointer<QPlaceAttributePrivate> d_ptr;
};
diff --git a/src/location/places/qplaceattribute_p.h b/src/location/places/qplaceattribute_p.h
index 0219a860..b8f94d33 100644
--- a/src/location/places/qplaceattribute_p.h
+++ b/src/location/places/qplaceattribute_p.h
@@ -70,6 +70,8 @@ public:
virtual bool operator== (const QPlaceAttributePrivate &other) const;
virtual QPlaceAttributePrivate* clone() const { return new QPlaceAttributePrivate(*this); }
+ bool isEmpty() const;
+
QString label;
QString text;
};
diff --git a/src/location/places/qplacecategory.cpp b/src/location/places/qplacecategory.cpp
index 56224cb0..a33d5d68 100644
--- a/src/location/places/qplacecategory.cpp
+++ b/src/location/places/qplacecategory.cpp
@@ -67,6 +67,14 @@ QPlaceCategoryPrivate &QPlaceCategoryPrivate::operator=(const QPlaceCategoryPriv
return *this;
}
+bool QPlaceCategoryPrivate::isEmpty() const
+{
+ return categoryId.isEmpty()
+ && name.isEmpty()
+ && icon.isEmpty()
+ && QtLocation::UnspecifiedVisibility == visibility;
+}
+
/*!
\class QPlaceCategory
\inmodule QtLocation
@@ -200,4 +208,12 @@ void QPlaceCategory::setIcon(const QPlaceIcon &icon)
d->icon = icon;
}
+/*!
+ Returns a boolean indicating whether the all the fields of the place category are empty or not.
+*/
+bool QPlaceCategory::isEmpty() const
+{
+ return d->isEmpty();
+}
+
QT_END_NAMESPACE
diff --git a/src/location/places/qplacecategory.h b/src/location/places/qplacecategory.h
index e45a06d1..b0da859a 100644
--- a/src/location/places/qplacecategory.h
+++ b/src/location/places/qplacecategory.h
@@ -85,6 +85,8 @@ public:
QPlaceIcon icon() const;
void setIcon(const QPlaceIcon &icon);
+ bool isEmpty() const;
+
private:
QSharedDataPointer<QPlaceCategoryPrivate> d;
};
diff --git a/src/location/places/qplacecategory_p.h b/src/location/places/qplacecategory_p.h
index 5eaea74c..62016d52 100644
--- a/src/location/places/qplacecategory_p.h
+++ b/src/location/places/qplacecategory_p.h
@@ -59,7 +59,7 @@ public:
~QPlaceCategoryPrivate();
QPlaceCategoryPrivate &operator= (const QPlaceCategoryPrivate &other);
bool operator==(const QPlaceCategoryPrivate &other) const;
-
+ bool isEmpty() const;
QString categoryId;
QString name;