don't provide non-const iterators to ScRangeName internal data
Also make few trivial functions inline. Change-Id: I89b11b2aa4558696d624c9bde9135b1324b8eb36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131218 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
@@ -234,13 +234,11 @@ public:
|
|||||||
void CopyUsedNames( const SCTAB nLocalTab, const SCTAB nOldTab, const SCTAB nNewTab,
|
void CopyUsedNames( const SCTAB nLocalTab, const SCTAB nOldTab, const SCTAB nNewTab,
|
||||||
const ScDocument& rOldDoc, ScDocument& rNewDoc, const bool bGlobalNamesToLocal ) const;
|
const ScDocument& rOldDoc, ScDocument& rNewDoc, const bool bGlobalNamesToLocal ) const;
|
||||||
|
|
||||||
SC_DLLPUBLIC const_iterator begin() const;
|
SC_DLLPUBLIC const_iterator begin() const { return m_Data.begin(); }
|
||||||
SC_DLLPUBLIC const_iterator end() const;
|
SC_DLLPUBLIC const_iterator end() const { return m_Data.end(); }
|
||||||
SC_DLLPUBLIC iterator begin();
|
SC_DLLPUBLIC size_t size() const { return m_Data.size(); }
|
||||||
SC_DLLPUBLIC iterator end();
|
SC_DLLPUBLIC size_t index_size() const { return maIndexToData.size(); }
|
||||||
SC_DLLPUBLIC size_t size() const;
|
bool empty() const { return m_Data.empty(); }
|
||||||
SC_DLLPUBLIC size_t index_size() const;
|
|
||||||
bool empty() const;
|
|
||||||
|
|
||||||
/** Insert object into set.
|
/** Insert object into set.
|
||||||
@ATTENTION: The underlying ::std::map<std::unique_ptr>::insert(p) takes
|
@ATTENTION: The underlying ::std::map<std::unique_ptr>::insert(p) takes
|
||||||
@@ -264,7 +262,8 @@ public:
|
|||||||
* iterator's validity. The caller must make sure that the iterator is
|
* iterator's validity. The caller must make sure that the iterator is
|
||||||
* valid.
|
* valid.
|
||||||
*/
|
*/
|
||||||
void erase(const iterator& itr);
|
void erase(const_iterator itr);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
bool operator== (const ScRangeName& r) const;
|
bool operator== (const ScRangeName& r) const;
|
||||||
};
|
};
|
||||||
|
@@ -778,41 +778,6 @@ void ScRangeName::CopyUsedNames( const SCTAB nLocalTab, const SCTAB nOldTab, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScRangeName::const_iterator ScRangeName::begin() const
|
|
||||||
{
|
|
||||||
return m_Data.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScRangeName::const_iterator ScRangeName::end() const
|
|
||||||
{
|
|
||||||
return m_Data.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScRangeName::iterator ScRangeName::begin()
|
|
||||||
{
|
|
||||||
return m_Data.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScRangeName::iterator ScRangeName::end()
|
|
||||||
{
|
|
||||||
return m_Data.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ScRangeName::size() const
|
|
||||||
{
|
|
||||||
return m_Data.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ScRangeName::index_size() const
|
|
||||||
{
|
|
||||||
return maIndexToData.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ScRangeName::empty() const
|
|
||||||
{
|
|
||||||
return m_Data.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ScRangeName::insert( ScRangeData* p, bool bReuseFreeIndex )
|
bool ScRangeName::insert( ScRangeData* p, bool bReuseFreeIndex )
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
@@ -863,12 +828,12 @@ void ScRangeName::erase(const ScRangeData& r)
|
|||||||
|
|
||||||
void ScRangeName::erase(const OUString& rName)
|
void ScRangeName::erase(const OUString& rName)
|
||||||
{
|
{
|
||||||
DataType::iterator itr = m_Data.find(rName);
|
DataType::const_iterator itr = m_Data.find(rName);
|
||||||
if (itr != m_Data.end())
|
if (itr != m_Data.end())
|
||||||
erase(itr);
|
erase(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScRangeName::erase(const iterator& itr)
|
void ScRangeName::erase(const_iterator itr)
|
||||||
{
|
{
|
||||||
sal_uInt16 nIndex = itr->second->GetIndex();
|
sal_uInt16 nIndex = itr->second->GetIndex();
|
||||||
m_Data.erase(itr);
|
m_Data.erase(itr);
|
||||||
|
@@ -222,7 +222,7 @@ class EraseRangeByIterator
|
|||||||
ScRangeName& mrRanges;
|
ScRangeName& mrRanges;
|
||||||
public:
|
public:
|
||||||
explicit EraseRangeByIterator(ScRangeName& rRanges) : mrRanges(rRanges) {}
|
explicit EraseRangeByIterator(ScRangeName& rRanges) : mrRanges(rRanges) {}
|
||||||
void operator() (const ScRangeName::iterator& itr)
|
void operator() (const ScRangeName::const_iterator& itr)
|
||||||
{
|
{
|
||||||
mrRanges.erase(itr);
|
mrRanges.erase(itr);
|
||||||
}
|
}
|
||||||
@@ -234,8 +234,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void removeRangeNamesBySrcDoc(ScRangeName& rRanges, sal_uInt16 nFileId)
|
void removeRangeNamesBySrcDoc(ScRangeName& rRanges, sal_uInt16 nFileId)
|
||||||
{
|
{
|
||||||
ScRangeName::iterator itr = rRanges.begin(), itrEnd = rRanges.end();
|
ScRangeName::const_iterator itr = rRanges.begin(), itrEnd = rRanges.end();
|
||||||
vector<ScRangeName::iterator> v;
|
vector<ScRangeName::const_iterator> v;
|
||||||
for (; itr != itrEnd; ++itr)
|
for (; itr != itrEnd; ++itr)
|
||||||
{
|
{
|
||||||
if (hasRefsToSrcDoc(*itr->second, nFileId))
|
if (hasRefsToSrcDoc(*itr->second, nFileId))
|
||||||
|
Reference in New Issue
Block a user