From b9fd0d1c42686fed09ec8781780a8ffc61198bcf Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 25 Oct 2017 16:43:05 +0200 Subject: loplugin:constmethod in svl Change-Id: If92869e19c413e11f1f299a97f96b9637aaba65d Reviewed-on: https://gerrit.libreoffice.org/43864 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svl/source/items/style.cxx | 2 +- svl/source/misc/filenotation.cxx | 2 +- svl/source/misc/inethist.cxx | 4 ++-- svl/source/misc/lockfilecommon.cxx | 2 +- svl/source/misc/ownlist.cxx | 2 +- svl/source/numbers/zforfind.cxx | 20 ++++++++++---------- svl/source/numbers/zforfind.hxx | 20 ++++++++++---------- svl/source/numbers/zforlist.cxx | 10 +++++----- svl/source/numbers/zformat.cxx | 8 ++++---- svl/source/numbers/zforscan.cxx | 20 ++++++++++---------- svl/source/numbers/zforscan.hxx | 22 +++++++++++----------- 11 files changed, 56 insertions(+), 56 deletions(-) (limited to 'svl') diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index ec5de87916e8..281a4d8d8472 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -368,7 +368,7 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const return nSearchFamily; } -inline bool SfxStyleSheetIterator::IsTrivialSearch() +inline bool SfxStyleSheetIterator::IsTrivialSearch() const { return (( nMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE) && (GetSearchFamily() == SfxStyleFamily::All); diff --git a/svl/source/misc/filenotation.cxx b/svl/source/misc/filenotation.cxx index e99415de09a3..bc3f5ccf946c 100644 --- a/svl/source/misc/filenotation.cxx +++ b/svl/source/misc/filenotation.cxx @@ -105,7 +105,7 @@ namespace svt OSL_ENSURE( bSuccess, "OFileNotation::OFileNotation: could not detect the format!" ); } - OUString OFileNotation::get(NOTATION _eOutputNotation) + OUString OFileNotation::get(NOTATION _eOutputNotation) const { switch (_eOutputNotation) { diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index 9dd95296c354..3c302e43447b 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -155,7 +155,7 @@ public: /** putUrl/queryUrl. */ void putUrl (const OUString &rUrl); - bool queryUrl (const OUString &rUrl); + bool queryUrl (const OUString &rUrl) const; }; INetURLHistory_Impl::INetURLHistory_Impl() @@ -272,7 +272,7 @@ void INetURLHistory_Impl::putUrl (const OUString &rUrl) } } -bool INetURLHistory_Impl::queryUrl (const OUString &rUrl) +bool INetURLHistory_Impl::queryUrl (const OUString &rUrl) const { sal_uInt32 h = crc32 (rUrl); sal_uInt16 k = find (h); diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index 7949f7213cb0..6768b7b07f87 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -73,7 +73,7 @@ LockFileCommon::~LockFileCommon() } -INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) +INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) const { if ( aDocURL.HasError() ) throw lang::IllegalArgumentException(); diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx index 7d2b926ebe12..572bd39f7a8d 100644 --- a/svl/source/misc/ownlist.cxx +++ b/svl/source/misc/ownlist.cxx @@ -52,7 +52,7 @@ void SvCommandList::FillFromSequence( const css::uno::Sequence < css::beans::Pro } } -void SvCommandList::FillSequence( css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence ) +void SvCommandList::FillSequence( css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence ) const { const sal_Int32 nCount = aCommandList.size(); aCommandSequence.realloc( nCount ); diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index c051dd5d9053..83c37af79c2e 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -289,7 +289,7 @@ bool ImpSvNumberInputScan::NextNumberStringSymbol( const sal_Unicode*& pStr, // near SV_MAX_COUNT_INPUT_STRINGS, in NumberStringDivision(). bool ImpSvNumberInputScan::SkipThousands( const sal_Unicode*& pStr, - OUString& rSymbol ) + OUString& rSymbol ) const { bool res = false; OUStringBuffer sBuff(rSymbol); @@ -427,7 +427,7 @@ bool ImpSvNumberInputScan::StringPtrContainsImpl( const OUString& rWhat, * Whether rString contains word rWhat at nPos */ bool ImpSvNumberInputScan::StringContainsWord( const OUString& rWhat, - const OUString& rString, sal_Int32 nPos ) + const OUString& rString, sal_Int32 nPos ) const { if (rWhat.isEmpty() || rString.getLength() < nPos + rWhat.getLength()) return false; @@ -535,7 +535,7 @@ inline bool ImpSvNumberInputScan::SkipString( const OUString& rWhat, */ inline bool ImpSvNumberInputScan::GetThousandSep( const OUString& rString, sal_Int32& nPos, - sal_uInt16 nStringPos ) + sal_uInt16 nStringPos ) const { const OUString& rSep = pFormatter->GetNumThousandSep(); // Is it an ordinary space instead of a no-break space? @@ -574,7 +574,7 @@ inline bool ImpSvNumberInputScan::GetThousandSep( const OUString& rString, * "false"=> -1: * else => 0: */ -short ImpSvNumberInputScan::GetLogical( const OUString& rString ) +short ImpSvNumberInputScan::GetLogical( const OUString& rString ) const { short res; @@ -784,7 +784,7 @@ bool ImpSvNumberInputScan::GetTimeAmPm( const OUString& rString, sal_Int32& nPos * ',' => true * else => false */ -inline bool ImpSvNumberInputScan::GetDecSep( const OUString& rString, sal_Int32& nPos ) +inline bool ImpSvNumberInputScan::GetDecSep( const OUString& rString, sal_Int32& nPos ) const { if ( rString.getLength() > nPos ) { @@ -802,7 +802,7 @@ inline bool ImpSvNumberInputScan::GetDecSep( const OUString& rString, sal_Int32& /** * Reading a hundredth seconds separator */ -inline bool ImpSvNumberInputScan::GetTime100SecSep( const OUString& rString, sal_Int32& nPos ) +inline bool ImpSvNumberInputScan::GetTime100SecSep( const OUString& rString, sal_Int32& nPos ) const { if ( rString.getLength() > nPos ) { @@ -888,7 +888,7 @@ short ImpSvNumberInputScan::GetESign( const OUString& rString, sal_Int32& nPos ) * i counts string portions, j counts numbers thereof. * It should had been called SkipNumber instead. */ -inline bool ImpSvNumberInputScan::GetNextNumber( sal_uInt16& i, sal_uInt16& j ) +inline bool ImpSvNumberInputScan::GetNextNumber( sal_uInt16& i, sal_uInt16& j ) const { if ( i < nStringsCnt && IsNum[i] ) { @@ -902,7 +902,7 @@ inline bool ImpSvNumberInputScan::GetNextNumber( sal_uInt16& i, sal_uInt16& j ) bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, sal_uInt16 nIndex, // j-value of the first numeric time part of input, default 0 - sal_uInt16 nCnt ) // count of numeric time parts + sal_uInt16 nCnt ) const // count of numeric time parts { bool bRet = true; sal_uInt16 nHour; @@ -961,7 +961,7 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } -sal_uInt16 ImpSvNumberInputScan::ImplGetDay( sal_uInt16 nIndex ) +sal_uInt16 ImpSvNumberInputScan::ImplGetDay( sal_uInt16 nIndex ) const { sal_uInt16 nRes = 0; @@ -978,7 +978,7 @@ sal_uInt16 ImpSvNumberInputScan::ImplGetDay( sal_uInt16 nIndex ) } -sal_uInt16 ImpSvNumberInputScan::ImplGetMonth( sal_uInt16 nIndex ) +sal_uInt16 ImpSvNumberInputScan::ImplGetMonth( sal_uInt16 nIndex ) const { // Preset invalid month number sal_uInt16 nRes = pFormatter->GetCalendar()->getNumberOfMonthsInYear(); diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx index 8dff9a68c81e..c257eed70608 100644 --- a/svl/source/numbers/zforfind.hxx +++ b/svl/source/numbers/zforfind.hxx @@ -194,7 +194,7 @@ private: // Concatenate ,000,23 blocks // in input to 000123 - bool SkipThousands( const sal_Unicode*& pStr, OUString& rSymbol ); + bool SkipThousands( const sal_Unicode*& pStr, OUString& rSymbol ) const; // Divide numbers/strings into // arrays and variables above. @@ -208,7 +208,7 @@ private: */ bool StringContainsWord( const OUString& rWhat, const OUString& rString, - sal_Int32 nPos ); + sal_Int32 nPos ) const; // optimized substring versions @@ -268,9 +268,9 @@ private: // Recognizes exactly ,111 as group separator inline bool GetThousandSep( const OUString& rString, sal_Int32& nPos, - sal_uInt16 nStringPos ); + sal_uInt16 nStringPos ) const; // Get boolean value - short GetLogical( const OUString& rString ); + short GetLogical( const OUString& rString ) const; // Get month and advance string position short GetMonth( const OUString& rString, @@ -291,11 +291,11 @@ private: // Get decimal separator and advance string position inline bool GetDecSep( const OUString& rString, - sal_Int32& nPos ); + sal_Int32& nPos ) const; // Get hundredth seconds separator and advance string position inline bool GetTime100SecSep( const OUString& rString, - sal_Int32& nPos ); + sal_Int32& nPos ) const; // Get sign and advance string position // Including special case '(' @@ -308,7 +308,7 @@ private: // Get next number as array offset inline bool GetNextNumber( sal_uInt16& i, - sal_uInt16& j ); + sal_uInt16& j ) const; /** Converts time -> double (only decimals) @@ -316,9 +316,9 @@ private: */ bool GetTimeRef( double& fOutNumber, // result as double sal_uInt16 nIndex, // Index of hour in input - sal_uInt16 nCnt ); // Count of time substrings in input - sal_uInt16 ImplGetDay ( sal_uInt16 nIndex ); // Day input, 0 if no match - sal_uInt16 ImplGetMonth( sal_uInt16 nIndex ); // Month input, zero based return, NumberOfMonths if no match + sal_uInt16 nCnt ) const; // Count of time substrings in input + sal_uInt16 ImplGetDay ( sal_uInt16 nIndex ) const; // Day input, 0 if no match + sal_uInt16 ImplGetMonth( sal_uInt16 nIndex ) const; // Month input, zero based return, NumberOfMonths if no match sal_uInt16 ImplGetYear ( sal_uInt16 nIndex ); // Year input, 0 if no match // Conversion of date to number diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 720070d869c6..94912797057c 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -175,7 +175,7 @@ public: void Remove( SvNumberFormatter const * pThis ); - size_t Count() + size_t Count() const { return aFormatters.size(); } virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override; @@ -395,7 +395,7 @@ void SvNumberFormatter::ChangeNullDate(sal_uInt16 nDay, pStringScanner->ChangeNullDate(nDay, nMonth, nYear); } -const Date& SvNumberFormatter::GetNullDate() +const Date& SvNumberFormatter::GetNullDate() const { return pFormatScanner->GetNullDate(); } @@ -410,12 +410,12 @@ void SvNumberFormatter::SetNoZero(bool bNZ) bNoZero = bNZ; } -sal_uInt16 SvNumberFormatter::GetStandardPrec() +sal_uInt16 SvNumberFormatter::GetStandardPrec() const { return pFormatScanner->GetStandardPrec(); } -bool SvNumberFormatter::GetNoZero() +bool SvNumberFormatter::GetNoZero() const { return bNoZero; } @@ -2768,7 +2768,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, } -sal_Int32 SvNumberFormatter::ImpPosToken ( const OUStringBuffer & sFormat, sal_Unicode token, sal_Int32 nStartPos /* = 0*/ ) +sal_Int32 SvNumberFormatter::ImpPosToken ( const OUStringBuffer & sFormat, sal_Unicode token, sal_Int32 nStartPos /* = 0*/ ) const { sal_Int32 nLength = sFormat.getLength(); for ( sal_Int32 i=nStartPos; i=0 ; i++ ) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 9d2700e6a185..34121edce041 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1566,7 +1566,7 @@ static bool lcl_matchKeywordAndGetNumber( const OUString & rString, const sal_In short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, sal_Int32& nPos, - OUString& sSymbol) + OUString& sSymbol) const { short eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; sal_Unicode cToken; @@ -1967,14 +1967,14 @@ OUString SvNumberformat::StripNewCurrencyDelimiters( const OUString& rStr, return aTmp; } -void SvNumberformat::ImpGetOutputStandard(double& fNumber, OUStringBuffer& rOutString) +void SvNumberformat::ImpGetOutputStandard(double& fNumber, OUStringBuffer& rOutString) const { OUString sTemp; ImpGetOutputStandard(fNumber, sTemp); rOutString = sTemp; } -void SvNumberformat::ImpGetOutputStandard(double& fNumber, OUString& rOutString) +void SvNumberformat::ImpGetOutputStandard(double& fNumber, OUString& rOutString) const { sal_uInt16 nStandardPrec = rScan.GetStandardPrec(); @@ -2012,7 +2012,7 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, OUString& rOutS rOutString = impTransliterate(rOutString, NumFor[0].GetNatNum()); } -void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString) +void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString) const { bool bModified = false; if ( (eType & css::util::NumberFormat::PERCENT) && (fabs(fNumber) < D_MAX_D_BY_100)) diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index cbb71aa47733..e5e2b7dc83ff 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -585,7 +585,7 @@ Color* ImpSvNumberformatScan::GetColor(OUString& sStr) return pResult; } -short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos ) +short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos ) const { OUString sString = pFormatter->GetCharClass()->uppercase( sSymbol, nPos, sSymbol.getLength() - nPos ); const NfKeywordTable & rKeyword = GetKeywords(); @@ -761,7 +761,7 @@ enum ScanState short ImpSvNumberformatScan::Next_Symbol( const OUString& rStr, sal_Int32& nPos, - OUString& sSymbol ) + OUString& sSymbol ) const { InitKeywords(); const CharClass* pChrCls = pFormatter->GetCharClass(); @@ -1065,7 +1065,7 @@ sal_Int32 ImpSvNumberformatScan::Symbol_Division(const OUString& rString) return 0; // 0 => ok } -void ImpSvNumberformatScan::SkipStrings(sal_uInt16& i, sal_Int32& nPos) +void ImpSvNumberformatScan::SkipStrings(sal_uInt16& i, sal_Int32& nPos) const { while (i < nStringsCnt && ( nTypeArray[i] == NF_SYMBOLTYPE_STRING || nTypeArray[i] == NF_SYMBOLTYPE_BLANK @@ -1076,7 +1076,7 @@ void ImpSvNumberformatScan::SkipStrings(sal_uInt16& i, sal_Int32& nPos) } } -sal_uInt16 ImpSvNumberformatScan::PreviousKeyword(sal_uInt16 i) +sal_uInt16 ImpSvNumberformatScan::PreviousKeyword(sal_uInt16 i) const { short res = 0; if (i > 0 && i < nStringsCnt) @@ -1094,7 +1094,7 @@ sal_uInt16 ImpSvNumberformatScan::PreviousKeyword(sal_uInt16 i) return res; } -sal_uInt16 ImpSvNumberformatScan::NextKeyword(sal_uInt16 i) +sal_uInt16 ImpSvNumberformatScan::NextKeyword(sal_uInt16 i) const { short res = 0; if (i < nStringsCnt-1) @@ -1112,7 +1112,7 @@ sal_uInt16 ImpSvNumberformatScan::NextKeyword(sal_uInt16 i) return res; } -short ImpSvNumberformatScan::PreviousType( sal_uInt16 i ) +short ImpSvNumberformatScan::PreviousType( sal_uInt16 i ) const { if ( i > 0 && i < nStringsCnt ) { @@ -1126,7 +1126,7 @@ short ImpSvNumberformatScan::PreviousType( sal_uInt16 i ) return 0; } -sal_Unicode ImpSvNumberformatScan::PreviousChar(sal_uInt16 i) +sal_Unicode ImpSvNumberformatScan::PreviousChar(sal_uInt16 i) const { sal_Unicode res = ' '; if (i > 0 && i < nStringsCnt) @@ -1148,7 +1148,7 @@ sal_Unicode ImpSvNumberformatScan::PreviousChar(sal_uInt16 i) return res; } -sal_Unicode ImpSvNumberformatScan::NextChar(sal_uInt16 i) +sal_Unicode ImpSvNumberformatScan::NextChar(sal_uInt16 i) const { sal_Unicode res = ' '; if (i < nStringsCnt-1) @@ -1170,7 +1170,7 @@ sal_Unicode ImpSvNumberformatScan::NextChar(sal_uInt16 i) return res; } -bool ImpSvNumberformatScan::IsLastBlankBeforeFrac(sal_uInt16 i) +bool ImpSvNumberformatScan::IsLastBlankBeforeFrac(sal_uInt16 i) const { bool res = true; if (i < nStringsCnt-1) @@ -1224,7 +1224,7 @@ void ImpSvNumberformatScan::Reset() nNatNumModifier = 0; } -bool ImpSvNumberformatScan::Is100SecZero( sal_uInt16 i, bool bHadDecSep ) +bool ImpSvNumberformatScan::Is100SecZero( sal_uInt16 i, bool bHadDecSep ) const { sal_uInt16 nIndexPre = PreviousKeyword( i ); return (nIndexPre == NF_KEY_S || nIndexPre == NF_KEY_SS) && diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index ed3e15feb2db..77c16ab1db4c 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -209,31 +209,31 @@ private: // Private section void SetDependentKeywords(); // Sets the language dependent keywords - void SkipStrings(sal_uInt16& i, sal_Int32& nPos);// Skips StringSymbols - sal_uInt16 PreviousKeyword(sal_uInt16 i); // Returns index of the preceding one + void SkipStrings(sal_uInt16& i, sal_Int32& nPos) const;// Skips StringSymbols + sal_uInt16 PreviousKeyword(sal_uInt16 i) const; // Returns index of the preceding one // Keyword or 0 - sal_uInt16 NextKeyword(sal_uInt16 i); // Returns index of the next one + sal_uInt16 NextKeyword(sal_uInt16 i) const; // Returns index of the next one // Keyword or 0 - sal_Unicode PreviousChar(sal_uInt16 i); // Returns last char before index skips EMPTY, STRING, STAR, BLANK - sal_Unicode NextChar(sal_uInt16 i); // Returns first following char - short PreviousType( sal_uInt16 i ); // Returns type before position skips EMPTY - bool IsLastBlankBeforeFrac(sal_uInt16 i); // True <=> there won't be a ' ' until the '/' + sal_Unicode PreviousChar(sal_uInt16 i) const; // Returns last char before index skips EMPTY, STRING, STAR, BLANK + sal_Unicode NextChar(sal_uInt16 i) const; // Returns first following char + short PreviousType( sal_uInt16 i ) const; // Returns type before position skips EMPTY + bool IsLastBlankBeforeFrac(sal_uInt16 i) const; // True <=> there won't be a ' ' until the '/' void Reset(); // Reset all variables before starting the analysis short GetKeyWord( const OUString& sSymbol, // Determine keyword at nPos - sal_Int32 nPos ); // Return 0 <=> not found + sal_Int32 nPos ) const; // Return 0 <=> not found - bool IsAmbiguousE( short nKey ) // whether nKey is ambiguous E of NF_KEY_E/NF_KEY_EC + bool IsAmbiguousE( short nKey ) const // whether nKey is ambiguous E of NF_KEY_E/NF_KEY_EC { return (nKey == NF_KEY_EC || nKey == NF_KEY_E) && (GetKeywords()[NF_KEY_EC] == GetKeywords()[NF_KEY_E]); } // if 0 at strArray[i] is of S,00 or SS,00 or SS"any"00 in ScanType() or FinalScan() - bool Is100SecZero( sal_uInt16 i, bool bHadDecSep ); + bool Is100SecZero( sal_uInt16 i, bool bHadDecSep ) const; short Next_Symbol(const OUString& rStr, sal_Int32& nPos, - OUString& sSymbol); // Next Symbol + OUString& sSymbol) const; // Next Symbol sal_Int32 Symbol_Division(const OUString& rString);// Initial lexical scan sal_Int32 ScanType(); // Analysis of the Format type sal_Int32 FinalScan( OUString& rString ); // Final analysis with supplied type -- cgit