Kaydet (Commit) bb52f5b2 authored tarafından Arnaud Versini's avatar Arnaud Versini Kaydeden (comit) Markus Mohrhard

Use local utility functions instead of SbxSimpleCharClass

Change-Id: I7c4bc8cc44c0b4e78feb55dcd2c15b82c414e0ef
Reviewed-on: https://gerrit.libreoffice.org/3132Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 5ed1dbb5
...@@ -22,32 +22,29 @@ ...@@ -22,32 +22,29 @@
#include <basic/sbx.hxx> #include <basic/sbx.hxx>
class SbxSimpleCharClass
static bool isAlpha( sal_Unicode c )
{ {
public: bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
bool isAlpha( sal_Unicode c ) const return bRet;
{ }
bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
return bRet;
}
bool isDigit( sal_Unicode c ) const static bool isDigit( sal_Unicode c )
{ {
bool bRet = (c >= '0' && c <= '9'); bool bRet = (c >= '0' && c <= '9');
return bRet; return bRet;
} }
bool isAlphaNumeric( sal_Unicode c ) const static bool isAlphaNumeric( sal_Unicode c )
{ {
bool bRet = isDigit( c ) || isAlpha( c ); bool bRet = isDigit( c ) || isAlpha( c );
return bRet; return bRet;
} }
};
static SbxVariable* Element static SbxVariable* Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType, const SbxSimpleCharClass& rCharClass ); SbxClassType );
static const sal_Unicode* SkipWhitespace( const sal_Unicode* p ) static const sal_Unicode* SkipWhitespace( const sal_Unicode* p )
{ {
...@@ -59,7 +56,7 @@ static const sal_Unicode* SkipWhitespace( const sal_Unicode* p ) ...@@ -59,7 +56,7 @@ static const sal_Unicode* SkipWhitespace( const sal_Unicode* p )
// Scanning of a symbol. The symbol were inserted in rSym, the return value // Scanning of a symbol. The symbol were inserted in rSym, the return value
// is the new scan position. The symbol is at errors empty. // is the new scan position. The symbol is at errors empty.
static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const SbxSimpleCharClass& rCharClass ) static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym )
{ {
sal_uInt16 nLen = 0; sal_uInt16 nLen = 0;
// Did we have a nonstandard symbol? // Did we have a nonstandard symbol?
...@@ -75,7 +72,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const Sb ...@@ -75,7 +72,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const Sb
else else
{ {
// A symbol had to begin with a alphabetic character or an underline // A symbol had to begin with a alphabetic character or an underline
if( !rCharClass.isAlpha( *p ) && *p != '_' ) if( !isAlpha( *p ) && *p != '_' )
{ {
SbxBase::SetError( SbxERR_SYNTAX ); SbxBase::SetError( SbxERR_SYNTAX );
} }
...@@ -83,7 +80,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const Sb ...@@ -83,7 +80,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const Sb
{ {
rSym = p; rSym = p;
// The it can contain alphabetic characters, numbers or underlines // The it can contain alphabetic characters, numbers or underlines
while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') ) while( *p && (isAlphaNumeric( *p ) || *p == '_') )
{ {
p++, nLen++; p++, nLen++;
} }
...@@ -103,14 +100,13 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const Sb ...@@ -103,14 +100,13 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const Sb
static SbxVariable* QualifiedName static SbxVariable* QualifiedName
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, SbxClassType t ) ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, SbxClassType t )
{ {
static SbxSimpleCharClass aCharClass;
SbxVariableRef refVar; SbxVariableRef refVar;
const sal_Unicode* p = SkipWhitespace( *ppBuf ); const sal_Unicode* p = SkipWhitespace( *ppBuf );
if( aCharClass.isAlpha( *p ) || *p == '_' || *p == '[' ) if( isAlpha( *p ) || *p == '_' || *p == '[' )
{ {
// Read in the element // Read in the element
refVar = Element( pObj, pGbl, &p, t, aCharClass ); refVar = Element( pObj, pGbl, &p, t );
while( refVar.Is() && (*p == '.' || *p == '!') ) while( refVar.Is() && (*p == '.' || *p == '!') )
{ {
// It follows still an objectelement. The current element // It follows still an objectelement. The current element
...@@ -124,7 +120,7 @@ static SbxVariable* QualifiedName ...@@ -124,7 +120,7 @@ static SbxVariable* QualifiedName
break; break;
p++; p++;
// And the next element please // And the next element please
refVar = Element( pObj, pGbl, &p, t, aCharClass ); refVar = Element( pObj, pGbl, &p, t );
} }
} }
else else
...@@ -141,12 +137,10 @@ static SbxVariable* QualifiedName ...@@ -141,12 +137,10 @@ static SbxVariable* QualifiedName
static SbxVariable* Operand static SbxVariable* Operand
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, bool bVar ) ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, bool bVar )
{ {
static SbxSimpleCharClass aCharClass;
SbxVariableRef refVar( new SbxVariable ); SbxVariableRef refVar( new SbxVariable );
const sal_Unicode* p = SkipWhitespace( *ppBuf ); const sal_Unicode* p = SkipWhitespace( *ppBuf );
if( !bVar && ( aCharClass.isDigit( *p ) if( !bVar && ( isDigit( *p )
|| ( *p == '.' && aCharClass.isDigit( *( p+1 ) ) ) || ( *p == '.' && isDigit( *( p+1 ) ) )
|| *p == '-' || *p == '-'
|| *p == '&' ) ) || *p == '&' ) )
{ {
...@@ -306,10 +300,10 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode* ...@@ -306,10 +300,10 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode*
static SbxVariable* Element static SbxVariable* Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType t, const SbxSimpleCharClass& rCharClass ) SbxClassType t )
{ {
OUString aSym; OUString aSym;
const sal_Unicode* p = Symbol( *ppBuf, aSym, rCharClass ); const sal_Unicode* p = Symbol( *ppBuf, aSym );
SbxVariableRef refVar; SbxVariableRef refVar;
if( !aSym.isEmpty() ) if( !aSym.isEmpty() )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment