summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlpatterns')
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel.cpp11
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel.h11
-rw-r--r--src/xmlpatterns/data/qitem_p.h21
3 files changed, 14 insertions, 29 deletions
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
index 81c6473..e0a04f7 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
@@ -1138,9 +1138,7 @@ bool QAbstractXmlNodeModel::isDeepEqual(const QXmlNodeModelIndex &n1,
*/
QXmlItem::QXmlItem()
{
- m_node.model = 0;
- m_node.data = 0;
- m_node.additionalData = 0;
+ m_node.reset();
}
bool QXmlItem::internalIsAtomicValue() const
@@ -1164,12 +1162,10 @@ QXmlItem::QXmlItem(const QXmlItem &other) : m_node(other.m_node)
*/
QXmlItem::QXmlItem(const QVariant &atomicValue)
{
+ m_node.reset();
if(atomicValue.isNull())
{
/* Then we behave just like the default constructor. */
- m_node.model = 0;
- m_node.data = 0;
- m_node.additionalData = 0;
return;
}
@@ -1188,10 +1184,7 @@ QXmlItem::QXmlItem(const QVariant &atomicValue)
else
{
m_atomicValue = 0;
- m_node.model = 0;
}
-
- m_node.additionalData = 0;
}
/*!
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.h b/src/xmlpatterns/api/qabstractxmlnodemodel.h
index f8663ed..8c2f7ec 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.h
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.h
@@ -105,6 +105,13 @@ namespace QPatternist
/* Implementation is in qabstractxmlnodemodel.cpp. */
inline bool operator!=(const NodeIndexStorage &other) const;
+
+ void reset()
+ {
+ data = 0;
+ additionalData = 0;
+ model = 0;
+ }
};
}
@@ -217,9 +224,7 @@ public:
inline void reset()
{
- m_storage.data = 0;
- m_storage.additionalData = 0;
- m_storage.model = 0;
+ m_storage.reset();
}
private:
diff --git a/src/xmlpatterns/data/qitem_p.h b/src/xmlpatterns/data/qitem_p.h
index 33cf9a0..e037aec 100644
--- a/src/xmlpatterns/data/qitem_p.h
+++ b/src/xmlpatterns/data/qitem_p.h
@@ -207,14 +207,7 @@ namespace QPatternist
*/
inline Item()
{
- /* Note that this function should be equal to reset(). */
-
- /* This is the area which atomicValue uses. Becauase we want as()
- * to return null on null-constructed objects, we initialize it. */
- node.data = 0;
-
- /* This signals that we're not an atomic value. */
- node.model = 0;
+ node.reset();
}
inline Item(const QXmlNodeModelIndex &n) : node(n.m_storage)
@@ -231,6 +224,7 @@ namespace QPatternist
inline Item(const AtomicValue::Ptr &a)
{
+ node.reset();
if(a)
{
atomicValue = a.data();
@@ -239,14 +233,12 @@ namespace QPatternist
/* Signal that we're housing an atomic value. */
node.model = reinterpret_cast<const QAbstractXmlNodeModel *>(~0);
}
- else
- node.model = 0; /* Like the default constructor. */
}
inline Item(const AtomicValue *const a)
{
/* Note, the implementation is a copy of the constructor above. */
-
+ node.reset();
if(a)
{
atomicValue = a;
@@ -255,8 +247,6 @@ namespace QPatternist
/* Signal that we're housing an atomic value. */
node.model = reinterpret_cast<const QAbstractXmlNodeModel *>(~0);
}
- else
- node.model = 0; /* Like the default constructor. */
}
inline ~Item()
@@ -412,10 +402,7 @@ namespace QPatternist
if(isAtomicValue() && !atomicValue->ref.deref())
delete atomicValue;
- /* Note that this function should be equal to the default
- * constructor. */
- node.model = 0;
- node.data = 0;
+ node.reset();
}
static inline Item fromPublic(const QXmlItem &i)