loplugin:constmethods in unotools

Change-Id: I13df4e184a826682f34a1d9e974b601397ba4a3d
Reviewed-on: https://gerrit.libreoffice.org/43865
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-10-25 17:12:09 +02:00
parent 084f454e8c
commit d9b6f4fd38
22 changed files with 45 additions and 45 deletions

View File

@@ -104,7 +104,7 @@ public:
~AttachThread(); ~AttachThread();
const rtl::ByteSequence& getTid() throw () { return tid_;} const rtl::ByteSequence& getTid() const throw () { return tid_;}
private: private:
AttachThread(const AttachThread&) = delete; AttachThread(const AttachThread&) = delete;

View File

@@ -66,7 +66,7 @@ public:
Bridge * getBridge() { return pBridge; } Bridge * getBridge() { return pBridge; }
uno_Interface * getUnoI() { return pUnoI; } uno_Interface * getUnoI() { return pUnoI; }
typelib_InterfaceTypeDescription * getTypeDescr() { return pTypeDescr; } typelib_InterfaceTypeDescription * getTypeDescr() { return pTypeDescr; }
const OUString& getOid() { return oid; } const OUString& getOid() const { return oid; }
// non virtual methods called on incoming vtable calls #1, #2 // non virtual methods called on incoming vtable calls #1, #2
void acquireProxy(); void acquireProxy();

View File

