summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2015-01-25 13:58:08 +0100
committerArnaud Versini <arnaud.versini@libreoffice.org>2015-01-31 09:48:27 +0000
commit4b9a9ce8a0e5e0716dad9a9ec87d16237e534dc2 (patch)
tree8b72a0f8e4b93724cb0dfba51e74353946ff4eb7 /basic
parentdec950dc4761c1c2f0cf27b20d70f5a0db44d602 (diff)
Use rtl/character.hxx in basic module when possible
Change-Id: I1296541ac1a6a65a613818a1264c2b7482915e64 Reviewed-on: https://gerrit.libreoffice.org/14170 Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org> Tested-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/comp/basiccharclass.cxx9
-rw-r--r--basic/source/comp/sbcomp.cxx9
-rw-r--r--basic/source/comp/scanner.cxx12
-rw-r--r--basic/source/inc/basiccharclass.hxx3
4 files changed, 11 insertions, 22 deletions
diff --git a/basic/source/comp/basiccharclass.cxx b/basic/source/comp/basiccharclass.cxx
index 59ae7242c226..8e404cc42c7f 100644
--- a/basic/source/comp/basiccharclass.cxx
+++ b/basic/source/comp/basiccharclass.cxx
@@ -108,18 +108,13 @@ bool BasicCharClass::isLetterUnicode( sal_Unicode c )
bool BasicCharClass::isAlpha( sal_Unicode c, bool bCompatible )
{
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
+ return rtl::isAsciiAlpha(c)
|| (bCompatible && isLetter( c ));
}
-bool BasicCharClass::isDigit( sal_Unicode c )
-{
- return (c >= '0' && c <= '9');
-}
-
bool BasicCharClass::isAlphaNumeric( sal_Unicode c, bool bCompatible )
{
- return isDigit( c ) || isAlpha( c, bCompatible );
+ return rtl::isAsciiDigit( c ) || isAlpha( c, bCompatible );
}
bool BasicCharClass::isWhitespace( sal_Unicode c )
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index 293e8cf740e3..dfc0b4a8b3e9 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -25,6 +25,7 @@
#include <svtools/miscopt.hxx>
#include <stdio.h>
#include <boost/scoped_ptr.hpp>
+#include <rtl/character.hxx>
// To activate tracing enable in sbtrace.hxx
#ifdef DBG_TRACE_BASIC
@@ -124,12 +125,6 @@ inline void lcl_findNextLine( char*& rpc, char* pe )
++rpc;
}
-inline bool lcl_isAlpha( char c )
-{
- bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
- return bRet;
-}
-
static void lcl_ReadIniFile( const char* pIniFileName )
{
const int BUF_SIZE = 1000;
@@ -153,7 +148,7 @@ static void lcl_ReadIniFile( const char* pIniFileName )
// Read variable
char* pVarStart = pc;
- while( pc < pe && lcl_isAlpha( *pc ) )
+ while( pc < pe && rtl::isAsciiAlpha( *pc ) )
++pc;
int nVarLen = pc - pVarStart;
if( nVarLen == 0 )
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 8a893f0b65aa..41e6171b373a 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -152,7 +152,7 @@ void SbiScanner::scanAlphanumeric()
void SbiScanner::scanGoto()
{
sal_Int32 n = nCol;
- while(n < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[n]))
+ while(n < aLine.getLength() && BasicCharClass::isWhitespace(aLine[n]))
++n;
if(n + 1 < aLine.getLength())
@@ -180,7 +180,7 @@ bool SbiScanner::readLine()
// Trim trailing whitespace
sal_Int32 nEnd = n;
- while(nBufPos < nEnd && theBasicCharClass::get().isWhitespace(aBuf[nEnd - 1]))
+ while(nBufPos < nEnd && BasicCharClass::isWhitespace(aBuf[nEnd - 1]))
--nEnd;
aLine = aBuf.copy(nBufPos, nEnd - nBufPos);
@@ -223,10 +223,10 @@ bool SbiScanner::NextSym()
nOldCol1 = nOldCol2 = 0;
}
- if(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol]))
+ if(nCol < aLine.getLength() && BasicCharClass::isWhitespace(aLine[nCol]))
{
bSpaces = true;
- while(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol]))
+ while(nCol < aLine.getLength() && BasicCharClass::isWhitespace(aLine[nCol]))
++pLine, ++nCol;
}
@@ -298,8 +298,8 @@ bool SbiScanner::NextSym()
}
// read in and convert if number
- else if((nCol < aLine.getLength() && theBasicCharClass::get().isDigit(aLine[nCol] & 0xFF)) ||
- (nCol + 1 < aLine.getLength() && aLine[nCol] == '.' && theBasicCharClass::get().isDigit(aLine[nCol + 1] & 0xFF)))
+ else if((nCol < aLine.getLength() && rtl::isAsciiDigit(aLine[nCol])) ||
+ (nCol + 1 < aLine.getLength() && aLine[nCol] == '.' && rtl::isAsciiDigit(aLine[nCol + 1])))
{
short exp = 0;
short dec = 0;
diff --git a/basic/source/inc/basiccharclass.hxx b/basic/source/inc/basiccharclass.hxx
index 335bff650764..e6fea6545eee 100644
--- a/basic/source/inc/basiccharclass.hxx
+++ b/basic/source/inc/basiccharclass.hxx
@@ -35,9 +35,8 @@ public:
bool isLetter( sal_Unicode c );
bool isLetterUnicode( sal_Unicode c );
bool isAlpha( sal_Unicode c, bool bCompatible );
- bool isDigit( sal_Unicode c );
bool isAlphaNumeric( sal_Unicode c, bool bCompatible );
- bool isWhitespace( sal_Unicode c );
+ static bool isWhitespace( sal_Unicode c );
};
class theBasicCharClass: public rtl::Static<BasicCharClass, theBasicCharClass> {};