summaryrefslogtreecommitdiff
path: root/unotools/source/i18n/charclass.cxx
diff options
context:
space:
mode:
authorEike Rathke <er@openoffice.org>2002-11-21 15:20:47 +0000
committerEike Rathke <er@openoffice.org>2002-11-21 15:20:47 +0000
commitae6fe285f6130442d28a9633f1cc4fae5d883a61 (patch)
treec97917bc1b7c33e1ce28d1da1770a2633b0a2a8c /unotools/source/i18n/charclass.cxx
parent16f19b92fe27288457233276a63daf4f168bacc7 (diff)
#i2800# #99677# performance: single character isAlpha et al test for low ASCII characters before calling i18n
Diffstat (limited to 'unotools/source/i18n/charclass.cxx')
-rw-r--r--unotools/source/i18n/charclass.cxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
index 883f6b3f673f..9db9cd96397f 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: charclass.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: er $ $Date: 2002-08-05 16:27:16 $
+ * last change: $Author: er $ $Date: 2002-11-21 16:20:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -220,6 +220,10 @@ sal_Bool CharClass::isAsciiAlphaNumeric( const String& rStr )
sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const
{
+ sal_Unicode c = rStr.GetChar( nPos );
+ if ( c < 128 )
+ return isAsciiAlpha( c );
+
try
{
if ( xCC.is() )
@@ -255,6 +259,10 @@ sal_Bool CharClass::isAlpha( const String& rStr ) const
sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const
{
+ sal_Unicode c = rStr.GetChar( nPos );
+ if ( c < 128 )
+ return isAsciiAlpha( c );
+
try
{
if ( xCC.is() )
@@ -290,6 +298,10 @@ sal_Bool CharClass::isLetter( const String& rStr ) const
sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const
{
+ sal_Unicode c = rStr.GetChar( nPos );
+ if ( c < 128 )
+ return isAsciiDigit( c );
+
try
{
if ( xCC.is() )
@@ -325,6 +337,10 @@ sal_Bool CharClass::isNumeric( const String& rStr ) const
sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const
{
+ sal_Unicode c = rStr.GetChar( nPos );
+ if ( c < 128 )
+ return isAsciiAlphaNumeric( c );
+
try
{
if ( xCC.is() )
@@ -360,6 +376,10 @@ sal_Bool CharClass::isAlphaNumeric( const String& rStr ) const
sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const
{
+ sal_Unicode c = rStr.GetChar( nPos );
+ if ( c < 128 )
+ return isAsciiAlphaNumeric( c );
+
try
{
if ( xCC.is() )