summaryrefslogtreecommitdiff
path: root/basic/source/sbx/sbxexec.cxx
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2016-02-21 17:51:28 +0100
committerNoel Grandin <noelgrandin@gmail.com>2016-02-22 12:33:52 +0000
commit14420e83296fd393cba956047370564c3517cdae (patch)
tree9c566a9de39f81a85885f565ce46781857fe7956 /basic/source/sbx/sbxexec.cxx
parent1b287f14b2adc79586ae2dde6b08cd8eb960e0ce (diff)
BASIC : Add tools::make_ref and simplify SvRef usage
Change-Id: I8fe846dbd353bace05a8732a9b961f3507d97ef8 Reviewed-on: https://gerrit.libreoffice.org/22587 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic/source/sbx/sbxexec.cxx')
-rw-r--r--basic/source/sbx/sbxexec.cxx31
1 files changed, 9 insertions, 22 deletions
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 0910aef37f26..0465bbeefd25 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -23,7 +23,7 @@
#include <rtl/character.hxx>
-static SbxVariable* Element
+static SbxVariableRef Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType );
@@ -78,7 +78,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym )
// Qualified name. Element.Element....
-static SbxVariable* QualifiedName
+static SbxVariableRef QualifiedName
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, SbxClassType t )
{
@@ -107,15 +107,13 @@ static SbxVariable* QualifiedName
else
SbxBase::SetError( ERRCODE_SBX_SYNTAX );
*ppBuf = p;
- if( refVar.Is() )
- refVar->AddFirstRef();
return refVar;
}
// Read in of an operand. This could be a number, a string or
// a function (with optional parameters).
-static SbxVariable* Operand
+static SbxVariableRef Operand
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, bool bVar )
{
SbxVariableRef refVar( new SbxVariable );
@@ -165,15 +163,13 @@ static SbxVariable* Operand
refVar = QualifiedName( pObj, pGbl, &p, SbxCLASS_DONTCARE );
}
*ppBuf = p;
- if( refVar.Is() )
- refVar->AddFirstRef();
return refVar;
}
// Read in of a simple term. The operands +, -, * and /
// are supported.
-static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
+static SbxVariableRef MulDiv( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
{
const sal_Unicode* p = *ppBuf;
SbxVariableRef refVar( Operand( pObj, pGbl, &p, false ) );
@@ -200,12 +196,10 @@ static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode*
}
}
*ppBuf = p;
- if( refVar.Is() )
- refVar->AddFirstRef();
return refVar;
}
-static SbxVariable* PlusMinus( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
+static SbxVariableRef PlusMinus( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
{
const sal_Unicode* p = *ppBuf;
SbxVariableRef refVar( MulDiv( pObj, pGbl, &p ) );
@@ -232,12 +226,10 @@ static SbxVariable* PlusMinus( SbxObject* pObj, SbxObject* pGbl, const sal_Unico
}
}
*ppBuf = p;
- if( refVar.Is() )
- refVar->AddFirstRef();
return refVar;
}
-static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
+static SbxVariableRef Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
{
const sal_Unicode* p = *ppBuf;
SbxVariableRef refVar( Operand( pObj, pGbl, &p, true ) );
@@ -270,8 +262,6 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode*
refVar->Broadcast( SBX_HINT_DATAWANTED );
}
*ppBuf = p;
- if( refVar.Is() )
- refVar->AddFirstRef();
return refVar;
}
@@ -279,7 +269,7 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode*
// by a parameter list. The symbol will be searched in the
// specified object and the parameter list will be attached if necessary.
-static SbxVariable* Element
+static SbxVariableRef Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType t )
{
@@ -303,7 +293,7 @@ static SbxVariable* Element
if( *p == '(' )
{
p++;
- SbxArrayRef refPar = new SbxArray;
+ auto refPar = tools::make_ref<SbxArray>();
sal_uInt16 nArg = 0;
// We are once relaxed and accept as well
// the line- or commandend as delimiter
@@ -321,8 +311,7 @@ static SbxVariable* Element
// One copies the parameter, so that
// one have the current status (triggers also
// the call per access)
- SbxVariable* pArg = refArg;
- refPar->Put( new SbxVariable( *pArg ), ++nArg );
+ refPar->Put( new SbxVariable( *(refArg.get()) ), ++nArg );
}
p = SkipWhitespace( p );
if( *p == ',' )
@@ -338,8 +327,6 @@ static SbxVariable* Element
SbxBase::SetError( ERRCODE_SBX_NO_METHOD );
}
*ppBuf = p;
- if( refVar.Is() )
- refVar->AddFirstRef();
return refVar;
}