Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3132
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/32/3132/1
Use local utility functions instead of SbxSimpleCharClass
Change-Id: I7c4bc8cc44c0b4e78feb55dcd2c15b82c414e0ef
---
M basic/source/sbx/sbxexec.cxx
1 file changed, 26 insertions(+), 32 deletions(-)
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 3eaaecf..905b3a2 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -22,32 +22,29 @@
#include <basic/sbx.hxx>
-class SbxSimpleCharClass
+
+static bool isAlpha( sal_Unicode c )
{
-public:
- bool isAlpha( sal_Unicode c ) const
- {
- bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
- return bRet;
- }
+ bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ return bRet;
+}
- bool isDigit( sal_Unicode c ) const
- {
- bool bRet = (c >= '0' && c <= '9');
- return bRet;
- }
+static bool isDigit( sal_Unicode c )
+{
+ bool bRet = (c >= '0' && c <= '9');
+ return bRet;
+}
- bool isAlphaNumeric( sal_Unicode c ) const
- {
- bool bRet = isDigit( c ) || isAlpha( c );
- return bRet;
- }
-};
+static bool isAlphaNumeric( sal_Unicode c )
+{
+ bool bRet = isDigit( c ) || isAlpha( c );
+ return bRet;
+}
static SbxVariable* Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
- SbxClassType, const SbxSimpleCharClass& rCharClass );
+ SbxClassType );
static const sal_Unicode* SkipWhitespace( const sal_Unicode* p )
{
@@ -59,7 +56,7 @@
// Scanning of a symbol. The symbol were inserted in rSym, the return value
// 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;
// Did we have a nonstandard symbol?
@@ -75,7 +72,7 @@
else
{
// 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 );
}
@@ -83,7 +80,7 @@
{
rSym = p;
// The it can contain alphabetic characters, numbers or underlines
- while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
+ while( *p && (isAlphaNumeric( *p ) || *p == '_') )
{
p++, nLen++;
}
@@ -103,14 +100,13 @@
static SbxVariable* QualifiedName
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, SbxClassType t )
{
- static SbxSimpleCharClass aCharClass;
SbxVariableRef refVar;
const sal_Unicode* p = SkipWhitespace( *ppBuf );
- if( aCharClass.isAlpha( *p ) || *p == '_' || *p == '[' )
+ if( isAlpha( *p ) || *p == '_' || *p == '[' )
{
// Read in the element
- refVar = Element( pObj, pGbl, &p, t, aCharClass );
+ refVar = Element( pObj, pGbl, &p, t );
while( refVar.Is() && (*p == '.' || *p == '!') )
{
// It follows still an objectelement. The current element
@@ -124,7 +120,7 @@
break;
p++;
// And the next element please
- refVar = Element( pObj, pGbl, &p, t, aCharClass );
+ refVar = Element( pObj, pGbl, &p, t );
}
}
else
@@ -141,12 +137,10 @@
static SbxVariable* Operand
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, bool bVar )
{
- static SbxSimpleCharClass aCharClass;
-
SbxVariableRef refVar( new SbxVariable );
const sal_Unicode* p = SkipWhitespace( *ppBuf );
- if( !bVar && ( aCharClass.isDigit( *p )
- || ( *p == '.' && aCharClass.isDigit( *( p+1 ) ) )
+ if( !bVar && ( isDigit( *p )
+ || ( *p == '.' && isDigit( *( p+1 ) ) )
|| *p == '-'
|| *p == '&' ) )
{
@@ -306,10 +300,10 @@
static SbxVariable* Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
- SbxClassType t, const SbxSimpleCharClass& rCharClass )
+ SbxClassType t )
{
OUString aSym;
- const sal_Unicode* p = Symbol( *ppBuf, aSym, rCharClass );
+ const sal_Unicode* p = Symbol( *ppBuf, aSym );
SbxVariableRef refVar;
if( !aSym.isEmpty() )
{
--
To view, visit https://gerrit.libreoffice.org/3132
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c4bc8cc44c0b4e78feb55dcd2c15b82c414e0ef
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Arnaud Versini <arnaud.versini@gmail.com>
Context
- [PATCH] Use local utility functions instead of SbxSimpleCharClass · Arnaud Versini (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.