@@ -88,7 +88,7 @@ struct ObjectEntry
uno_freeProxyFunc fpFreeProxy ); uno_freeProxyFunc fpFreeProxy );
inline InterfaceEntry * find( inline InterfaceEntry * find(
typelib_InterfaceTypeDescription * pTypeDescr ); typelib_InterfaceTypeDescription * pTypeDescr );
inline sal_Int32 find( void const * iface_ptr, std::size_t pos ); inline sal_Int32 find( void const * iface_ptr, std::size_t pos ) const;
}; };
@@ -211,7 +211,7 @@ inline InterfaceEntry * ObjectEntry::find(
inline sal_Int32 ObjectEntry::find( inline sal_Int32 ObjectEntry::find(
void const * iface_ptr, std::size_t pos ) void const * iface_ptr, std::size_t pos ) const
{ {
std::size_t size = aInterfaces.size(); std::size_t size = aInterfaces.size();
for ( ; pos < size; ++pos ) for ( ; pos < size; ++pos )

View File

@@ -89,8 +89,8 @@ public:
sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; } sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; }
// performance sensitive shortcuts to avoid allocation ... // performance sensitive shortcuts to avoid allocation ...
bool getAsInteger( sal_Int32 nToken, sal_Int32 &rInt); bool getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const;
bool getAsDouble( sal_Int32 nToken, double &rDouble); bool getAsDouble( sal_Int32 nToken, double &rDouble) const;
bool getAsChar( sal_Int32 nToken, const char*& rPos ) const; bool getAsChar( sal_Int32 nToken, const char*& rPos ) const;
// XFastAttributeList // XFastAttributeList

View File

@@ -55,7 +55,7 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtExtendedSecurityOptions : public utl
SvtExtendedSecurityOptions(); SvtExtendedSecurityOptions();
virtual ~SvtExtendedSecurityOptions() override; virtual ~SvtExtendedSecurityOptions() override;
OpenHyperlinkMode GetOpenHyperlinkMode(); OpenHyperlinkMode GetOpenHyperlinkMode() const;
private: private:

View File

@@ -158,11 +158,11 @@ public:
// borrowed from utl::ConfigItem // borrowed from utl::ConfigItem
css::uno::Sequence< OUString > css::uno::Sequence< OUString >
GetNodeNames( const OUString &rNode ); GetNodeNames( const OUString &rNode ) const;
css::uno::Sequence< css::uno::Any > css::uno::Sequence< css::uno::Any >
GetProperties( GetProperties(
const css::uno::Sequence< OUString > &rNames ); const css::uno::Sequence< OUString > &rNames ) const;
bool bool
ReplaceSetProperties( ReplaceSetProperties(
@@ -195,7 +195,7 @@ public:
css::uno::Sequence< OUString > GetDisabledDictionaries() const; css::uno::Sequence< OUString > GetDisabledDictionaries() const;
std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const OUString &rFormatName ); std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const OUString &rFormatName ) const;
// functions returning file URLs to the respective images (if found) and empty string otherwise // functions returning file URLs to the respective images (if found) and empty string otherwise
OUString GetSpellAndGrammarContextSuggestionImage( const OUString &rServiceImplName ) const; OUString GetSpellAndGrammarContextSuggestionImage( const OUString &rServiceImplName ) const;

View File

@@ -99,10 +99,10 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
void scanCurrFormatImpl( const OUString& rCode, void scanCurrFormatImpl( const OUString& rCode,
sal_Int32 nStart, sal_Int32& nSign, sal_Int32 nStart, sal_Int32& nSign,
sal_Int32& nPar, sal_Int32& nNum, sal_Int32& nPar, sal_Int32& nNum,
sal_Int32& nBlank, sal_Int32& nSym ); sal_Int32& nBlank, sal_Int32& nSym ) const;
void getDateOrdersImpl(); void getDateOrdersImpl();
DateOrder scanDateOrderImpl( const OUString& rCode ); DateOrder scanDateOrderImpl( const OUString& rCode ) const;
void getDefaultCalendarImpl(); void getDefaultCalendarImpl();
void getSecondaryCalendarImpl(); void getSecondaryCalendarImpl();

View File

@@ -153,7 +153,7 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtModuleOptions : public utl::detail::
static OUString GetFactoryShortName(EFactory eFactory); static OUString GetFactoryShortName(EFactory eFactory);
OUString GetDefaultModuleName(); OUString GetDefaultModuleName() const;
bool IsMath () const; bool IsMath () const;
bool IsChart () const; bool IsChart () const;

View File

@@ -51,7 +51,7 @@ public:
// ConfigItem methods // ConfigItem methods
bool IsModified(); bool IsModified() const;
void Commit(); void Commit();
/** Add a listener to react on config changes /** Add a listener to react on config changes

View File

@@ -87,7 +87,7 @@ public:
Returns the URL of the tempfile object. Returns the URL of the tempfile object.
If you want to have the system path file name, use the GetFileName() method of this object If you want to have the system path file name, use the GetFileName() method of this object
*/ */
OUString const & GetURL(); OUString const & GetURL() const;
/** /**
Returns the system path name of the tempfile in host notation Returns the system path name of the tempfile in host notation

View File

@@ -220,7 +220,7 @@ public:
const css::lang::Locale& rLocale ); const css::lang::Locale& rLocale );
/* replace back references in the replace string by the sub expressions from the search result */ /* replace back references in the replace string by the sub expressions from the search result */
void ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const css::util::SearchResult& rResult ); void ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const css::util::SearchResult& rResult ) const;
/** Upgrade SearchOptions to SearchOptions2 for places that don't handle /** Upgrade SearchOptions to SearchOptions2 for places that don't handle
SearchOptions2 yet. Better fix your module if you want to support SearchOptions2 yet. Better fix your module if you want to support

View File

@@ -153,7 +153,7 @@ sal_Int32 FastAttributeList::getOptionalValueToken( ::sal_Int32 Token, ::sal_Int
} }
// performance sensitive shortcuts to avoid allocation ... // performance sensitive shortcuts to avoid allocation ...
bool FastAttributeList::getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) bool FastAttributeList::getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const
{ {
rInt = 0; rInt = 0;
for (size_t i = 0; i < maAttributeTokens.size(); ++i) for (size_t i = 0; i < maAttributeTokens.size(); ++i)
@@ -165,7 +165,7 @@ bool FastAttributeList::getAsInteger( sal_Int32 nToken, sal_Int32 &rInt)
return false; return false;
} }
bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) const
{ {
rDouble = 0.0; rDouble = 0.0;
for (size_t i = 0; i < maAttributeTokens.size(); ++i) for (size_t i = 0; i < maAttributeTokens.size(); ++i)

View File

@@ -36,14 +36,14 @@ public:
AccessibleRelationSetHelperImpl(const AccessibleRelationSetHelperImpl& rImpl); AccessibleRelationSetHelperImpl(const AccessibleRelationSetHelperImpl& rImpl);
/// @throws uno::RuntimeException /// @throws uno::RuntimeException
sal_Int32 getRelationCount( ); sal_Int32 getRelationCount() const;
/// @throws lang::IndexOutOfBoundsException /// @throws lang::IndexOutOfBoundsException
/// @throws uno::RuntimeException /// @throws uno::RuntimeException
AccessibleRelation getRelation( sal_Int32 nIndex ); AccessibleRelation getRelation( sal_Int32 nIndex ) const;
/// @throws uno::RuntimeException /// @throws uno::RuntimeException
bool containsRelation( sal_Int16 aRelationType ); bool containsRelation( sal_Int16 aRelationType ) const;
/// @throws uno::RuntimeException /// @throws uno::RuntimeException
AccessibleRelation getRelationByType( sal_Int16 aRelationType ); AccessibleRelation getRelationByType( sal_Int16 aRelationType ) const;
/// @throws uno::RuntimeException /// @throws uno::RuntimeException
void AddRelation(const AccessibleRelation& rRelation); void AddRelation(const AccessibleRelation& rRelation);
@@ -60,26 +60,26 @@ AccessibleRelationSetHelperImpl::AccessibleRelationSetHelperImpl(const Accessibl
{ {
} }
sal_Int32 AccessibleRelationSetHelperImpl::getRelationCount( ) sal_Int32 AccessibleRelationSetHelperImpl::getRelationCount() const
{ {
return maRelations.size(); return maRelations.size();
} }
AccessibleRelation AccessibleRelationSetHelperImpl::getRelation( sal_Int32 nIndex ) AccessibleRelation AccessibleRelationSetHelperImpl::getRelation( sal_Int32 nIndex ) const
{ {
if ((nIndex < 0) || (static_cast<sal_uInt32>(nIndex) >= maRelations.size())) if ((nIndex < 0) || (static_cast<sal_uInt32>(nIndex) >= maRelations.size()))
throw lang::IndexOutOfBoundsException(); throw lang::IndexOutOfBoundsException();
return maRelations[nIndex]; return maRelations[nIndex];
} }
bool AccessibleRelationSetHelperImpl::containsRelation( sal_Int16 aRelationType ) bool AccessibleRelationSetHelperImpl::containsRelation( sal_Int16 aRelationType ) const
{ {
AccessibleRelation defaultRelation; // default is INVALID AccessibleRelation defaultRelation; // default is INVALID
AccessibleRelation relationByType = getRelationByType(aRelationType); AccessibleRelation relationByType = getRelationByType(aRelationType);
return relationByType.RelationType != defaultRelation.RelationType; return relationByType.RelationType != defaultRelation.RelationType;
} }
AccessibleRelation AccessibleRelationSetHelperImpl::getRelationByType( sal_Int16 aRelationType ) AccessibleRelation AccessibleRelationSetHelperImpl::getRelationByType( sal_Int16 aRelationType ) const
{ {
sal_Int32 nCount(getRelationCount()); sal_Int32 nCount(getRelationCount());
sal_Int32 i(0); sal_Int32 i(0);

View File

@@ -113,8 +113,8 @@ public:
/// @throws css::uno::RuntimeException /// @throws css::uno::RuntimeException
static css::uno::Type SAL_CALL getElementType( ); static css::uno::Type SAL_CALL getElementType( );
/// @throws css::uno::RuntimeException /// @throws css::uno::RuntimeException
bool SAL_CALL hasElements( ); bool SAL_CALL hasElements() const;
OUString GetEventName( GlobalEventId nID ); OUString const & GetEventName( GlobalEventId nID ) const;
}; };
@@ -141,7 +141,7 @@ GlobalEventConfig_Impl::~GlobalEventConfig_Impl()
assert(!IsModified()); // should have been committed assert(!IsModified()); // should have been committed
} }
OUString GlobalEventConfig_Impl::GetEventName( GlobalEventId nIndex ) OUString const & GlobalEventConfig_Impl::GetEventName( GlobalEventId nIndex ) const
{ {
return m_supportedEvents[nIndex]; return m_supportedEvents[nIndex];
} }
@@ -306,7 +306,7 @@ Type SAL_CALL GlobalEventConfig_Impl::getElementType( )
return cppu::UnoType<Sequence<beans::PropertyValue>>::get(); return cppu::UnoType<Sequence<beans::PropertyValue>>::get();
} }
bool SAL_CALL GlobalEventConfig_Impl::hasElements( ) bool SAL_CALL GlobalEventConfig_Impl::hasElements() const
{ {
return m_eventBindingHash.empty(); return m_eventBindingHash.empty();
} }

View File

@@ -72,7 +72,7 @@ class SvtExtendedSecurityOptions_Impl : public ConfigItem
virtual void Notify( const Sequence< OUString >& seqPropertyNames ) override; virtual void Notify( const Sequence< OUString >& seqPropertyNames ) override;
SvtExtendedSecurityOptions::OpenHyperlinkMode GetOpenHyperlinkMode() { return m_eOpenHyperlinkMode;} SvtExtendedSecurityOptions::OpenHyperlinkMode GetOpenHyperlinkMode() const { return m_eOpenHyperlinkMode;}
private: private:
virtual void ImplCommit() override; virtual void ImplCommit() override;
@@ -265,7 +265,7 @@ SvtExtendedSecurityOptions::~SvtExtendedSecurityOptions()
// public method // public method
SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpenHyperlinkMode() SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpenHyperlinkMode() const
{ {
MutexGuard aGuard( GetInitMutex() ); MutexGuard aGuard( GetInitMutex() );
return m_pImpl->GetOpenHyperlinkMode(); return m_pImpl->GetOpenHyperlinkMode();

View File

@@ -69,7 +69,7 @@ public:
SvtHistoryOptions_Impl(); SvtHistoryOptions_Impl();
/// Returns the maximum size of the internal lists, ie. the capacity not the size. /// Returns the maximum size of the internal lists, ie. the capacity not the size.
sal_uInt32 GetCapacity(EHistoryType eHistory); sal_uInt32 GetCapacity(EHistoryType eHistory) const;
/// Clear the specified history list. /// Clear the specified history list.
void Clear(EHistoryType eHistory); void Clear(EHistoryType eHistory);
@@ -121,7 +121,7 @@ SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()
} }
} }
sal_uInt32 SvtHistoryOptions_Impl::GetCapacity(EHistoryType eHistory) sal_uInt32 SvtHistoryOptions_Impl::GetCapacity(EHistoryType eHistory) const
{ {
uno::Reference<beans::XPropertySet> xListAccess(m_xCommonXCU, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xListAccess(m_xCommonXCU, uno::UNO_QUERY);

View File

@@ -831,12 +831,12 @@ SvtLinguConfigItem & SvtLinguConfig::GetConfigItem()
return *pCfgItem; return *pCfgItem;
} }
uno::Sequence< OUString > SvtLinguConfig::GetNodeNames( const OUString &rNode ) uno::Sequence< OUString > SvtLinguConfig::GetNodeNames( const OUString &rNode ) const
{ {
return GetConfigItem().GetNodeNames( rNode ); return GetConfigItem().GetNodeNames( rNode );
} }
uno::Sequence< uno::Any > SvtLinguConfig::GetProperties( const uno::Sequence< OUString > &rNames ) uno::Sequence< uno::Any > SvtLinguConfig::GetProperties( const uno::Sequence< OUString > &rNames ) const
{ {
return GetConfigItem().GetProperties(rNames); return GetConfigItem().GetProperties(rNames);
} }
@@ -1008,7 +1008,7 @@ uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const
} }
std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionariesByFormat( std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionariesByFormat(
const OUString &rFormatName ) const OUString &rFormatName ) const
{ {
std::vector< SvtLinguConfigDictionaryEntry > aRes; std::vector< SvtLinguConfigDictionaryEntry > aRes;
if (rFormatName.isEmpty()) if (rFormatName.isEmpty())

View File

@@ -1120,7 +1120,7 @@ css::uno::Sequence < OUString > SvtModuleOptions::GetAllServiceNames()
return m_pImpl->GetAllServiceNames(); return m_pImpl->GetAllServiceNames();
} }
OUString SvtModuleOptions::GetDefaultModuleName() OUString SvtModuleOptions::GetDefaultModuleName() const
{ {
OUString aModule; OUString aModule;
if (m_pImpl->IsModuleInstalled(SvtModuleOptions::EModule::WRITER)) if (m_pImpl->IsModuleInstalled(SvtModuleOptions::EModule::WRITER))

View File

@@ -107,8 +107,8 @@ public:
void SetIgnoreLanguageChange( bool bSet); void SetIgnoreLanguageChange( bool bSet);
bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
const LanguageTag& GetRealLocale() { return m_aRealLocale; } const LanguageTag& GetRealLocale() const { return m_aRealLocale; }
const LanguageTag& GetRealUILocale() { return m_aRealUILocale; } const LanguageTag& GetRealUILocale() const { return m_aRealUILocale; }
}; };
#define ROOTNODE_SYSLOCALE "Setup/L10N" #define ROOTNODE_SYSLOCALE "Setup/L10N"
@@ -555,7 +555,7 @@ SvtSysLocaleOptions::~SvtSysLocaleOptions()
pImpl.reset(); pImpl.reset();
} }
bool SvtSysLocaleOptions::IsModified() bool SvtSysLocaleOptions::IsModified() const
{ {
MutexGuard aGuard( GetMutex() ); MutexGuard aGuard( GetMutex() );
return pImpl->IsModified(); return pImpl->IsModified();

View File

@@ -662,7 +662,7 @@ void LocaleDataWrapper::getCurrSymbolsImpl()
void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode, void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode,
sal_Int32 nStart, sal_Int32& nSign, sal_Int32& nPar, sal_Int32 nStart, sal_Int32& nSign, sal_Int32& nPar,
sal_Int32& nNum, sal_Int32& nBlank, sal_Int32& nSym ) sal_Int32& nNum, sal_Int32& nBlank, sal_Int32& nSym ) const
{ {
nSign = nPar = nNum = nBlank = nSym = -1; nSign = nPar = nNum = nBlank = nSym = -1;
const sal_Unicode* const pStr = rCode.getStr(); const sal_Unicode* const pStr = rCode.getStr();
@@ -901,7 +901,7 @@ DateOrder LocaleDataWrapper::getLongDateOrder() const
return (DateOrder) nLongDateOrder; return (DateOrder) nLongDateOrder;
} }
DateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode ) DateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode ) const
{ {
// Only some european versions were translated, the ones with different // Only some european versions were translated, the ones with different
// keyword combinations are: // keyword combinations are:

View File

@@ -307,7 +307,7 @@ bool TextSearch::SearchBackward( const OUString & rStr, sal_Int32* pStart,
return bRet; return bRet;
} }
void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const SearchResult& rResult ) void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const SearchResult& rResult ) const
{ {
if( rResult.subRegExpressions > 0 ) if( rResult.subRegExpressions > 0 )
{ {

View File

@@ -395,7 +395,7 @@ OUString TempFile::GetFileName() const
return aTmp; return aTmp;
} }
OUString const & TempFile::GetURL() OUString const & TempFile::GetURL() const
{ {
assert(!aName.isEmpty() && "TempFile::GetURL failed: unit test is leaking temp files, add the ucpfile1 component!"); assert(!aName.isEmpty() && "TempFile::GetURL failed: unit test is leaking temp files, add the ucpfile1 component!");
return aName; return aName;