Kaydet (Commit) 5fe99ea3 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:unusedmethods in sw/

Change-Id: Id452bfac5c83f130a138e06984a0c79c37af70ac
üst 39969def
......@@ -178,15 +178,13 @@ for d in definitionSet:
continue
if d in callSet:
continue
# ignore operators, they are normally called from inside STL code
if "::operator" in d[1]:
if isOtherConstness(d, callSet):
continue
# ignore the custom RTTI stuff
if ( ("::CreateType()" in d[1])
or ("::IsA(" in d[1])
or ("::Type()" in d[1])):
# include assigment operators, if we remove them, the compiler creates a default one, which can have odd consequences
if "::operator=(" in d[1]:
continue
if isOtherConstness(d, callSet):
# these are only invoked implicitly, so the plugin does not see the calls
if "::operator new(" in d[1] or "::operator delete(" in d[1]:
continue
# just ignore iterators, they normally occur in pairs, and we typically want to leave one constness version alone
# alone if the other one is in use.
......@@ -198,9 +196,6 @@ for d in definitionSet:
# used by Windows build
if any(x in d[1] for x in ["DdeTopic::", "DdeData::", "DdeService::", "DdeTransaction::", "DdeConnection::", "DdeLink::", "DdeItem::", "DdeGetPutItem::"]):
continue
# the include/tools/rtti.hxx stuff
if ("::StaticType()" in d[1]) or ("::IsOf(void *(*)(void))" in d[1]):
continue
# too much template magic here for my plugin
if ( ("cairocanvas::" in d[1])
or ("canvas::" in d[1])
......@@ -231,6 +226,9 @@ for d in definitionSet:
continue
if d[0] == "basic_ostream<type-parameter-?-?, type-parameter-?-?> &" and d[1].startswith("operator<<(basic_ostream<type-parameter-?-?"):
continue
# ignore the SfxPoolItem CreateDefault methods for now
if d[1].endswith("::CreateDefault()"):
continue
tmp1set.add((clazz, definitionToSourceLocationMap[d]))
......@@ -243,10 +241,10 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
tmp1list = sorted(tmp1set, key=lambda v: natural_sort_key(v[1]))
# print out the results
#for t in tmp1list:
# print t[1]
# print " ", t[0]
for t in tmp1list:
print t[1]
print " ", t[0]
sys.exit(0)
# -------------------------------------------
# Do the "unused return types" part
......@@ -279,7 +277,7 @@ for d in definitionSet:
if definitionToSourceLocationMap[d].startswith("external/"):
continue
# ignore the SfxPoolItem CreateDefault methods for now
if "::CreateDefault" in d[1]:
if d[1].endswith("::CreateDefault()"):
continue
tmp2set.add((clazz, definitionToSourceLocationMap[d]))
......
......@@ -137,18 +137,6 @@ namespace sw { namespace mark
{
return pMark->StartsAfter(rPos);
}
#ifdef DBG_UTIL
bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark,
SwPosition const& rPos)
{
return pMark->StartsBefore(rPos);
}
bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark1,
std::shared_ptr<sw::mark::IMark> const& pMark2)
{
return (*pMark1) < (*pMark2);
}
#endif
};
// MSVC 2008 with _DEBUG calls this with parameters in wrong order
......@@ -160,18 +148,6 @@ namespace sw { namespace mark
{
return pMark->StartsBefore(rPos);
}
#ifdef DBG_UTIL
bool operator()(SwPosition const& rPos,
std::shared_ptr<sw::mark::IMark> const& pMark)
{
return pMark->StartsAfter(rPos);
}
bool operator()(std::shared_ptr<sw::mark::IMark> const& pMark1,
std::shared_ptr<sw::mark::IMark> const& pMark2)
{
return (*pMark1) < (*pMark2);
}
#endif
};
OUString ExpandFieldmark(IFieldmark* pBM);
......
......@@ -655,19 +655,6 @@ protected:
};
/**
Functor. Checks if a certain node is less than the functor's member.
*/
struct SwNumberTreeNodeIsLessThan
{
const SwNumberTreeNode * pNode;
SwNumberTreeNodeIsLessThan(const SwNumberTreeNode * _pNode)
: pNode(_pNode) {}
bool operator()(const SwNumberTreeNode * _pNode) const
{ return SwNumberTreeNodeLessThan(_pNode, pNode); }
};
#endif // INCLUDED_SW_INC_SWNUMBERTREE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -54,9 +54,6 @@ public:
bool InsertWord( const OUString& rWord, SwDoc& rDoc );
const OUString& operator[](size_t n) const
{ return m_WordList[n]->GetAutoCompleteString(); }
bool IsLockWordLstLocked() const { return bLockWordLst; }
void SetLockWordLstLocked( bool bFlag ) { bLockWordLst = bFlag; }
......
......@@ -352,13 +352,9 @@ public:
SvNumberFormatter* pNFormatr,
long nLanguage );
sal_Int32 GetRowCount(const OUString& rDBName, const OUString& rTableName);
static sal_Int32 GetRowCount(css::uno::Reference< css::sdbc::XConnection> xConnection,
const OUString& rTableName);
sal_Int32 GetRowCount() const;
sal_uLong GetColumnFormat( const OUString& rDBName,
const OUString& rTableName,
const OUString& rColNm,
......
......@@ -49,8 +49,6 @@ public:
size_t Count() const
{ return maVector.size(); }
SwPamRange operator[]( size_t nPos ) const
{ return maVector[nPos]; }
private:
o3tl::sorted_vector<SwPamRange> maVector;
};
......
......@@ -197,8 +197,6 @@ private:
public:
bool operator==( const SwCollCondition& rCmp ) const;
bool operator!=( const SwCollCondition& rCmp ) const
{ return ! (*this == rCmp); }
sal_uLong GetCondition() const { return m_nCondition; }
sal_uLong GetSubCondition() const { return m_aSubCondition.nSubCondition; }
......
......@@ -57,7 +57,6 @@ public:
SwLineNumberInfo(const SwLineNumberInfo&);
SwLineNumberInfo& operator=(const SwLineNumberInfo&);
bool operator==( const SwLineNumberInfo& rInf ) const;
SwCharFormat *GetCharFormat( IDocumentStylePoolAccess& rIDSPA ) const;
void SetCharFormat( SwCharFormat* );
......
......@@ -89,8 +89,6 @@ public:
inline sal_uLong operator+=( sal_uLong );
inline sal_uLong operator-=( sal_uLong );
inline sal_uLong operator+=( const SwNodeIndex& );
inline sal_uLong operator-=( const SwNodeIndex& );
inline bool operator< ( const SwNodeIndex& ) const;
inline bool operator<=( const SwNodeIndex& ) const;
......@@ -248,16 +246,6 @@ inline sal_uLong SwNodeIndex::operator-=( sal_uLong const nOffset )
m_pNode = GetNodes()[ m_pNode->GetIndex() - nOffset ];
return m_pNode->GetIndex();
}
inline sal_uLong SwNodeIndex::operator+=( const SwNodeIndex& rIndex )
{
m_pNode = GetNodes()[ m_pNode->GetIndex() + rIndex.GetIndex() ];
return m_pNode->GetIndex();
}
inline sal_uLong SwNodeIndex::operator-=( const SwNodeIndex& rIndex )
{
m_pNode = GetNodes()[ m_pNode->GetIndex() - rIndex.GetIndex() ];
return m_pNode->GetIndex();
}
inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong const nNew )
{
......
......@@ -227,8 +227,6 @@ public:
bool HasValidRange() const;
const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const;
bool operator==( const SwRedlineData& rCmp ) const
{ return *pRedlineData == rCmp; }
bool operator!=( const SwRedlineData& rCmp ) const
{ return *pRedlineData != rCmp; }
void SetAutoFormatFlag() { pRedlineData->SetAutoFormatFlag(); }
......@@ -292,7 +290,6 @@ public:
*/
OUString GetDescr(sal_uInt16 nPos = 0);
bool operator==( const SwRangeRedline& ) const;
bool operator<( const SwRangeRedline& ) const;
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
......
......@@ -59,7 +59,6 @@ public:
SwTabCols( sal_uInt16 nSize = 0 );
SwTabCols( const SwTabCols& );
SwTabCols &operator=( const SwTabCols& );
bool operator==( const SwTabCols& rCmp ) const;
long& operator[]( size_t nPos ) { return aData[nPos].nPos; }
long operator[]( size_t nPos ) const { return aData[nPos].nPos; }
size_t Count() const { return aData.size(); }
......
......@@ -115,7 +115,6 @@ public:
SwBoxAutoFormat( const SwBoxAutoFormat& rNew );
~SwBoxAutoFormat();
int operator==( const SwBoxAutoFormat& rCmp ) const;
SwBoxAutoFormat& operator=( const SwBoxAutoFormat& rNew );
// The get-methods.
......
......@@ -55,27 +55,6 @@ SwTabCols &SwTabCols::operator=( const SwTabCols& rCpy )
return *this;
}
bool SwTabCols::operator==( const SwTabCols& rCmp ) const
{
if ( !(nLeftMin == rCmp.GetLeftMin() &&
nLeft == rCmp.GetLeft() &&
nRight == rCmp.GetRight() &&
nRightMax== rCmp.GetRightMax()&&
bLastRowAllowedToChange== rCmp.IsLastRowAllowedToChange() &&
Count()== rCmp.Count()) )
return false;
for ( size_t i = 0; i < Count(); ++i )
{
SwTabColsEntry aEntry1 = aData[i];
SwTabColsEntry aEntry2 = rCmp.GetData()[i];
if ( aEntry1.nPos != aEntry2.nPos || aEntry1.bHidden != aEntry2.bHidden )
return false;
}
return true;
}
void SwTabCols::Insert( long nValue, long nMin, long nMax,
bool bValue, size_t nPos )
{
......
......@@ -1554,11 +1554,6 @@ const OUString& SwRangeRedline::GetComment( sal_uInt16 nPos ) const
return GetRedlineData(nPos).sComment;
}
bool SwRangeRedline::operator==( const SwRangeRedline& rCmp ) const
{
return this == &rCmp;
}
bool SwRangeRedline::operator<( const SwRangeRedline& rCmp ) const
{
if (*Start() < *rCmp.Start())
......
......@@ -158,11 +158,6 @@ int SwSortElement::keycompare(const SwSortElement& rCmp, sal_uInt16 nKey) const
return nCmp;
}
bool SwSortElement::operator==(const SwSortElement& ) const
{
return false;
}
bool SwSortElement::operator<(const SwSortElement& rCmp) const
{
// The actual comparison
......
......@@ -101,21 +101,6 @@ SwLineNumberInfo& SwLineNumberInfo::operator=(const SwLineNumberInfo &rCpy)
return *this;
}
bool SwLineNumberInfo::operator==( const SwLineNumberInfo& rInf ) const
{
return GetRegisteredIn() == rInf.GetRegisteredIn() &&
aType.GetNumberingType() == rInf.GetNumType().GetNumberingType() &&
aDivider == rInf.GetDivider() &&
nPosFromLeft == rInf.GetPosFromLeft() &&
nCountBy == rInf.GetCountBy() &&
nDividerCountBy == rInf.GetDividerCountBy() &&
ePos == rInf.GetPos() &&
bPaintLineNumbers == rInf.IsPaintLineNumbers() &&
bCountBlankLines == rInf.IsCountBlankLines() &&
bCountInFlys == rInf.IsCountInFlys() &&
bRestartEachPage == rInf.IsRestartEachPage();
}
SwCharFormat* SwLineNumberInfo::GetCharFormat( IDocumentStylePoolAccess& rIDSPA ) const
{
if ( !GetRegisteredIn() )
......
......@@ -60,8 +60,6 @@ public:
sal_uInt16 GetDirection() const { return nDir; }
bool operator<( const SwBlinkPortion& rBlinkPortion ) const
{ return reinterpret_cast<sal_IntPtr>(pPor) < reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
bool operator==( const SwBlinkPortion& rBlinkPortion ) const
{ return reinterpret_cast<sal_IntPtr>(pPor) == reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
};
typedef std::set<std::unique_ptr<SwBlinkPortion>,
......
......@@ -82,7 +82,6 @@ struct SwSortElement
virtual OUString GetKey(sal_uInt16 nKey ) const = 0;
virtual double GetValue(sal_uInt16 nKey ) const;
bool operator==(const SwSortElement& ) const;
bool operator<(const SwSortElement& ) const;
static double StrToDouble(const OUString& rStr);
......
......@@ -41,8 +41,6 @@ public:
const OUString& GetURL() const { return aURL; }
const OUString& GetTarget() const { return aTarget; }
const SwRect& GetRect() const { return aRect; }
bool operator==( const SwURLNote& rSwURLNote ) const
{ return aRect == rSwURLNote.aRect; }
};
class SwNoteURL
......
......@@ -43,7 +43,6 @@ public:
SwBlockName( const OUString& rShort, const OUString& rLong, const OUString& rPackageName );
/// For sorting in the array
bool operator==( const SwBlockName& r ) const { return aShort == r.aShort; }
bool operator< ( const SwBlockName& r ) const { return aShort < r.aShort; }
};
......
......@@ -80,7 +80,6 @@ public:
// Access methods
inline SwLinePortion *GetPortion() const { return pPortion; }
inline SwLinePortion &operator=(const SwLinePortion &rPortion);
inline bool operator==( const SwLinePortion &rPortion ) const;
inline sal_Int32 GetLen() const { return nLineLength; }
inline void SetLen( const sal_Int32 nLen ) { nLineLength = nLen; }
inline void SetPortion( SwLinePortion *pNew ){ pPortion = pNew; }
......@@ -193,14 +192,6 @@ inline SwLinePortion &SwLinePortion::operator=(const SwLinePortion &rPortion)
return *this;
}
inline bool SwLinePortion::operator==(const SwLinePortion &rPortion ) const
{
return( Height() == rPortion.Height() &&
Width() == rPortion.Width() &&
nLineLength == rPortion.GetLen() &&
nAscent == rPortion.GetAscent() );
}
inline SwLinePortion::SwLinePortion(const SwLinePortion &rPortion) :
SwPosSize( rPortion ),
pPortion( nullptr ),
......
......@@ -96,7 +96,6 @@ public:
SwHTMLPosFlyFrame( const SwPosFlyFrame& rPosFly,
const SdrObject *pSdrObj, sal_uInt8 nOutMode );
bool operator==( const SwHTMLPosFlyFrame& ) const { return false; }
bool operator<( const SwHTMLPosFlyFrame& ) const;
const SwFrameFormat& GetFormat() const { return *pFrameFormat; }
......
......@@ -757,26 +757,6 @@ void SwDBManager::GetColumnNames(ListBox* pListBox,
}
sal_Int32 SwDBManager::GetRowCount(const OUString& rDBName, const OUString& rTableName)
{
SwDBData aData;
aData.sDataSource = rDBName;
aData.sCommand = rTableName;
aData.nCommandType = -1;
SwDSParam* pParam = FindDSData(aData, false);
uno::Reference<sdbc::XConnection> xConnection;
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
{
OUString sDBName(rDBName);
xConnection = RegisterConnection( sDBName );
}
return GetRowCount(xConnection, rTableName);
}
sal_Int32 SwDBManager::GetRowCount(uno::Reference<sdbc::XConnection> xConnection,
const OUString& rTableName)
{
......@@ -791,21 +771,6 @@ sal_Int32 SwDBManager::GetRowCount(uno::Reference<sdbc::XConnection> xConnection
sal_Int32 SwDBManager::GetRowCount() const
{
sal_Int32 nCnt = pImpl->pMergeData->aSelection.getLength();
if(nCnt == 0)
{
uno::Reference<beans::XPropertySet> xProp(pImpl->pMergeData->xResultSet, uno::UNO_QUERY);
if(xProp.is())
xProp->getPropertyValue("RowCount") >>= nCnt;
}
return nCnt;
}
SwDBManager::SwDBManager(SwDoc* pDoc)
: bCancel(false)
, bInitDBFields(false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment