Generalize search algorithms in sorted_vector

This allows to simplify the code somewhat, and also to relax requirements
to the arguments, e.g. allowing to pass const objects to search in vector
containing non-const objects.

Change-Id: Id34911a8694bbdec275d22b51ca4a0845c9fa4c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163519
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2024-02-16 23:58:01 +06:00
parent 39048e0c0e
commit 1f5efbf8b9
23 changed files with 77 additions and 151 deletions

View File

@ -2114,7 +2114,7 @@ bool SvxAutoCorrect::FindInWordStartExceptList( LanguageType eLang,
static bool lcl_FindAbbreviation(const SvStringsISortDtor* pList, const OUString& sWord)
{
SvStringsISortDtor::const_iterator it = pList->find( "~" );
SvStringsISortDtor::const_iterator it = pList->find(u"~"_ustr);
SvStringsISortDtor::size_type nPos = it - pList->begin();
if( nPos < pList->size() )
{

View File

@ -21,9 +21,18 @@
namespace o3tl
{
// forward declared because it's default template arg for sorted_vector
template<class Value, class Compare>
struct find_unique;
/** the elements are totally ordered by Compare,
for no 2 elements !Compare(a,b) && !Compare(b,a) is true
*/
template <class Compare> struct find_unique
{
template <typename Iterator, typename Comparable>
auto operator()(Iterator first, Iterator last, Comparable const& v)
{
auto const it = std::lower_bound(first, last, v, Compare());
return std::make_pair(it, (it != last && !Compare()(v, *it)));
}
};
/** Represents a sorted vector of values.
@ -34,12 +43,11 @@ struct find_unique;
template<
typename Value,
typename Compare = std::less<Value>,
template<typename, typename> class Find = find_unique,
bool = std::is_copy_constructible<Value>::value >
template<typename> class Find = find_unique >
class sorted_vector
{
private:
typedef Find<Value, Compare> Find_t;
typedef Find<Compare> Find_t;
typedef typename std::vector<Value> vector_t;
typedef typename std::vector<Value>::iterator iterator;
public:
@ -55,10 +63,10 @@ public:
std::sort(m_vector.begin(), m_vector.end(), Compare());
}
sorted_vector() = default;
sorted_vector(sorted_vector const&) = default;
sorted_vector(sorted_vector const&) requires std::is_copy_constructible_v<Value> = default;
sorted_vector(sorted_vector&&) = default;
sorted_vector& operator=(sorted_vector const&) = default;
sorted_vector& operator=(sorted_vector const&) requires std::is_copy_constructible_v<Value> = default;
sorted_vector& operator=(sorted_vector&&) = default;
// MODIFIERS
@ -192,12 +200,12 @@ public:
// OPERATIONS
const_iterator lower_bound( const Value& x ) const
template <typename Comparable> const_iterator lower_bound(const Comparable& x) const
{
return std::lower_bound( m_vector.begin(), m_vector.end(), x, Compare() );
}
const_iterator upper_bound( const Value& x ) const
template <typename Comparable> const_iterator upper_bound(const Comparable& x) const
{
return std::upper_bound( m_vector.begin(), m_vector.end(), x, Compare() );
}
@ -208,7 +216,7 @@ public:
*
* Only return a const iterator, so that the vector cannot be directly updated.
*/
const_iterator find( const Value& x ) const
template <typename Comparable> const_iterator find(const Comparable& x) const
{
std::pair<const_iterator, bool> const ret(Find_t()(m_vector.begin(), m_vector.end(), x));
return (ret.second) ? ret.first : m_vector.end();
@ -229,7 +237,7 @@ public:
return m_vector != other.m_vector;
}
void insert(sorted_vector<Value,Compare,Find> const& rOther)
void insert(const sorted_vector& rOther)
{
// optimization for the rather common case that we are overwriting this with the contents
// of another sorted vector
@ -301,123 +309,41 @@ private:
vector_t m_vector;
};
/* Specialise the template for cases like Value = std::unique_ptr<T>, where
MSVC2017 needs some help
*/
template<
typename Value,
typename Compare,
template<typename, typename> class Find >
class sorted_vector<Value,Compare,Find,false> : public sorted_vector<Value, Compare, Find, true>
{
public:
using sorted_vector<Value, Compare, Find, true>::sorted_vector;
typedef sorted_vector<Value, Compare, Find, true> super_sorted_vector;
sorted_vector(sorted_vector const&) = delete;
sorted_vector& operator=(sorted_vector const&) = delete;
sorted_vector() = default;
sorted_vector(sorted_vector&&) = default;
sorted_vector& operator=(sorted_vector&&) = default;
/**
* implement find for sorted_vectors containing std::unique_ptr
*/
typename super_sorted_vector::const_iterator find( typename Value::element_type const * x ) const
{
Value tmp(const_cast<typename Value::element_type*>(x));
auto ret = super_sorted_vector::find(tmp);
// coverity[ resource_leak : FALSE] - this is only a pretend unique_ptr, to avoid allocating a temporary
tmp.release();
return ret;
}
/**
* implement upper_bound for sorted_vectors containing std::unique_ptr
*/
typename super_sorted_vector::const_iterator upper_bound( typename Value::element_type const * x ) const
{
Value tmp(const_cast<typename Value::element_type*>(x));
auto ret = super_sorted_vector::upper_bound(tmp);
// coverity[ resource_leak : FALSE] - this is only a pretend unique_ptr, to avoid allocating a temporary
tmp.release();
return ret;
}
/**
* implement lower_bound for sorted_vectors containing std::unique_ptr
*/
typename super_sorted_vector::const_iterator lower_bound( typename Value::element_type const * x ) const
{
Value tmp(const_cast<typename Value::element_type*>(x));
auto ret = super_sorted_vector::lower_bound(tmp);
// coverity[ resource_leak : FALSE] - this is only a pretend unique_ptr, to avoid allocating a temporary
tmp.release();
return ret;
}
};
/** Implements an ordering function over a pointer, where the comparison uses the < operator on the pointed-to types.
Very useful for the cases where we put pointers to objects inside a sorted_vector.
*/
template <class T> struct less_ptr_to
struct less_ptr_to
{
bool operator() ( T* const& lhs, T* const& rhs ) const
template <class T1, class T2> bool operator()(const T1& lhs, const T2& rhs) const
{
return (*lhs) < (*rhs);
}
};
template <class T> struct less_uniqueptr_to
{
bool operator() ( std::unique_ptr<T> const& lhs, std::unique_ptr<T> const& rhs ) const
{
return (*lhs) < (*rhs);
}
};
/** the elements are totally ordered by Compare,
for no 2 elements !Compare(a,b) && !Compare(b,a) is true
*/
template<class Value, class Compare>
struct find_unique
{
typedef typename sorted_vector<Value, Compare,
o3tl::find_unique> ::const_iterator const_iterator;
std::pair<const_iterator, bool> operator()(
const_iterator first, const_iterator last,
Value const& v)
{
const_iterator const it = std::lower_bound(first, last, v, Compare());
return std::make_pair(it, (it != last && !Compare()(v, *it)));
}
};
/** the elements are partially ordered by Compare,
2 elements are allowed if they are not the same element (pointer equal)
*/
template<class Value, class Compare>
struct find_partialorder_ptrequals
template <class Compare> struct find_partialorder_ptrequals
{
typedef typename sorted_vector<Value, Compare,
o3tl::find_partialorder_ptrequals>::const_iterator const_iterator;
std::pair<const_iterator, bool> operator()(
const_iterator first, const_iterator last,
Value const& v)
template <typename Iterator, typename Comparable>
auto operator()(Iterator first, Iterator last, Comparable const& v)
{
std::pair<const_iterator, const_iterator> const its =
std::equal_range(first, last, v, Compare());
for (const_iterator it = its.first; it != its.second; ++it)
auto const& [begin, end] = std::equal_range(first, last, v, Compare());
for (auto it = begin; it != end; ++it)
{
if (v == *it)
if (&*v == &**it)
{
return std::make_pair(it, true);
}
}
return std::make_pair(its.first, false);
return std::make_pair(begin, false);
}
};
template <class Ref, class Referenced>
concept is_reference_to = std::is_convertible_v<decltype(*std::declval<Ref>()), Referenced>;
} // namespace o3tl
#endif

View File

@ -40,7 +40,7 @@ class sorted_vector_test : public CppUnit::TestFixture
public:
void testBasics()
{
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent> > aVec;
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to> aVec;
// create 4 test elements
std::unique_ptr<SwContent> p1( new SwContent(1) );
@ -85,7 +85,7 @@ public:
void testErase()
{
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent> > aVec;
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to> aVec;
SwContent *p1 = new SwContent(1);
SwContent *p2 = new SwContent(2);
SwContent *p3 = new SwContent(3);
@ -115,7 +115,7 @@ public:
void testInsertRange()
{
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent> > aVec1;
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to> aVec1;
std::unique_ptr<SwContent> p1( new SwContent(1) );
std::unique_ptr<SwContent> p2( new SwContent(2) );
std::unique_ptr<SwContent> p3( new SwContent(3) );
@ -124,7 +124,7 @@ public:
aVec1.insert(p2.get());
aVec1.insert(p3.get());
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent> > aVec2;
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to> aVec2;
aVec2.insert( aVec1 );
CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(3), aVec2.size() );
@ -132,7 +132,7 @@ public:
void testLowerBound()
{
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent> > aVec;
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to> aVec;
std::unique_ptr<SwContent> p1( new SwContent(1) );
std::unique_ptr<SwContent> p2( new SwContent(2) );
std::unique_ptr<SwContent> p3( new SwContent(3) );
@ -148,7 +148,7 @@ public:
void testBasics_FindPtr()
{
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent>,
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to,
o3tl::find_partialorder_ptrequals> aVec;
std::unique_ptr<SwContent> p1( new SwContent(1) );
std::unique_ptr<SwContent> p2( new SwContent(2) );
@ -206,7 +206,7 @@ public:
void testErase_FindPtr()
{
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent>,
o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to,
o3tl::find_partialorder_ptrequals> aVec;
std::unique_ptr<SwContent> p1( new SwContent(1) );
SwContent *p1_2 = new SwContent(1);
@ -256,7 +256,7 @@ public:
void testUniquePtr1()
{
o3tl::sorted_vector<std::unique_ptr<OUString>, o3tl::less_uniqueptr_to<OUString>> aVec;
o3tl::sorted_vector<std::unique_ptr<OUString>, o3tl::less_ptr_to> aVec;
auto str_c = aVec.insert(std::make_unique<OUString>("c")).first->get();
auto str_b1 = aVec.insert(std::make_unique<OUString>("b")).first->get();
@ -278,7 +278,7 @@ public:
void testUniquePtr2()
{
o3tl::sorted_vector<std::unique_ptr<OUString>, o3tl::less_uniqueptr_to<OUString>,
o3tl::sorted_vector<std::unique_ptr<OUString>, o3tl::less_ptr_to,
o3tl::find_partialorder_ptrequals> aVec;
auto str_c = aVec.insert(std::make_unique<OUString>("c")).first->get();

View File

@ -209,7 +209,7 @@ public:
struct CompareSwRedlineTable
{
bool operator()(SwRangeRedline* const &lhs, SwRangeRedline* const &rhs) const;
bool operator()(const SwRangeRedline* lhs, const SwRangeRedline* rhs) const;
};
// Notification type for notifying about redlines to LOK clients

View File

@ -62,7 +62,7 @@ public:
{ return GetDocPos() < rCmp.GetDocPos(); }
};
class SwGlblDocContents : public o3tl::sorted_vector<std::unique_ptr<SwGlblDocContent>, o3tl::less_uniqueptr_to<SwGlblDocContent> > {};
class SwGlblDocContents : public o3tl::sorted_vector<std::unique_ptr<SwGlblDocContent>, o3tl::less_ptr_to > {};
#endif

View File

@ -72,7 +72,7 @@ typedef struct _xmlTextWriter *xmlTextWriterPtr;
struct CompareSwOutlineNodes
{
bool operator()( SwNode* const& lhs, SwNode* const& rhs) const;
bool operator()(const SwNode* lhs, const SwNode* rhs) const;
};
class SwOutlineNodes : public o3tl::sorted_vector<SwNode*, CompareSwOutlineNodes>
@ -80,7 +80,7 @@ class SwOutlineNodes : public o3tl::sorted_vector<SwNode*, CompareSwOutlineNodes
public:
static constexpr auto npos = std::numeric_limits<size_type>::max();
bool Seek_Entry(SwNode* rP, size_type* pnPos) const;
bool Seek_Entry(const SwNode* rP, size_type* pnPos) const;
};
struct SwTableToTextSave;

View File

@ -646,7 +646,7 @@ bool SwRedlineTable::InsertWithValidRanges(SwRangeRedline*& p, size_type* pInsPo
return bAnyIns;
}
bool CompareSwRedlineTable::operator()(SwRangeRedline* const &lhs, SwRangeRedline* const &rhs) const
bool CompareSwRedlineTable::operator()(const SwRangeRedline* lhs, const SwRangeRedline* rhs) const
{
return *lhs < *rhs;
}

View File

@ -754,7 +754,7 @@ static bool IsHeadingContained(const SwTextNode* pChptrNd, const SwNode& rNd)
bool bCheckFirst = false;
SwOutlineNodes::size_type nPos;
if (!rONds.Seek_Entry(const_cast<SwNode*>(pNd), &nPos))
if (!rONds.Seek_Entry(pNd, &nPos))
{
if (nPos == 0)
bCheckFirst = true;
@ -785,7 +785,7 @@ static bool IsHeadingContained(const SwTextNode* pChptrNd, const SwNode& rNd)
if (bIsHeadingContained)
{
const SwNode* aChptrNd = pChptrNd;
if (!rONds.Seek_Entry(const_cast<SwNode*>(aChptrNd), &nPos) && nPos)
if (!rONds.Seek_Entry(aChptrNd, &nPos) && nPos)
nPos--;
// Search for the next outline node with a larger level than the specified chapter node
while (nPos < rONds.size() - 1

View File

@ -24,12 +24,12 @@
#include <fldbas.hxx>
#include <osl/diagnose.h>
bool CompareSwOutlineNodes::operator()( SwNode* const& lhs, SwNode* const& rhs) const
bool CompareSwOutlineNodes::operator()(const SwNode* lhs, const SwNode* rhs) const
{
return lhs->GetIndex() < rhs->GetIndex();
}
bool SwOutlineNodes::Seek_Entry(SwNode* rP, size_type* pnPos) const
bool SwOutlineNodes::Seek_Entry(const SwNode* rP, size_type* pnPos) const
{
const_iterator it = lower_bound(rP);
*pnPos = it - begin();
@ -79,10 +79,8 @@ void SwNodes::UpdateOutlineIdx( const SwNode& rNd )
if( m_aOutlineNodes.empty() ) // no OutlineNodes present ?
return;
SwNode* const pSrch = const_cast<SwNode*>(&rNd);
SwOutlineNodes::size_type nPos;
if (!m_aOutlineNodes.Seek_Entry(pSrch, &nPos))
if (!m_aOutlineNodes.Seek_Entry(&rNd, &nPos))
return;
if( nPos == m_aOutlineNodes.size() ) // none present for updating ?
return;

View File

@ -796,9 +796,8 @@ const SwTextNode* SwNode::FindOutlineNodeOfLevel(sal_uInt8 const nLvl,
if( MAXLEVEL > nLvl && !rONds.empty() )
{
SwOutlineNodes::size_type nPos;
SwNode* pNd = const_cast<SwNode*>(this);
bool bCheckFirst = false;
if( !rONds.Seek_Entry( pNd, &nPos ))
if (!rONds.Seek_Entry(this, &nPos))
{
if (nPos == 0)
bCheckFirst = true;
@ -2002,7 +2001,7 @@ bool SwContentNode::IsAnyCondition( SwCollCondition& rTmp ) const
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
if( !rOutlNds.empty() )
{
if( !rOutlNds.Seek_Entry( const_cast<SwContentNode*>(this), &nPos ) && nPos )
if (!rOutlNds.Seek_Entry(this, &nPos) && nPos)
--nPos;
if( nPos < rOutlNds.size() &&
rOutlNds[ nPos ]->GetIndex() < GetIndex() )

View File

@ -556,11 +556,10 @@ bool SwEditShell::IsProtectedOutlinePara() const
if( rNd.IsTextNode() )
{
const SwOutlineNodes& rOutlNd = GetDoc()->GetNodes().GetOutLineNds();
SwNode* pNd = const_cast<SwNode*>(&rNd);
bool bFirst = true;
SwOutlineNodes::size_type nPos;
int nLvl(0);
if( !rOutlNd.Seek_Entry( pNd, &nPos ) && nPos )
if (!rOutlNd.Seek_Entry(&rNd, &nPos) && nPos)
--nPos;
for( ; nPos < rOutlNd.size(); ++nPos )

View File

@ -114,7 +114,7 @@ public:
void SetBodyPos( const SwContentFrame& rFrame );
};
class SetGetExpFields : public o3tl::sorted_vector<std::unique_ptr<SetGetExpField>, o3tl::less_uniqueptr_to<SetGetExpField> >
class SetGetExpFields : public o3tl::sorted_vector<std::unique_ptr<SetGetExpField>, o3tl::less_ptr_to >
{
};

View File

@ -49,7 +49,7 @@ public:
bool operator< ( const SwBlockName& r ) const { return m_aShort < r.m_aShort; }
};
class SwBlockNames : public o3tl::sorted_vector<std::unique_ptr<SwBlockName>, o3tl::less_uniqueptr_to<SwBlockName> > {};
class SwBlockNames : public o3tl::sorted_vector<std::unique_ptr<SwBlockName>, o3tl::less_ptr_to > {};
class SwImpBlocks
{

View File

@ -121,7 +121,7 @@ public:
class SwHTMLPosFlyFrames
: public o3tl::sorted_vector<std::unique_ptr<SwHTMLPosFlyFrame>,
o3tl::less_uniqueptr_to<SwHTMLPosFlyFrame>,
o3tl::less_ptr_to,
o3tl::find_partialorder_ptrequals>
{};

View File

@ -204,7 +204,7 @@ struct HTMLControl
}
};
class HTMLControls : public o3tl::sorted_vector<std::unique_ptr<HTMLControl>, o3tl::less_uniqueptr_to<HTMLControl> > {
class HTMLControls : public o3tl::sorted_vector<std::unique_ptr<HTMLControl>, o3tl::less_ptr_to > {
};
struct SwHTMLFormatInfo

View File

@ -151,7 +151,7 @@ inline bool SwWriteTableRow::operator<( const SwWriteTableRow& rRow ) const
}
using SwWriteTableRows
= o3tl::sorted_vector< std::unique_ptr<SwWriteTableRow>, o3tl::less_uniqueptr_to<SwWriteTableRow> >;
= o3tl::sorted_vector< std::unique_ptr<SwWriteTableRow>, o3tl::less_ptr_to >;
class SwWriteTableCol
{
@ -199,7 +199,10 @@ inline bool SwWriteTableCol::operator<( const SwWriteTableCol& rCol ) const
}
struct SwWriteTableColLess {
bool operator()(std::unique_ptr<SwWriteTableCol> const & lhs, std::unique_ptr<SwWriteTableCol> const & rhs) {
template <typename T1, typename T2>
requires o3tl::is_reference_to<T1, SwWriteTableCol>
&& o3tl::is_reference_to<T2, SwWriteTableCol>
bool operator()(T1 const& lhs, T2 const& rhs) const {
return lhs->GetPos() < rhs->GetPos();
}
};

View File

@ -99,7 +99,7 @@ struct SwXMLTableColumnCmpWidth_Impl
}
};
class SwXMLTableColumns_Impl : public o3tl::sorted_vector<std::unique_ptr<SwXMLTableColumn_Impl>, o3tl::less_uniqueptr_to<SwXMLTableColumn_Impl> > {
class SwXMLTableColumns_Impl : public o3tl::sorted_vector<std::unique_ptr<SwXMLTableColumn_Impl>, o3tl::less_ptr_to > {
};
}

View File

@ -111,8 +111,7 @@ void SwOutlineContentVisibilityWin::Set()
SwWrtShell& rSh = GetEditWin()->GetView().GetWrtShell();
const SwOutlineNodes& rOutlineNodes = rSh.GetNodes().GetOutLineNds();
(void)rOutlineNodes.Seek_Entry(static_cast<SwNode*>(const_cast<SwTextNode*>(pTextNode)),
&m_nOutlinePos);
(void)rOutlineNodes.Seek_Entry(pTextNode, &m_nOutlinePos);
// set symbol displayed on button
bool bVisible = true;

View File

@ -73,7 +73,7 @@ struct SwInsDBColumn
bool operator<( const SwInsDBColumn& rCmp ) const;
};
class SwInsDBColumns : public o3tl::sorted_vector<std::unique_ptr<SwInsDBColumn>, o3tl::less_uniqueptr_to<SwInsDBColumn> >
class SwInsDBColumns : public o3tl::sorted_vector<std::unique_ptr<SwInsDBColumn>, o3tl::less_ptr_to >
{
};

View File

@ -51,7 +51,7 @@ struct SwRedlineDataParent
{ return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); }
};
class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to<SwRedlineDataParent> > {};
class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to > {};
class SW_DLLPUBLIC SwRedlineAcceptDlg final
{

View File

@ -153,7 +153,7 @@ constexpr char NAVI_BOOKMARK_DELIM = '\x01';
}
class SwContentArr
: public o3tl::sorted_vector<std::unique_ptr<SwContent>, o3tl::less_uniqueptr_to<SwContent>,
: public o3tl::sorted_vector<std::unique_ptr<SwContent>, o3tl::less_ptr_to,
o3tl::find_partialorder_ptrequals>
{
};

View File

@ -120,9 +120,10 @@ inline XMLFontAutoStylePoolEntry_Impl::XMLFontAutoStylePoolEntry_Impl(
namespace {
struct XMLFontAutoStylePoolEntryCmp_Impl {
bool operator()(
std::unique_ptr<XMLFontAutoStylePoolEntry_Impl> const& r1,
std::unique_ptr<XMLFontAutoStylePoolEntry_Impl> const& r2 ) const
template <typename T1, typename T2>
requires o3tl::is_reference_to<T1, XMLFontAutoStylePoolEntry_Impl>
&& o3tl::is_reference_to<T2, XMLFontAutoStylePoolEntry_Impl>
bool operator()(T1 const& r1, T2 const& r2) const
{
bool bEnc1(r1->GetEncoding() != RTL_TEXTENCODING_SYMBOL);
bool bEnc2(r2->GetEncoding() != RTL_TEXTENCODING_SYMBOL);

View File

@ -120,9 +120,10 @@ namespace {
struct XMLTextListAutoStylePoolEntryCmp_Impl
{
bool operator()(
std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> const& r1,
std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> const& r2 ) const
template <typename T1, typename T2>
requires o3tl::is_reference_to<T1, XMLTextListAutoStylePoolEntry_Impl>
&& o3tl::is_reference_to<T2, XMLTextListAutoStylePoolEntry_Impl>
bool operator()(T1 const& r1, T2 const& r2) const
{
if( r1->IsNamed() )
{