Kaydet (Commit) 9f4f237a authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

loplugin:unusedmethods svl

Change-Id: If86cc43fda4d138cf7f678d81fa2b35f68f3c03b
Reviewed-on: https://gerrit.libreoffice.org/17162Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst fcdddbd3
......@@ -124,12 +124,19 @@ static bool startsWith(const std::string& s, const char* other)
return s.compare(0, strlen(other), other) == 0;
}
static bool isStandardStuff(const std::string& s)
static bool isStandardStuff(const std::string& input)
{
std::string s = input;
if (startsWith(s,"class "))
s = s.substr(6);
else if (startsWith(s,"struct "))
s = s.substr(7);
// ignore UNO interface definitions, cannot change those
return startsWith(s, "com::sun::star::")
// ignore stuff in the C++ stdlib and boost
|| startsWith(s, "std::") || startsWith(s, "boost::") || startsWith(s, "class boost::") || startsWith(s, "__gnu_debug::")
// external library
|| startsWith(s, "mdds::")
// can't change our rtl layer
|| startsWith(s, "rtl::")
// ignore anonymous namespace stuff, it is compilation-unit-local and the compiler will detect any
......
......@@ -57,6 +57,7 @@ exclusionSet = set([
# instantiated from templates, not sure why it is not being picked up
"class basegfx::B2DPolygon OutputDevice::PixelToLogic(const class basegfx::B2DPolygon &,const class MapMode &) const",
"type-parameter-0-0 * detail::cloner::clone(type-parameter-0-0 *const)",
"const class rtl::OUString writerperfect::DocumentHandlerFor::name()",
# only used by OSX build
"void StyleSettings::SetHideDisabledMenuItems(_Bool)",
])
......@@ -87,20 +88,38 @@ for clazz in sorted(definitionSet - callSet - exclusionSet):
or (clazz.find("::Type()") != -1)):
continue
# if this method is const, and there is a non-const variant of it, and the non-const variant is in use, then leave it alone
if (clazz.endswith(" const")
and clazz[6:len(clazz)-6] in definitionSet
and clazz[6:len(clazz)-6] in callSet):
continue
if (clazz.startswith("const ") and clazz.endswith(" const")):
clazz2 = clazz[6:len(clazz)-12]
if (clazz2 in callSet):
continue
elif (clazz.endswith(" const")):
clazz2 = clazz[:len(clazz)-6]
if (clazz2 in callSet):
continue
if (clazz.endswith(" const") and clazz.find("::iterator") != -1):
clazz2 = clazz.replace("::const_iterator", "::iterator")
clazz2 = clazz2[:len(clazz)-6] # strip off " const"
if (clazz2 in callSet):
continue
# if this method is non-const, and there is a const variant of it, and the const variant is in use, then leave it alone
if ((not clazz.endswith(" const"))
and ("const " + clazz + " const") in definitionSet
and ("const " + clazz + " const") in callSet):
if ((not clazz.endswith(" const")) and ("const " + clazz + " const") in callSet):
continue
if ((not clazz.endswith(" const")) and clazz.find("::iterator") != -1):
clazz2 = clazz.replace("::iterator", "::const_iterator") + " const"
if (clazz2 in callSet):
continue
# There is lots of macro magic going on in /home/noel/libo4/include/sax/fshelper.hxx that should be using C++11 varag templates
if clazz.startswith("void sax_fastparser::FastSerializerHelper::"):
continue
# used by Windows build
if clazz.find("DdeTopic::") != -1 or clazz.find("DdeData::") != -1 or clazz.find("DdeService::") != -1:
if (clazz.find("DdeTopic::") != -1
or clazz.find("DdeData::") != -1
or clazz.find("DdeService::") != -1
or clazz.find("DdeTransaction::") != -1
or clazz.find("DdeConnection::") != -1
or clazz.find("DdeLink::") != -1
or clazz.find("DdeItem::") != -1
or clazz.find("DdeGetPutItem::") != -1):
continue
print clazz
......
......@@ -56,13 +56,6 @@ bool SvXMLAttrContainerItem::operator==( const SfxPoolItem& rItem ) const
return *pImpl == *static_cast<const SvXMLAttrContainerItem&>(rItem).pImpl;
}
int SvXMLAttrContainerItem::Compare( const SfxPoolItem &/*rWith*/ ) const
{
DBG_ASSERT( false, "not yet implemented" );
return 0;
}
bool SvXMLAttrContainerItem::GetPresentation(
SfxItemPresentation /*ePresentation*/,
SfxMapUnit /*eCoreMetric*/,
......
......@@ -41,8 +41,6 @@ public:
virtual ~SvXMLAttrContainerItem();
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare( const SfxPoolItem &rWith ) const SAL_OVERRIDE;
virtual bool GetPresentation(
SfxItemPresentation ePresentation,
......
......@@ -42,9 +42,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......@@ -95,9 +92,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......@@ -148,9 +142,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......@@ -201,9 +192,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......
......@@ -49,8 +49,6 @@ public:
void SetValue( const OUString& rNewVal );
using SfxPoolItem::Compare;
virtual bool GetPresentation( SfxItemPresentation ePres,
SfxMapUnit eCoreMetric,
SfxMapUnit ePresMetric,
......
......@@ -46,8 +46,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......
......@@ -50,9 +50,6 @@ public:
bool OverwriteOwnLockFile();
void RemoveFile();
// the methods allow to control whether UI interaction regarding the locked document file is allowed
// this is a workaround for automated tests
static void AllowInteraction( bool bAllow ) { m_bAllowInteraction = bAllow; }
static bool IsInteractionAllowed() { return m_bAllowInteraction; }
};
......
......@@ -88,9 +88,6 @@ public:
// SfxPoolItem
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......
......@@ -26,8 +26,6 @@ public:
virtual bool operator== ( const SfxPoolItem& rItem ) const SAL_OVERRIDE;
virtual int Compare( const SfxPoolItem& r ) const SAL_OVERRIDE;
virtual bool GetPresentation(
SfxItemPresentation, SfxMapUnit, SfxMapUnit,
OUString& rText, const IntlWrapper* pIntlWrapper = NULL ) const SAL_OVERRIDE;
......
......@@ -59,9 +59,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......
......@@ -169,7 +169,6 @@ public:
virtual bool operator==( const SfxPoolItem& ) const = 0;
bool operator!=( const SfxPoolItem& rItem ) const
{ return !(*this == rItem); }
virtual int Compare( const SfxPoolItem &rWith ) const;
/** @return true if it has a valid string representation */
virtual bool GetPresentation( SfxItemPresentation ePresentation,
......
......@@ -75,7 +75,6 @@ class SVL_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject
{
private:
friend class SfxStyleSheetBasePool;
SVL_DLLPRIVATE static SfxStyleSheetBasePool& implGetStaticPool();
protected:
SfxStyleSheetBasePool* pPool; // related pool
......@@ -218,8 +217,6 @@ public:
SfxStyleSheetBasePool( SfxItemPool& );
SfxStyleSheetBasePool( const SfxStyleSheetBasePool& );
const OUString& GetAppName() const { return aAppName; }
SfxItemPool& GetPool() { return rPool;}
const SfxItemPool& GetPool() const { return rPool;}
......
......@@ -47,9 +47,6 @@ public:
virtual bool operator ==(const SfxPoolItem & rItem) const SAL_OVERRIDE;
using SfxPoolItem::Compare;
virtual int Compare(const SfxPoolItem & rWith) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
OUString & rText,
......
......@@ -164,14 +164,6 @@ bool SfxBoolItem::operator ==(const SfxPoolItem & rItem) const
return m_bValue == static_cast< SfxBoolItem const * >(&rItem)->m_bValue;
}
// virtual
int SfxBoolItem::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(rWith.ISA(SfxBoolItem), "SfxBoolItem::Compare(): Bad type");
return (m_bValue == static_cast<SfxBoolItem const*>(&rWith)->m_bValue) ?
0 : m_bValue ? -1 : 1;
}
// virtual
bool SfxBoolItem::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......
......@@ -32,17 +32,6 @@ bool CntByteItem::operator ==(const SfxPoolItem & rItem) const
return m_nValue == (static_cast< const CntByteItem * >(&rItem))->m_nValue;
}
// virtual
int CntByteItem::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type");
return (static_cast< const CntByteItem * >(&rWith))->m_nValue < m_nValue ?
-1 :
(static_cast< const CntByteItem * >(&rWith))->m_nValue
== m_nValue ?
0 : 1;
}
// virtual
bool CntByteItem::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......@@ -115,19 +104,6 @@ bool CntUInt16Item::operator ==(const SfxPoolItem & rItem) const
m_nValue;
}
// virtual
int CntUInt16Item::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(rWith.ISA(CntUInt16Item),
"CntUInt16Item::Compare(): Bad type");
return (static_cast< const CntUInt16Item * >(&rWith))->m_nValue
< m_nValue ?
-1 :
(static_cast< const CntUInt16Item * >(&rWith))->m_nValue
== m_nValue ?
0 : 1;
}
// virtual
bool CntUInt16Item::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......@@ -199,18 +175,6 @@ bool CntInt32Item::operator ==(const SfxPoolItem & rItem) const
m_nValue;
}
// virtual
int CntInt32Item::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type");
return (static_cast< const CntInt32Item * >(&rWith))->m_nValue
< m_nValue ?
-1 :
(static_cast< const CntInt32Item * >(&rWith))->m_nValue
== m_nValue ?
0 : 1;
}
// virtual
bool CntInt32Item::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......@@ -281,19 +245,6 @@ bool CntUInt32Item::operator ==(const SfxPoolItem & rItem) const
m_nValue;
}
// virtual
int CntUInt32Item::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(rWith.ISA(CntUInt32Item),
"CntUInt32Item::operator ==(): Bad type");
return (static_cast< const CntUInt32Item * >(&rWith))->m_nValue
< m_nValue ?
-1 :
(static_cast< const CntUInt32Item * >(&rWith))->m_nValue
== m_nValue ?
0 : 1;
}
// virtual
bool CntUInt32Item::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......
......@@ -36,17 +36,6 @@ bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
m_aValue;
}
// virtual
int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const
{
OSL_FAIL("CntUnencodedStringItem::Compare(): No international");
DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
"CntUnencodedStringItem::Compare(): Bad type");
sal_Int32 nCmp = m_aValue.compareTo(
static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue);
return (nCmp == 0) ? 0 : (nCmp < 0) ? -1 : 1;
}
// virtual
bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit,
SfxMapUnit, OUString & rText,
......
......@@ -33,19 +33,6 @@ bool SfxInt64Item::operator== ( const SfxPoolItem& rItem ) const
return mnValue == static_cast<const SfxInt64Item&>(rItem).mnValue;
}
int SfxInt64Item::Compare( const SfxPoolItem& r ) const
{
sal_Int64 nOther = static_cast<const SfxInt64Item&>(r).mnValue;
if (mnValue < nOther)
return -1;
if (mnValue > nOther)
return 1;
return 0;
}
bool SfxInt64Item::GetPresentation(
SfxItemPresentation, SfxMapUnit, SfxMapUnit, OUString& rText,
const IntlWrapper* /*pIntlWrapper*/ ) const
......
......@@ -58,18 +58,6 @@ bool SfxInt16Item::operator ==(const SfxPoolItem & rItem) const
m_nValue;
}
// virtual
int SfxInt16Item::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type");
return (static_cast< const SfxInt16Item * >(&rWith))->m_nValue
< m_nValue ?
-1 :
(static_cast< const SfxInt16Item * >(&rWith))->m_nValue
== m_nValue ?
0 : 1;
}
// virtual
bool SfxInt16Item::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......
......@@ -123,12 +123,6 @@ SfxPoolItem::~SfxPoolItem()
}
int SfxPoolItem::Compare( const SfxPoolItem& ) const
{
return 0;
}
bool SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
{
return rCmp.Type() == Type();
......
......@@ -40,14 +40,6 @@ bool SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const
m_nValue.bVisible;
}
// virtual
int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const
{
DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type");
return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ?
0 : m_nValue.bVisible ? -1 : 1;
}
// virtual
bool SfxVisibilityItem::GetPresentation(SfxItemPresentation,
SfxMapUnit, SfxMapUnit,
......
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