diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-03 11:47:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-03 15:14:00 +0200 |
commit | f1ec3c675f1fcb04de564861c24f26b2bac4244c (patch) | |
tree | d324611d26b069d29cb5ca9308a997d6b0f853fa /basic/source/inc | |
parent | 6c8128532e5631702ed426ed664807d6e760e195 (diff) |
loplugin:constmethod in basic
Change-Id: Ib2056ab8437e163c7ae42e3ab7a4a3f8b6cb80a2
Reviewed-on: https://gerrit.libreoffice.org/78547
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/inc')
-rw-r--r-- | basic/source/inc/buffer.hxx | 2 | ||||
-rw-r--r-- | basic/source/inc/codegen.hxx | 4 | ||||
-rw-r--r-- | basic/source/inc/dlgcont.hxx | 4 | ||||
-rw-r--r-- | basic/source/inc/expr.hxx | 48 | ||||
-rw-r--r-- | basic/source/inc/image.hxx | 4 | ||||
-rw-r--r-- | basic/source/inc/runtime.hxx | 14 | ||||
-rw-r--r-- | basic/source/inc/sbunoobj.hxx | 26 | ||||
-rw-r--r-- | basic/source/inc/scanner.hxx | 18 | ||||
-rw-r--r-- | basic/source/inc/symtbl.hxx | 10 | ||||
-rw-r--r-- | basic/source/inc/token.hxx | 4 |
10 files changed, 67 insertions, 67 deletions
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx index 525a193566c6..2291e8d0bea8 100644 --- a/basic/source/inc/buffer.hxx +++ b/basic/source/inc/buffer.hxx @@ -45,7 +45,7 @@ public: bool operator += (sal_uInt32); // save integer void operator += (sal_Int32); // save integer char* GetBuffer(); // give out buffer (delete yourself!) - sal_uInt32 GetSize() { return nOff; } + sal_uInt32 GetSize() const { return nOff; } }; #endif diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx index 5a969d1f2cb7..4abf53504295 100644 --- a/basic/source/inc/codegen.hxx +++ b/basic/source/inc/codegen.hxx @@ -45,8 +45,8 @@ public: void BackChain( sal_uInt32 off ) { aCode.Chain( off ); } void Statement(); void GenStmnt(); // create statement-opcode maybe - sal_uInt32 GetPC(); - sal_uInt32 GetOffset() { return GetPC() + 1; } + sal_uInt32 GetPC() const; + sal_uInt32 GetOffset() const { return GetPC() + 1; } void Save(); // #29955 service for-loop-level diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx index 93e917dd1cd2..d138b77ce5e6 100644 --- a/basic/source/inc/dlgcont.hxx +++ b/basic/source/inc/dlgcont.hxx @@ -130,11 +130,11 @@ public: virtual css::uno::Reference< css::resource::XStringResourceResolver > SAL_CALL getStringResource( ) override; - const OUString& getName() + const OUString& getName() const { return m_aName; } const css::uno::Reference< css::resource::XStringResourcePersistence >& - getStringResourcePersistence() + getStringResourcePersistence() const { return m_xStringResourcePersistence; } diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index e0b088ef15d8..d83594c4951f 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -106,10 +106,10 @@ class SbiExprNode final { // operators (and operands) void FoldConstantsBinaryNode(SbiParser*); void FoldConstantsUnaryNode(SbiParser*); void CollectBits(); // converting numbers to strings - bool IsOperand() + bool IsOperand() const { return eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW; } - bool IsNumber(); - bool IsLvalue(); // true, if usable as Lvalue + bool IsNumber() const; + bool IsLvalue() const; // true, if usable as Lvalue void GenElement( SbiCodeGen&, SbiOpcode ); public: @@ -122,22 +122,22 @@ public: SbiExprNode( sal_uInt16 ); // new <type> ~SbiExprNode(); - bool IsValid() { return !bError; } - bool IsConstant() // true: constant operand + bool IsValid() const { return !bError; } + bool IsConstant() const // true: constant operand { return eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL; } void ConvertToIntConstIfPossible(); - bool IsVariable(); + bool IsVariable() const; void SetWithParent( SbiExprNode* p ) { pWithParent = p; } - SbxDataType GetType() { return eType; } + SbxDataType GetType() const { return eType; } void SetType( SbxDataType eTp ) { eType = eTp; } - SbiNodeType GetNodeType() { return eNodeType; } + SbiNodeType GetNodeType() const { return eNodeType; } SbiSymDef* GetVar(); SbiSymDef* GetRealVar(); // last variable in x.y.z SbiExprNode* GetRealNode(); // last node in x.y.z - const OUString& GetString() { return aStrVal; } - short GetNumber() { return static_cast<short>(nVal); } + const OUString& GetString() const { return aStrVal; } + short GetNumber() const { return static_cast<short>(nVal); } SbiExprList* GetParameters() { return aVar.pPar; } void Optimize(SbiParser*); // tree matching @@ -180,17 +180,17 @@ public: ~SbiExpression(); OUString& GetName() { return aArgName; } void SetBased() { bBased = true; } - bool IsBased() { return bBased; } + bool IsBased() const { return bBased; } void SetByVal() { bByVal = true; } - bool IsBracket() { return bBracket; } - bool IsValid() { return pExpr->IsValid(); } - bool IsVariable() { return pExpr->IsVariable(); } - bool IsLvalue() { return pExpr->IsLvalue(); } + bool IsBracket() const { return bBracket; } + bool IsValid() const { return pExpr->IsValid(); } + bool IsVariable() const { return pExpr->IsVariable(); } + bool IsLvalue() const { return pExpr->IsLvalue(); } void ConvertToIntConstIfPossible() { pExpr->ConvertToIntConstIfPossible(); } - const OUString& GetString() { return pExpr->GetString(); } + const OUString& GetString() const { return pExpr->GetString(); } SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); } SbiExprNode* GetExprNode() { return pExpr.get(); } - SbxDataType GetType() { return pExpr->GetType(); } + SbxDataType GetType() const { return pExpr->GetType(); } void Gen( RecursiveMode eRecMode = UNDEFINED ); }; @@ -200,9 +200,9 @@ class SbiConstExpression : public SbiExpression { SbxDataType eType; public: // numeric constant SbiConstExpression( SbiParser* ); - SbxDataType GetType() { return eType; } - const OUString& GetString() { return aVal; } - double GetValue() { return nVal; } + SbxDataType GetType() const { return eType; } + const OUString& GetString() const { return aVal; } + double GetValue() const { return nVal; } short GetShortValue(); }; @@ -216,10 +216,10 @@ public: ~SbiExprList(); static SbiExprListPtr ParseParameters(SbiParser*, bool bStandaloneExpression = false, bool bPar = true); static SbiExprListPtr ParseDimList( SbiParser* ); - bool IsBracket() { return bBracket; } - bool IsValid() { return !bError; } - short GetSize() { return aData.size(); } - short GetDims() { return nDim; } + bool IsBracket() const { return bBracket; } + bool IsValid() const { return !bError; } + short GetSize() const { return aData.size(); } + short GetDims() const { return nDim; } SbiExpression* Get( size_t ); void Gen( SbiCodeGen& rGen); // code generation void addExpression( std::unique_ptr<SbiExpression>&& pExpr ); diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx index f286e3e286fb..bc64dc6730d6 100644 --- a/basic/source/inc/image.hxx +++ b/basic/source/inc/image.hxx @@ -81,7 +81,7 @@ public: // nVer is set to version // of image bool Save( SvStream&, sal_uInt32 = B_CURVERSION ); - bool IsError() { return bError; } + bool IsError() const { return bError; } const char* GetCode() const { return pCode.get(); } sal_uInt32 GetCodeSize() const { return nCodeSize; } @@ -89,7 +89,7 @@ public: OUString GetString( short nId ) const; const SbxObject* FindType (const OUString& aTypeName) const; - const SbxArrayRef& GetEnums() { return rEnums; } + const SbxArrayRef& GetEnums() const { return rEnums; } void SetFlag( SbiImageFlags n ) { nFlags |= n; } bool IsFlag( SbiImageFlags n ) const { return bool(nFlags & n); } diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index 754336ea089e..11da4275c77b 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -167,13 +167,13 @@ public: void Abort(); // with current error code void Stop(); - ErrCode const & GetErr() { return nErr; } - const OUString& GetErrorMsg() { return aErrorMsg; } - sal_Int32 GetErl() { return nErl; } + ErrCode const & GetErr() const { return nErr; } + const OUString& GetErrorMsg() const { return aErrorMsg; } + sal_Int32 GetErl() const { return nErl; } void EnableReschedule( bool bEnable ) { bReschedule = bEnable; } - bool IsReschedule() { return bReschedule; } + bool IsReschedule() const { return bReschedule; } void EnableCompatibility( bool bEnable ) { bCompatibility = bEnable; } - bool IsCompatibility() { return bCompatibility; } + bool IsCompatibility() const { return bCompatibility; } ComponentVector_t& getComponentVector() { return ComponentVector; } @@ -343,7 +343,7 @@ class SbiRuntime public: void SetVBAEnabled( bool bEnabled ); bool IsImageFlag( SbiImageFlags n ) const; - sal_uInt16 GetBase(); + sal_uInt16 GetBase() const; sal_Int32 nLine,nCol1,nCol2; SbiRuntime* pNext; // Stack-Chain @@ -359,7 +359,7 @@ public: void block() { bBlocked = true; } void unblock() { bBlocked = false; } SbModule* GetModule() { return pMod; } - BasicDebugFlags GetDebugFlags() { return nFlags; } + BasicDebugFlags GetDebugFlags() const { return nFlags; } void SetDebugFlags( BasicDebugFlags nFl ) { nFlags = nFl; } SbMethod* GetCaller() { return pMeth;} SbxVariable* GetExternalCaller(){ return mpExtCaller; } diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 1116767e34ca..2c38ed5542f4 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -56,7 +56,7 @@ public: css::uno::TypeClass getTypeClass() const; void* getInst(); - bool isEmpty() { return (mnPos == -1); } + bool isEmpty() const { return (mnPos == -1); } css::uno::Any getValue(); void setValue( const css::uno::Any& ); @@ -79,10 +79,10 @@ class SbUnoStructRefObject: public SbxObject void implCreateDbgProperties(); void initMemberCache(); OUString Impl_DumpProperties(); - OUString getDbgObjectName(); + OUString getDbgObjectName() const; public: StructRefInfo getStructMember( const OUString& rMember ); - const StructRefInfo& getStructInfo() { return maMemberInfo; } + const StructRefInfo& getStructInfo() const { return maMemberInfo; } SbUnoStructRefObject( const OUString& aName_, const StructRefInfo& rMemberInfo ); virtual ~SbUnoStructRefObject() override; @@ -133,12 +133,12 @@ public: // give out value css::uno::Any getUnoAny(); - const css::uno::Reference< css::beans::XIntrospectionAccess >& getIntrospectionAccess() { return mxUnoAccess; } - const css::uno::Reference< css::script::XInvocation >& getInvocation() { return mxInvocation; } + const css::uno::Reference< css::beans::XIntrospectionAccess >& getIntrospectionAccess() const { return mxUnoAccess; } + const css::uno::Reference< css::script::XInvocation >& getInvocation() const { return mxInvocation; } void Notify( SfxBroadcaster&, const SfxHint& rHint ) override; - bool isNativeCOMObject() + bool isNativeCOMObject() const { return bNativeCOMObject; } }; typedef tools::SvRef<SbUnoObject> SbUnoObjectRef; @@ -171,7 +171,7 @@ public: const css::uno::Sequence< css::reflection::ParamInfo >& getParamInfos(); - bool isInvocationBased() + bool isInvocationBased() const { return mbInvocation; } }; @@ -195,10 +195,10 @@ public: SbUnoProperty( const OUString& aName_, SbxDataType eSbxType, SbxDataType eRealSbxType, const css::beans::Property& aUnoProp_, sal_Int32 nId_, bool bInvocation, bool bUnoStruct ); - bool isUnoStruct() { return mbUnoStruct; } - bool isInvocationBased() + bool isUnoStruct() const { return mbUnoStruct; } + bool isInvocationBased() const { return mbInvocation; } - SbxDataType getRealType() { return mRealType; } + SbxDataType getRealType() const { return mRealType; } }; // factory class to create uno-structs per DIM AS NEW @@ -227,7 +227,7 @@ public: virtual SbxVariable* Find( const OUString&, SbxClassType ) override; - const css::uno::Reference< css::reflection::XIdlClass >& getUnoClass() { return m_xClass; } + const css::uno::Reference< css::reflection::XIdlClass >& getUnoClass() const { return m_xClass; } }; @@ -271,7 +271,7 @@ public: virtual ~SbUnoServiceCtor() override; virtual SbxInfo* GetInfo() override; - const css::uno::Reference< css::reflection::XServiceConstructorDescription >& getServiceCtorDesc() + const css::uno::Reference< css::reflection::XServiceConstructorDescription >& getServiceCtorDesc() const { return m_xServiceCtorDesc; } }; @@ -299,7 +299,7 @@ public: , mVal( rVal ) {} - const css::uno::Any& getValue() + const css::uno::Any& getValue() const { return mVal; } }; diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx index 5b5b03653b3b..9b03b0adc568 100644 --- a/basic/source/inc/scanner.hxx +++ b/basic/source/inc/scanner.hxx @@ -69,14 +69,14 @@ public: SbiScanner( const OUString&, StarBASIC* = nullptr ); void EnableErrors() { bError = false; } - bool IsHash() { return bHash; } - bool IsCompatible() { return bCompatible; } + bool IsHash() const { return bHash; } + bool IsCompatible() const { return bCompatible; } void SetCompatible( bool b ) { bCompatible = b; } // #118206 - bool IsVBASupportOn() { return bVBASupportOn; } + bool IsVBASupportOn() const { return bVBASupportOn; } bool WhiteSpace() { return bSpaces; } - sal_Int32 GetErrors() { return nErrors; } - sal_Int32 GetLine() { return nLine; } - sal_Int32 GetCol1() { return nCol1; } + sal_Int32 GetErrors() const { return nErrors; } + sal_Int32 GetLine() const { return nLine; } + sal_Int32 GetCol1() const { return nCol1; } void SetCol1( sal_Int32 n ) { nCol1 = n; } StarBASIC* GetBasic() { return pBasic; } void SaveLine() { nSaveLineIdx = nLineIdx; } @@ -86,9 +86,9 @@ public: bool DoesColonFollow(); bool NextSym(); - const OUString& GetSym() { return aSym; } - SbxDataType GetType() { return eScanType; } - double GetDbl() { return nVal; } + const OUString& GetSym() const { return aSym; } + SbxDataType GetType() const { return eScanType; } + double GetDbl() const { return nVal; } }; #endif diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx index 64a11ea814f3..cecfb797da22 100644 --- a/basic/source/inc/symtbl.hxx +++ b/basic/source/inc/symtbl.hxx @@ -136,7 +136,7 @@ public: void SetDefinedAs() { bAs = true; } void SetGlobal(bool b){ bGlobal = b; } void SetDefaultId( sal_uInt16 n ) { nDefaultId = n; } - sal_uInt16 GetDefaultId() { return nDefaultId; } + sal_uInt16 GetDefaultId() const { return nDefaultId; } bool IsOptional() const{ return bOpt; } bool IsParamArray() const{ return bParamArray; } bool IsWithEvents() const{ return bWithEvents; } @@ -188,9 +188,9 @@ public: sal_uInt16 GetLine1() const { return nLine1; } void SetLine2( sal_uInt16 n ) { nLine2 = n; } sal_uInt16 GetLine2() const { return nLine2; } - PropertyMode getPropertyMode() { return mePropMode; } + PropertyMode getPropertyMode() const { return mePropMode; } void setPropertyMode( PropertyMode ePropMode ); - const OUString& GetPropName() { return maPropName; } + const OUString& GetPropName() const { return maPropName; } // Match with a forward-declaration. The parameter names are // compared and the forward declaration is replaced by this @@ -211,8 +211,8 @@ public: virtual SbiConstDef* GetConstDef() override; void Set( double, SbxDataType ); void Set( const OUString& ); - double GetValue() { return nVal; } - const OUString& GetString() { return aVal; } + double GetValue() const { return nVal; } + const OUString& GetString() const { return aVal; } }; diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx index fd991ba1bb6e..5178013172b3 100644 --- a/basic/source/inc/token.hxx +++ b/basic/source/inc/token.hxx @@ -112,8 +112,8 @@ protected: public: SbiTokenizer( const OUString&, StarBASIC* = nullptr ); - bool IsEof() { return bEof; } - bool IsEos() { return bEos; } + bool IsEof() const { return bEof; } + bool IsEos() const { return bEos; } void Push( SbiToken ); const OUString& Symbol( SbiToken ); // reconversion |