Add method to determine level of file element
This commit is contained in:
parent
99227816b6
commit
90dccb2bd9
|
@ -157,6 +157,7 @@ public:
|
||||||
uint64 totalSize() const;
|
uint64 totalSize() const;
|
||||||
uint64 endOffset() const;
|
uint64 endOffset() const;
|
||||||
uint64 maxTotalSize() const;
|
uint64 maxTotalSize() const;
|
||||||
|
byte level() const;
|
||||||
ImplementationType* parent();
|
ImplementationType* parent();
|
||||||
const ImplementationType* parent() const;
|
const ImplementationType* parent() const;
|
||||||
ImplementationType* nextSibling();
|
ImplementationType* nextSibling();
|
||||||
|
@ -436,6 +437,18 @@ inline uint64 GenericFileElement<ImplementationType>::maxTotalSize() const
|
||||||
return m_maxSize;
|
return m_maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns how deep the element is nested (0 for top-level elements, 1 for children of
|
||||||
|
* top-level elements, ...).
|
||||||
|
*/
|
||||||
|
template<class ImplementationType>
|
||||||
|
byte GenericFileElement<ImplementationType>::level() const
|
||||||
|
{
|
||||||
|
byte level = 0;
|
||||||
|
for(const ImplementationType *parent = m_parent; parent; ++level, parent = parent->m_parent);
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the parent of the element.
|
* \brief Returns the parent of the element.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue