From 2559a2a0567dbc392ceb34057c0dc5078bbb9474 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 21 Oct 2017 18:04:51 +0200 Subject: loplugin:constmethod in cppu,cppuhelper,idlc Change-Id: I9138b7e5d53c30488f99e9f9b9fe3f98c8d6858b Reviewed-on: https://gerrit.libreoffice.org/43583 Tested-by: Jenkins Reviewed-by: Noel Grandin --- idlc/inc/astattribute.hxx | 4 ++-- idlc/inc/astdeclaration.hxx | 4 ++-- idlc/inc/astinterfacemember.hxx | 2 +- idlc/inc/astscope.hxx | 4 ++-- idlc/inc/astservicemember.hxx | 2 +- idlc/inc/aststack.hxx | 2 +- idlc/inc/fehelper.hxx | 6 +++--- idlc/inc/idlc.hxx | 20 ++++++++++---------- idlc/inc/options.hxx | 6 +++--- idlc/source/astdump.cxx | 4 ++-- idlc/source/astscope.cxx | 4 ++-- idlc/source/fehelper.cxx | 2 +- idlc/source/options.cxx | 6 +++--- 13 files changed, 33 insertions(+), 33 deletions(-) (limited to 'idlc') diff --git a/idlc/inc/astattribute.hxx b/idlc/inc/astattribute.hxx index 030f6e12f9de..163578a80031 100644 --- a/idlc/inc/astattribute.hxx +++ b/idlc/inc/astattribute.hxx @@ -86,13 +86,13 @@ public: { return ((m_flags & AF_REMOVABLE) == AF_REMOVABLE); } bool dumpBlob( - typereg::Writer & rBlob, sal_uInt16 index, sal_uInt16 * methodIndex); + typereg::Writer & rBlob, sal_uInt16 index, sal_uInt16 * methodIndex) const; private: void dumpExceptions( typereg::Writer & writer, OUString const & documentation, DeclList const & exceptions, RTMethodMode flags, - sal_uInt16 * methodIndex); + sal_uInt16 * methodIndex) const; const sal_uInt32 m_flags; AstType const * m_pType; diff --git a/idlc/inc/astdeclaration.hxx b/idlc/inc/astdeclaration.hxx index 9cbd8c95e248..8f4293a97cbf 100644 --- a/idlc/inc/astdeclaration.hxx +++ b/idlc/inc/astdeclaration.hxx @@ -68,7 +68,7 @@ public: { return m_localName; } const OString& getScopedName() const { return m_scopedName; } - const OString& getFullName() + const OString& getFullName() const { return m_fullName; } virtual const sal_Char* getRelativName() const { return m_fullName.getStr()+1; } @@ -108,7 +108,7 @@ public: virtual bool dump(RegistryKey& rKey); - bool isPredefined() { return m_bPredefined; } + bool isPredefined() const { return m_bPredefined; } void setPredefined(bool bPredefined); protected: diff --git a/idlc/inc/astinterfacemember.hxx b/idlc/inc/astinterfacemember.hxx index ae381afbb58a..826661fee67e 100644 --- a/idlc/inc/astinterfacemember.hxx +++ b/idlc/inc/astinterfacemember.hxx @@ -33,7 +33,7 @@ public: AstInterface* getRealInterface() { return m_pRealInterface; } - bool isOptional() + bool isOptional() const { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); } private: const sal_uInt32 m_flags; diff --git a/idlc/inc/astscope.hxx b/idlc/inc/astscope.hxx index 3ce546a087ac..30a0f837c0dc 100644 --- a/idlc/inc/astscope.hxx +++ b/idlc/inc/astscope.hxx @@ -42,7 +42,7 @@ public: { return m_declarations.begin(); } DeclList::const_iterator getIteratorEnd() const { return m_declarations.end(); } - sal_uInt16 getNodeCount(NodeType nType); + sal_uInt16 getNodeCount(NodeType nType) const; // Name look up mechanism AstDeclaration* lookupByName(const OString& scopedName); @@ -54,7 +54,7 @@ public: // Look up a predefined type by its ExprType AstDeclaration* lookupPrimitiveType(ExprType type); - AstDeclaration* lookupForAdd(AstDeclaration const * pDecl); + AstDeclaration* lookupForAdd(AstDeclaration const * pDecl) const; protected: AstDeclaration const * getLast() const diff --git a/idlc/inc/astservicemember.hxx b/idlc/inc/astservicemember.hxx index 1254848532fb..d23cda303cc8 100644 --- a/idlc/inc/astservicemember.hxx +++ b/idlc/inc/astservicemember.hxx @@ -33,7 +33,7 @@ public: AstService* getRealService() { return m_pRealService; } - bool isOptional() + bool isOptional() const { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); } private: const sal_uInt32 m_flags; diff --git a/idlc/inc/aststack.hxx b/idlc/inc/aststack.hxx index 8793f918d52a..fa13d7affd92 100644 --- a/idlc/inc/aststack.hxx +++ b/idlc/inc/aststack.hxx @@ -29,7 +29,7 @@ public: AstStack(); ~AstStack(); - sal_uInt32 depth() { return m_top;} + sal_uInt32 depth() const { return m_top;} AstScope* top(); AstScope* bottom(); AstScope* nextToTop(); diff --git a/idlc/inc/fehelper.hxx b/idlc/inc/fehelper.hxx index 8ebc1c9f44ce..d66818dd22ca 100644 --- a/idlc/inc/fehelper.hxx +++ b/idlc/inc/fehelper.hxx @@ -29,9 +29,9 @@ class FeDeclarator final public: FeDeclarator(const OString& name); ~FeDeclarator(); - const OString& getName() + const OString& getName() const { return m_name; } - bool checkType(AstDeclaration const * pType); + bool checkType(AstDeclaration const * pType) const; static AstType const * compose(AstDeclaration const * pDecl); private: OString m_name; @@ -52,7 +52,7 @@ public: delete m_pName; } - NodeType getNodeType() + NodeType getNodeType() const { return m_nodeType; } OString* getName() { return m_pName; } diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx index 2811c6b6b027..83807665e68e 100644 --- a/idlc/inc/idlc.hxx +++ b/idlc/inc/idlc.hxx @@ -54,15 +54,15 @@ public: { return m_pScopes; } AstModule* getRoot() { return m_pRoot; } - const OString& getFileName() + const OString& getFileName() const { return m_fileName; } void setFileName(const OString& fileName) { m_fileName = fileName; addInclude(fileName); } - const OString& getMainFileName() + const OString& getMainFileName() const { return m_mainFileName; } void setMainFileName(const OString& mainFileName) { m_mainFileName = mainFileName; } - const OString& getRealFileName() + const OString& getRealFileName() const { return m_realFileName; } void setRealFileName(const OString& realFileName) { m_realFileName = realFileName; } @@ -77,23 +77,23 @@ public: m_bIsDocValid = true; } OUString processDocumentation(); - bool isInMainFile() + bool isInMainFile() const { return m_bIsInMainfile; } void setInMainfile(bool bInMainfile) { m_bIsInMainfile = bInMainfile; } - sal_uInt32 getErrorCount() + sal_uInt32 getErrorCount() const { return m_errorCount; } void incErrorCount() { m_errorCount++; } - sal_uInt32 getWarningCount() + sal_uInt32 getWarningCount() const { return m_warningCount; } void incWarningCount() { m_warningCount++; } - sal_uInt32 getLineNumber() + sal_uInt32 getLineNumber() const { return m_lineNumber; } - sal_uInt32 getOffsetStart() + sal_uInt32 getOffsetStart() const { return m_offsetStart; } - sal_uInt32 getOffsetEnd() + sal_uInt32 getOffsetEnd() const { return m_offsetEnd; } void setOffset( sal_uInt32 start, sal_uInt32 end) { m_offsetStart = start; m_offsetEnd = end; } @@ -101,7 +101,7 @@ public: { m_lineNumber = lineNumber; } void incLineNumber() { m_lineNumber++; } - ParseState getParseState() + ParseState getParseState() const { return m_parseState; } void setParseState(ParseState parseState) { m_parseState = parseState; } diff --git a/idlc/inc/options.hxx b/idlc/inc/options.hxx index 6cd9080bce92..b97f3a42b84b 100644 --- a/idlc/inc/options.hxx +++ b/idlc/inc/options.hxx @@ -49,11 +49,11 @@ public: static bool badOption(char const * reason, std::string const & rArg); bool setOption(char const * option, std::string const & rArg); - OString prepareHelp(); - OString prepareVersion(); + OString prepareHelp() const; + OString prepareVersion() const; const OString& getProgramName() const { return m_program;} - bool isValid(const OString& option); + bool isValid(const OString& option) const; /// @throws IllegalArgument const OString& getOption(const OString& option); diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx index 34d9a16bf8a6..75e28ea7d789 100644 --- a/idlc/source/astdump.cxx +++ b/idlc/source/astdump.cxx @@ -322,7 +322,7 @@ bool AstService::dump(RegistryKey& rKey) } bool AstAttribute::dumpBlob( - typereg::Writer & rBlob, sal_uInt16 index, sal_uInt16 * methodIndex) + typereg::Writer & rBlob, sal_uInt16 index, sal_uInt16 * methodIndex) const { RTFieldAccess accessMode = RTFieldAccess::INVALID; @@ -383,7 +383,7 @@ bool AstAttribute::dumpBlob( void AstAttribute::dumpExceptions( typereg::Writer & writer, OUString const & documentation, - DeclList const & exceptions, RTMethodMode flags, sal_uInt16 * methodIndex) + DeclList const & exceptions, RTMethodMode flags, sal_uInt16 * methodIndex) const { if (!exceptions.empty()) { OSL_ASSERT(methodIndex != nullptr); diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index c90870ebeeff..86c150fa718f 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -83,7 +83,7 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl) return pDecl; } -sal_uInt16 AstScope::getNodeCount(NodeType nodeType) +sal_uInt16 AstScope::getNodeCount(NodeType nodeType) const { DeclList::const_iterator iter = getIteratorBegin(); DeclList::const_iterator end = getIteratorEnd(); @@ -319,7 +319,7 @@ AstDeclaration* AstScope::lookupPrimitiveType(ExprType type) return nullptr; } -AstDeclaration* AstScope::lookupForAdd(AstDeclaration const * pDecl) +AstDeclaration* AstScope::lookupForAdd(AstDeclaration const * pDecl) const { if ( !pDecl ) return nullptr; diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx index 3a3e5324e303..168cf56fec7f 100644 --- a/idlc/source/fehelper.cxx +++ b/idlc/source/fehelper.cxx @@ -30,7 +30,7 @@ FeDeclarator::~FeDeclarator() { } -bool FeDeclarator::checkType(AstDeclaration const * type) +bool FeDeclarator::checkType(AstDeclaration const * type) const { OString tmp(m_name); sal_Int32 count = m_name.lastIndexOf( ':' ); diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index 58908c9f38ad..92dcb6dbf783 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -368,7 +368,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs) return true; } -OString Options::prepareHelp() +OString Options::prepareHelp() const { OString help("\nusing: "); help += m_program + " [-options] ... | @ | -stdin\n"; @@ -402,7 +402,7 @@ OString Options::prepareHelp() return help; } -OString Options::prepareVersion() +OString Options::prepareVersion() const { OString version(m_program); version += " Version 1.1\n\n"; @@ -410,7 +410,7 @@ OString Options::prepareVersion() } -bool Options::isValid(const OString& option) +bool Options::isValid(const OString& option) const { return (m_options.count(option) > 0); } -- cgit v1.2.3