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>
This commit is contained in:
committed by
Arnaud Versini
parent
dec950dc47
commit
4b9a9ce8a0
@@ -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 )
|
||||
|
@@ -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 )
|
||||
|
@@ -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;
|
||||
|
@@ -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> {};
|
||||
|
Reference in New Issue
Block a user