basic/source/runtime/methods.cxx | 2 comphelper/source/misc/string.cxx | 25 ++-------- comphelper/source/misc/syntaxhighlight.cxx | 4 - dbaccess/source/ui/control/FieldDescControl.cxx | 4 - dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 2 editeng/source/items/svxfont.cxx | 7 -- forms/source/xforms/submission/serialization_urlencoded.cxx | 5 -- fpicker/source/office/iodlg.cxx | 2 include/comphelper/string.hxx | 30 ------------ sc/source/core/tool/compiler.cxx | 2 sd/source/ui/docshell/docshel2.cxx | 5 -- sfx2/source/appl/appdde.cxx | 5 -- svl/source/numbers/zforfind.cxx | 4 - svl/source/numbers/zformat.cxx | 5 -- svl/source/passwordcontainer/passwordcontainer.cxx | 4 - svtools/source/svhtml/parhtml.cxx | 8 +-- svtools/source/svrtf/parrtf.cxx | 9 ++- sw/source/core/edit/edtox.cxx | 5 -- sw/source/filter/html/parcss1.cxx | 12 ++-- sw/source/filter/ww8/ww8graf.cxx | 2 sw/source/ui/index/cnttab.cxx | 6 +- sw/source/ui/vba/vbatemplate.cxx | 2 sw/source/uibase/misc/glosdoc.cxx | 3 - sw/source/uibase/uno/unoatxt.cxx | 3 - ucb/source/regexp/regexp.cxx | 8 +-- xmlhelp/source/cxxhelp/provider/databases.cxx | 3 - xmlhelp/source/treeview/tvread.cxx | 4 - xmloff/source/style/xmlnumfe.cxx | 2 28 files changed, 61 insertions(+), 112 deletions(-)
New commits: commit 892455e72a57d890918f37bd2b32d6c5000ba6ff Author: Stephan Bergmann <[email protected]> Date: Tue Jun 23 22:41:22 2015 +0200 Simplify uses of comphelper::string::equals with constant argument Change-Id: I7b12dd04f6811f71b776ee9168703434217b59c8 diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 73cd355..f551af1 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2775,7 +2775,7 @@ OUString implSetupWildcard( const OUString& rFileParam, SbiRTLData* pRTLData ) // Is there a pure file name left? Otherwise the path is // invalid anyway because it was not accepted by OSL before - if (!string::equals(aPureFileName, '*')) + if (aPureFileName != "*") { pRTLData->pWildCard = new WildCard( aPureFileName ); } diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 290c016..4a58d06 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -228,9 +228,9 @@ OUString OFieldDescControl::BoolStringUI(const OUString& rPersistentString) cons if (rPersistentString == aYes || rPersistentString == aNo) return rPersistentString; - if (comphelper::string::equals(rPersistentString, '0')) + if (rPersistentString == "0") return aNo; - if (comphelper::string::equals(rPersistentString, '1')) + if (rPersistentString == "1") return aYes; return ModuleRes(STR_VALUE_NONE).toString(); diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 8b43ab4..593ad22 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -413,7 +413,7 @@ namespace dbaui else { sExtension = m_pOwnExtension->GetText(); - if ( comphelper::string::equals(sExtension.getToken(0,'.'), '*') ) + if ( sExtension.getToken(0,'.') == "*" ) sExtension = sExtension.copy(2); } return sExtension; diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 7de20d1..a250186 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -28,9 +28,6 @@ #include <editeng/svxfont.hxx> #include <editeng/escapementitem.hxx> -const sal_Unicode CH_BLANK = ' '; // ' ' Space character - - SvxFont::SvxFont() { nKern = nEsc = 0; @@ -262,7 +259,7 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo) const sal_uInt32 nCharacterType = aCharClass.getCharacterType( aCharString, 0 ); if ( ( nCharacterType & ::com::sun::star::i18n::KCharacterType::UPPER ) ) break; - if ( comphelper::string::equals(aCharString, CH_BLANK) ) + if ( aCharString == " " ) break; if( ++nPos < nTxtLen ) aCharString = rTxt.copy( nPos + nIdx, 1 ); @@ -287,7 +284,7 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo) const nOldPos = nPos; } // Now the blanks are<processed - while( nPos < nTxtLen && comphelper::string::equals(aCharString, CH_BLANK) && ++nPos < nTxtLen ) + while( nPos < nTxtLen && aCharString == " " && ++nPos < nTxtLen ) aCharString = rTxt.copy( nPos + nIdx, 1 ); if( nOldPos != nPos ) diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 9f43429..824ef1e 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -997,7 +997,7 @@ IMPL_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) && _pImp->_pCbAutoExtension // auto extension is enabled in general && _pImp->_pCbAutoExtension->IsChecked() // auto extension is really to be used && !GetDefaultExt().isEmpty() // there is a default extension - && !comphelper::string::equals(GetDefaultExt(), '*') // the default extension is not "all" + && GetDefaultExt() != "*" // the default extension is not "all" && !( FILEDLG_MODE_SAVE == _pImp->_eMode // we're saving a file && _pFileView->GetSelectionCount() // there is a selected file in the file view -> it will later on ) // (in SvtFileDialog::GetPathList) be taken as file to save to diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 36dd18e..ac8de66 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1053,9 +1053,9 @@ bool ImpSvNumberInputScan::MayBeIso8601() { sal_Int32 n; if (nAnzNums >= 3 && nNums[2] < nAnzStrings && - comphelper::string::equals(sStrArray[nNums[0]+1], '-') && // separator year-month + sStrArray[nNums[0]+1] == "-" && // separator year-month (n = sStrArray[nNums[1]].toInt32()) >= 1 && n <= 12 && // month - comphelper::string::equals(sStrArray[nNums[1]+1], '-') && // separator month-day + sStrArray[nNums[1]+1] == "-" && // separator month-day (n = sStrArray[nNums[2]].toInt32()) >= 1 && n <= 31) // day { // Year (nNums[0]) value not checked, may be anything, but diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 5a7d557..ec65c7c 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3254,7 +3254,7 @@ bool SvNumberformat::ImpIsIso8601( const ImpSvNumFor& rNumFor ) break; case NF_SYMBOLTYPE_STRING: case NF_SYMBOLTYPE_DATESEP: - if (comphelper::string::equals(rNumFor.Info().sStrArray[i], '-')) + if (rNumFor.Info().sStrArray[i] == "-") { if (eState == eAtYear) { @@ -4550,8 +4550,7 @@ bool SvNumberformat::IsNegativeInBracket() const return false; } OUString *tmpStr = NumFor[1].Info().sStrArray; - using comphelper::string::equals; - return (equals(tmpStr[0], '(') && equals(tmpStr[nAnz-1], ')')); + return tmpStr[0] == "(" && tmpStr[nAnz-1] == ")"; } bool SvNumberformat::HasPositiveBracketPlaceholder() const diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 7babb2d..578afe1 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -303,7 +303,6 @@ void SwEditShell::ApplyAutoMark() //2. SfxMedium aMedium( sAutoMarkURL, STREAM_STD_READ ); SvStream& rStrm = *aMedium.GetInStream(); - const sal_Unicode cZero('0'); Push(); rtl_TextEncoding eChrSet = ::osl_getThreadTextEncoding(); @@ -347,8 +346,8 @@ void SwEditShell::ApplyAutoMark() OUString sWordOnly = sLine.getToken(0, ';', nTokenPos); //3. - bool bCaseSensitive = !sCase.isEmpty() && !comphelper::string::equals(sCase, cZero); - bool bWordOnly = !sWordOnly.isEmpty() && !comphelper::string::equals(sWordOnly, cZero); + bool bCaseSensitive = !sCase.isEmpty() && sCase != "0"; + bool bWordOnly = !sWordOnly.isEmpty() && sWordOnly != "0"; if (!bCaseSensitive) { diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index e5d490e..3fc3052 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -907,7 +907,7 @@ OutlinerParaObject* SwWW8ImplReader::ImportAsOutliner(OUString &rString, WW8_CP if ((eType == MAN_AND) && m_pDrawEditEngine->GetTextLen()) { ESelection aFirstChar(0, 0, 0, 1); - if (comphelper::string::equals(m_pDrawEditEngine->GetText( aFirstChar ), 0x5)) + if (m_pDrawEditEngine->GetText( aFirstChar ) == "\x05") m_pDrawEditEngine->QuickDelete(aFirstChar); } diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 7948ccd..d20dffb 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -1778,7 +1778,7 @@ void SwIdxTreeListBox::RequestHelp( const HelpEvent& rHEvt ) { sal_uInt16 nLevel = static_cast< sal_uInt16 >(GetModel()->GetAbsPos(pEntry)); OUString sEntry = pParent->GetLevelHelp(++nLevel); - if (comphelper::string::equals(sEntry, '*')) + if (sEntry == "*") sEntry = GetEntryText(pEntry); if(!sEntry.isEmpty()) { @@ -4109,10 +4109,10 @@ void SwEntryBrowseBox::ReadEntries(SvStream& rInStr) pToInsert->sSecKey = sLine.getToken(0, ';', nSttPos ); OUString sStr = sLine.getToken(0, ';', nSttPos ); - pToInsert->bCase = !sStr.isEmpty() && !comphelper::string::equals(sStr, '0'); + pToInsert->bCase = !sStr.isEmpty() && sStr != "0"; sStr = sLine.getToken(0, ';', nSttPos ); - pToInsert->bWord = !sStr.isEmpty() && !comphelper::string::equals(sStr, '0'); + pToInsert->bWord = !sStr.isEmpty() && sStr != "0"; aEntryArr.push_back( pToInsert ); pToInsert = 0; diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 07cf313..f580dfa 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1476,7 +1476,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt } break; case NF_SYMBOLTYPE_DEL: - if ( pElemStr && comphelper::string::equals(*pElemStr, '@') ) + if ( pElemStr && *pElemStr == "@" ) { WriteTextContentElement_Impl(); bAnyContent = true; commit 6390d2c52b75b2868d5ee98863a0af4f103c12e5 Author: Stephan Bergmann <[email protected]> Date: Tue Jun 23 18:39:30 2015 +0200 Get rid of comphelper::string::is*Ascii functions Change-Id: I99912112e5b009d7a143f9816d757cdf6ebb1783 diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 9f0eb7d..d1fffbc 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -21,9 +21,9 @@ #include <cassert> +#include <rtl/character.hxx> #include <unicode/uchar.h> #include <comphelper/syntaxhighlight.hxx> -#include <comphelper/string.hxx> // Flags for character properties #define CHAR_START_IDENTIFIER 0x0001 @@ -249,7 +249,7 @@ namespace { bool isAlpha(sal_Unicode c) { - if (comphelper::string::isalphaAscii(c)) + if (rtl::isAsciiAlpha(c)) return true; return u_isalpha(c); } diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx index c688b6e..221ccc1 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ b/forms/source/xforms/submission/serialization_urlencoded.cxx @@ -24,11 +24,10 @@ #include <com/sun/star/xml/dom/XText.hpp> #include <com/sun/star/xml/dom/XNodeList.hpp> #include <com/sun/star/xml/dom/NodeType.hpp> - +#include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> #include <comphelper/processfactory.hxx> -#include <comphelper/string.hxx> #include <stdio.h> @@ -54,7 +53,7 @@ CSerializationURLEncoded::CSerializationURLEncoded() */ bool CSerializationURLEncoded::is_unreserved(sal_Char c) { - if (comphelper::string::isalnumAscii(c)) + if (rtl::isAsciiAlphanumeric(static_cast<unsigned char>(c))) return true; switch (c) { case '-': diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index b968037..5bf8296 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -401,36 +401,6 @@ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OString &rString); */ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OUString &rString); -inline bool isdigitAscii(sal_Unicode c) -{ - return ((c >= '0') && (c <= '9')); -} - -inline bool isxdigitAscii(sal_Unicode c) -{ - return isdigitAscii(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); -} - -inline bool islowerAscii(sal_Unicode c) -{ - return ((c >= 'a') && (c <= 'z')); -} - -inline bool isupperAscii(sal_Unicode c) -{ - return ((c >= 'A') && (c <= 'Z')); -} - -inline bool isalphaAscii(sal_Unicode c) -{ - return islowerAscii(c) || isupperAscii(c); -} - -inline bool isalnumAscii(sal_Unicode c) -{ - return isalphaAscii(c) || isdigitAscii(c); -} - /** Compare two strings containing software version numbers Inspired by the GNU strverscmp(), but there is no guarantee that the exact diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 125abb4..764db1f 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2766,7 +2766,7 @@ bool ScCompiler::IsPredetectedReference(const OUString& rName) return false; // :#REF!.AB42 or :#REF!42 or :#REF!#REF! break; default: - if (comphelper::string::isalphaAscii(c) && + if (rtl::isAsciiAlpha(c) && ((mnPredetectedReference > 1 && ':' == c2) || 0 == c2)) return false; // AB#REF!: or AB#REF! } diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index b4e66d5..88d14a6 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -39,7 +39,6 @@ #include "fupoor.hxx" #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> -#include <comphelper/string.hxx> namespace sd { @@ -348,13 +347,13 @@ bool DrawDocShell::IsNewPageNameValid( OUString & rInOutPageName, bool bResetStr } } else if (sRemainder.getLength() == 1 && - comphelper::string::islowerAscii(sRemainder[0])) + rtl::isAsciiLowerCase(sRemainder[0])) { // lower case, single character: reserved bIsStandardName = true; } else if (sRemainder.getLength() == 1 && - comphelper::string::isupperAscii(sRemainder[0])) + rtl::isAsciiUpperCase(sRemainder[0])) { // upper case, single character: reserved bIsStandardName = true; diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 081d677..233a2a0 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -18,7 +18,7 @@ */ #include <config_features.h> - +#include <rtl/character.hxx> #include <vcl/wrkwin.hxx> #include <svl/rectitem.hxx> #include <svl/eitem.hxx> @@ -43,7 +43,6 @@ #include "helper.hxx" #include <sfx2/docfile.hxx> #include <comphelper/processfactory.hxx> -#include <comphelper/string.hxx> #include <com/sun/star/ucb/IllegalIdentifierException.hpp> #if defined WNT @@ -55,7 +54,7 @@ OUString SfxDdeServiceName_Impl( const OUString& sIn ) for ( sal_uInt16 n = sIn.getLength(); n; --n ) { sal_Unicode cChar = sIn[n-1]; - if (comphelper::string::isalnumAscii(cChar)) + if (rtl::isAsciiAlphanumeric(cChar)) sReturn.append(cChar); } diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 31175d1..81e8bbb 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -24,7 +24,6 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/processfactory.hxx> -#include <comphelper/string.hxx> #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/task/InteractionHandler.hpp> @@ -32,6 +31,7 @@ #include <com/sun/star/task/NoMasterException.hpp> #include <osl/diagnose.h> +#include <rtl/character.hxx> #include <rtl/cipher.h> #include <rtl/digest.h> #include <rtl/byteseq.hxx> @@ -60,7 +60,7 @@ static OUString createIndex(const vector< OUString >& lines) while( *pLine ) { - if (comphelper::string::isalnumAscii(*pLine)) + if (rtl::isAsciiAlphanumeric(static_cast<unsigned char>(*pLine))) { aResult += OString( *pLine ); } diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 4ea4835..0158436 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -418,12 +418,12 @@ int HTMLParser::FilterToken( int nToken ) return nToken; } -#define HTML_ISDIGIT( c ) comphelper::string::isdigitAscii(c) -#define HTML_ISALPHA( c ) comphelper::string::isalphaAscii(c) -#define HTML_ISALNUM( c ) comphelper::string::isalnumAscii(c) +#define HTML_ISDIGIT( c ) rtl::isAsciiDigit(c) +#define HTML_ISALPHA( c ) rtl::isAsciiAlpha(c) +#define HTML_ISALNUM( c ) rtl::isAsciiAlphanumeric(c) #define HTML_ISSPACE( c ) ( ' ' == c || (c >= 0x09 && c <= 0x0d) ) #define HTML_ISPRINTABLE( c ) ( c >= 32 && c != 127) -#define HTML_ISHEXDIGIT( c ) comphelper::string::isxdigitAscii(c) +#define HTML_ISHEXDIGIT( c ) rtl::isAsciiHexDigit(c) int HTMLParser::ScanText( const sal_Unicode cBreak ) { diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index fc98b87..00f15e5 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -17,20 +17,23 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> +#include <rtl/character.hxx> +#include <rtl/strbuf.hxx> #include <rtl/tencinfo.h> +#include <rtl/ustrbuf.hxx> #include <tools/stream.hxx> #include <tools/debug.hxx> #include <svtools/rtftoken.h> #include <svtools/rtfkeywd.hxx> #include <svtools/parrtf.hxx> -#include <comphelper/string.hxx> const int MAX_STRING_LEN = 1024; const int MAX_TOKEN_LEN = 128; -#define RTF_ISDIGIT( c ) comphelper::string::isdigitAscii(c) -#define RTF_ISALPHA( c ) comphelper::string::isalphaAscii(c) +#define RTF_ISDIGIT( c ) rtl::isAsciiDigit(c) +#define RTF_ISALPHA( c ) rtl::isAsciiAlpha(c) SvRTFParser::SvRTFParser( SvStream& rIn, sal_uInt8 nStackSize ) : SvParser( rIn, nStackSize ) diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index 80e382b..633e6ae 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -141,14 +141,14 @@ CSS1Token CSS1Parser::GetNextToken() case '@': // '@import' | '@XXX' { cNextCh = GetNextChar(); - if (comphelper::string::isalphaAscii(cNextCh)) + if (rtl::isAsciiAlpha(cNextCh)) { // den naechsten Identifer scannen OUStringBuffer sTmpBuffer(32); do { sTmpBuffer.append( cNextCh ); cNextCh = GetNextChar(); - } while( (comphelper::string::isalnumAscii(cNextCh) || + } while( (rtl::isAsciiAlphanumeric(cNextCh) || '-' == cNextCh) && !IsEOF() ); aToken += sTmpBuffer.makeStringAndClear(); @@ -244,7 +244,7 @@ CSS1Token CSS1Parser::GetNextToken() do { sTmpBuffer.append( cNextCh ); cNextCh = GetNextChar(); - } while( (comphelper::string::isalnumAscii(cNextCh) || + } while( (rtl::isAsciiAlphanumeric(cNextCh) || '-' == cNextCh) && !IsEOF() ); aToken += sTmpBuffer.makeStringAndClear(); @@ -388,7 +388,7 @@ CSS1Token CSS1Parser::GetNextToken() do { sTmpBuffer2.append( cNextCh ); cNextCh = GetNextChar(); - } while( (comphelper::string::isalnumAscii(cNextCh) || + } while( (rtl::isAsciiAlphanumeric(cNextCh) || '-' == cNextCh) && !IsEOF() ); aIdent += sTmpBuffer2.makeStringAndClear(); @@ -583,7 +583,7 @@ CSS1Token CSS1Parser::GetNextToken() // no break default: // IDENT | syntax error - if (comphelper::string::isalphaAscii(cNextCh)) + if (rtl::isAsciiAlpha(cNextCh)) { // IDENT @@ -601,7 +601,7 @@ CSS1Token CSS1Parser::GetNextToken() ('a'<=cNextCh && 'f'>=cNextCh) ); } cNextCh = GetNextChar(); - } while( (comphelper::string::isalnumAscii(cNextCh) || + } while( (rtl::isAsciiAlphanumeric(cNextCh) || '-' == cNextCh) && !IsEOF() ); aToken += sTmpBuffer.makeStringAndClear(); diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx index 77fcfa1..e428a3a 100644 --- a/sw/source/ui/vba/vbatemplate.cxx +++ b/sw/source/ui/vba/vbatemplate.cxx @@ -36,7 +36,7 @@ static OUString lcl_CheckGroupName( const OUString& rGroupName ) for( sal_Int32 i = 0; i < rGroupName.getLength(); i++ ) { sal_Unicode cChar = rGroupName[i]; - if (comphelper::string::isalnumAscii(cChar) || + if (rtl::isAsciiAlphanumeric(cChar) || cChar == '_' || cChar == 0x20) { sRet += OUString(cChar); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index eb37562..df1f77a 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -31,7 +31,6 @@ #include <svl/fstathelper.hxx> #include <unotools/pathoptions.hxx> #include <unotools/tempfile.hxx> -#include <comphelper/string.hxx> #include <swtypes.hxx> #include <uitool.hxx> #include <glosdoc.hxx> @@ -64,7 +63,7 @@ OUString lcl_CheckFileName( const OUString& rNewFilePath, for( sal_Int32 i=0; i < nLen; ++i ) { const sal_Unicode cChar = rNewGroupName[i]; - if (comphelper::string::isalnumAscii(cChar) || + if (rtl::isAsciiAlphanumeric(cChar) || cChar == '_' || cChar == 0x20) { aBuf.append(cChar); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 6967c17..26e2983 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -52,7 +52,6 @@ #include <svl/macitem.hxx> #include <editeng/acorrcfg.hxx> #include <comphelper/servicehelper.hxx> -#include <comphelper/string.hxx> #include <cppuhelper/supportsservice.hxx> #include <boost/scoped_ptr.hpp> @@ -161,7 +160,7 @@ uno::Reference< text::XAutoTextGroup > SwXAutoTextContainer::insertNewByName( for(sal_Int32 nPos = 0; nPos < aGroupName.getLength(); nPos++) { sal_Unicode cChar = aGroupName[nPos]; - if (comphelper::string::isalnumAscii(cChar) || + if (rtl::isAsciiAlphanumeric(cChar) || (cChar == '_') || (cChar == 0x20) || (cChar == GLOS_DELIM) ) diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx index 4b055a1..41254c9 100644 --- a/ucb/source/regexp/regexp.cxx +++ b/ucb/source/regexp/regexp.cxx @@ -23,9 +23,9 @@ #include "osl/diagnose.h" #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.hxx> -#include <comphelper/string.hxx> namespace unnamed_ucb_regexp {} using namespace unnamed_ucb_regexp; // unnamed namespaces don't work well yet... @@ -178,19 +178,17 @@ namespace unnamed_ucb_regexp { bool isScheme(OUString const & rString, bool bColon) { - using comphelper::string::isalphaAscii; - using comphelper::string::isdigitAscii; // Return true if rString matches <scheme> (plus a trailing ":" if bColon // is true) from RFC 2396: sal_Unicode const * p = rString.getStr(); sal_Unicode const * pEnd = p + rString.getLength(); - if (p != pEnd && isalphaAscii(*p)) + if (p != pEnd && rtl::isAsciiAlpha(*p)) for (++p;;) { if (p == pEnd) return !bColon; sal_Unicode c = *p++; - if (!(isalphaAscii(c) || isdigitAscii(c) + if (!(rtl::isAsciiAlpha(c) || rtl::isAsciiDigit(c) || c == '+' || c == '-' || c == '.')) return bColon && c == ':' && p == pEnd; } diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index e9bcfbf..865528a 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -59,7 +59,6 @@ #include <com/sun/star/awt/XTopWindow.hpp> #include <comphelper/storagehelper.hxx> -#include <comphelper/string.hxx> #include <vcl/svapp.hxx> @@ -1456,7 +1455,7 @@ OUString ExtensionIteratorBase::implGetFileFromPackage( inline bool isLetter( sal_Unicode c ) { - return comphelper::string::isalphaAscii(c); + return rtl::isAsciiAlpha(c); } void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< OUString > &rv, diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index a13067b..d8bae20 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -18,6 +18,7 @@ */ #include <string.h> +#include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> #include "tvread.hxx" @@ -35,7 +36,6 @@ #include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarExpandUrl.hpp> #include <i18nlangtag/languagetag.hxx> -#include <comphelper/string.hxx> #include <unotools/pathoptions.hxx> namespace treeview { @@ -1038,7 +1038,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpP inline bool isLetter( sal_Unicode c ) { - return comphelper::string::isalphaAscii(c); + return rtl::isAsciiAlpha(c); } void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< OUString > &rv, commit 3fb56b38c46849569fe2035a3f377a396e2ec8fd Author: Stephan Bergmann <[email protected]> Date: Tue Jun 23 15:49:30 2015 +0200 Simplify comphelper::string::isdigitAsciiString definitions Change-Id: I26c889e51287a239ef92a798a6899266837064d9 diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 9839174..c563796 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -24,6 +24,7 @@ #include <vector> #include <algorithm> +#include <rtl/character.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/string.hxx> @@ -342,30 +343,18 @@ NaturalStringSorter::NaturalStringSorter( m_xBI = i18n::BreakIterator::create( rContext ); } -namespace -{ - //do OPER on each element of the string, return false - //if any OPER is false, true otherwise - template <bool (*OPER)(sal_Unicode), typename T> - bool tmpl_is_OPER_AsciiString(const T &rString) - { - for (sal_Int32 i = 0; i < rString.getLength(); ++i) - { - if (!OPER(rString[i])) - return false; - } - return true; - } -} - bool isdigitAsciiString(const OString &rString) { - return tmpl_is_OPER_AsciiString<isdigitAscii>(rString); + return std::all_of( + rString.getStr(), rString.getStr() + rString.getLength(), + [](unsigned char c){ return rtl::isAsciiDigit(c); }); } bool isdigitAsciiString(const OUString &rString) { - return tmpl_is_OPER_AsciiString<isdigitAscii>(rString); + return std::all_of( + rString.getStr(), rString.getStr() + rString.getLength(), + rtl::isAsciiDigit); } namespace _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
