i18npool/qa/cppunit/test_textsearch.cxx |    9 ++++-----
 i18npool/source/search/textsearch.cxx   |   14 +++++++-------
 i18npool/source/search/textsearch.hxx   |    2 --
 3 files changed, 11 insertions(+), 14 deletions(-)

New commits:
commit 0dc4cbe342d93ce27b92c5a408adcb009b39b48f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Mar 10 09:44:14 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Mar 10 08:45:42 2022 +0100

    Use icu::UnicodeString directly
    
    Change-Id: I41b4e64d6d3a9310d819904c8d32c689e6300bcd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131296
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/i18npool/qa/cppunit/test_textsearch.cxx 
b/i18npool/qa/cppunit/test_textsearch.cxx
index 31c66d94cd8d..1d72a8d83f18 100644
--- a/i18npool/qa/cppunit/test_textsearch.cxx
+++ b/i18npool/qa/cppunit/test_textsearch.cxx
@@ -27,7 +27,6 @@
 #include <unicode/regex.h>
 
 using namespace ::com::sun::star;
-typedef U_ICU_NAMESPACE::UnicodeString IcuUniString;
 
 class TestTextSearch : public test::BootstrapFixtureBase
 {
@@ -59,11 +58,11 @@ void TestTextSearch::testICU()
 
     OUString aString( "abcdefgh" );
     OUString aPattern( "e" );
-    IcuUniString aSearchPat( reinterpret_cast<const 
UChar*>(aPattern.getStr()), aPattern.getLength() );
+    icu::UnicodeString aSearchPat( reinterpret_cast<const 
UChar*>(aPattern.getStr()), aPattern.getLength() );
 
     std::unique_ptr<icu::RegexMatcher> pRegexMatcher(new icu::RegexMatcher( 
aSearchPat, nSearchFlags, nErr ));
 
-    IcuUniString aSource( reinterpret_cast<const UChar*>(aString.getStr()), 
aString.getLength() );
+    icu::UnicodeString aSource( reinterpret_cast<const 
UChar*>(aString.getStr()), aString.getLength() );
     pRegexMatcher->reset( aSource );
 
     CPPUNIT_ASSERT( pRegexMatcher->find( 0, nErr ) );
@@ -76,10 +75,10 @@ void TestTextSearch::testICU()
     OUString aString2( "acababaabcababadcdaa" );
     OUString aPattern2( "a" );
 
-    IcuUniString aSearchPat2( reinterpret_cast<const 
UChar*>(aPattern2.getStr()), aPattern2.getLength() );
+    icu::UnicodeString aSearchPat2( reinterpret_cast<const 
UChar*>(aPattern2.getStr()), aPattern2.getLength() );
     pRegexMatcher.reset(new icu::RegexMatcher( aSearchPat2, nSearchFlags, nErr 
));
 
-    IcuUniString aSource2( reinterpret_cast<const UChar*>(aString2.getStr()), 
aString2.getLength() );
+    icu::UnicodeString aSource2( reinterpret_cast<const 
UChar*>(aString2.getStr()), aString2.getLength() );
     pRegexMatcher->reset( aSource2 );
 
     CPPUNIT_ASSERT( pRegexMatcher->find( 0, nErr ) );
diff --git a/i18npool/source/search/textsearch.cxx 
b/i18npool/source/search/textsearch.cxx
index 1df286dfcd35..c80afc19890f 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -877,19 +877,19 @@ void TextSearch::RESrchPrepare( const 
css::util::SearchOptions2& rOptions)
         nIcuSearchFlags |= UREGEX_CASE_INSENSITIVE;
     UErrorCode nIcuErr = U_ZERO_ERROR;
     // assumption: transliteration didn't mangle regexp control chars
-    IcuUniString aIcuSearchPatStr( reinterpret_cast<const 
UChar*>(rPatternStr.getStr()), rPatternStr.getLength());
+    icu::UnicodeString aIcuSearchPatStr( reinterpret_cast<const 
UChar*>(rPatternStr.getStr()), rPatternStr.getLength());
 #ifndef DISABLE_WORDBOUND_EMULATION
     // for convenience specific syntax elements of the old regex engine are 
emulated
     // - by replacing \< with "word-break followed by a look-ahead word-char"
-    static const IcuUniString aChevronPatternB( "\\\\<", -1, 
IcuUniString::kInvariant);
-    static const IcuUniString aChevronReplaceB( "\\\\b(?=\\\\w)", -1, 
IcuUniString::kInvariant);
+    static const icu::UnicodeString aChevronPatternB( "\\\\<", -1, 
icu::UnicodeString::kInvariant);
+    static const icu::UnicodeString aChevronReplaceB( "\\\\b(?=\\\\w)", -1, 
icu::UnicodeString::kInvariant);
     static icu::RegexMatcher aChevronMatcherB( aChevronPatternB, 0, nIcuErr);
     aChevronMatcherB.reset( aIcuSearchPatStr);
     aIcuSearchPatStr = aChevronMatcherB.replaceAll( aChevronReplaceB, nIcuErr);
     aChevronMatcherB.reset();
     // - by replacing \> with "look-behind word-char followed by a word-break"
-    static const IcuUniString aChevronPatternE( "\\\\>", -1, 
IcuUniString::kInvariant);
-    static const IcuUniString aChevronReplaceE( "(?<=\\\\w)\\\\b", -1, 
IcuUniString::kInvariant);
+    static const icu::UnicodeString aChevronPatternE( "\\\\>", -1, 
icu::UnicodeString::kInvariant);
+    static const icu::UnicodeString aChevronReplaceE( "(?<=\\\\w)\\\\b", -1, 
icu::UnicodeString::kInvariant);
     static icu::RegexMatcher aChevronMatcherE( aChevronPatternE, 0, nIcuErr);
     aChevronMatcherE.reset( aIcuSearchPatStr);
     aIcuSearchPatStr = aChevronMatcherE.replaceAll( aChevronReplaceE, nIcuErr);
@@ -957,7 +957,7 @@ SearchResult TextSearch::RESrchFrwrd( const OUString& 
searchStr,
 
     // use the ICU RegexMatcher to find the matches
     UErrorCode nIcuErr = U_ZERO_ERROR;
-    const IcuUniString aSearchTargetStr(false, reinterpret_cast<const 
UChar*>(searchStr.getStr()),
+    const icu::UnicodeString aSearchTargetStr(false, reinterpret_cast<const 
UChar*>(searchStr.getStr()),
                                         searchStr.getLength());
     pRegexMatcher->reset( aSearchTargetStr);
     // search until there is a valid match
@@ -1014,7 +1014,7 @@ SearchResult TextSearch::RESrchBkwrd( const OUString& 
searchStr,
     // TODO: use ICU's backward searching once it becomes available
     //       as its replacement using forward search is not as good as the 
real thing
     UErrorCode nIcuErr = U_ZERO_ERROR;
-    const IcuUniString aSearchTargetStr(false, reinterpret_cast<const 
UChar*>(searchStr.getStr()),
+    const icu::UnicodeString aSearchTargetStr(false, reinterpret_cast<const 
UChar*>(searchStr.getStr()),
                                         searchStr.getLength());
     pRegexMatcher->reset( aSearchTargetStr);
     if (!lcl_findRegex( pRegexMatcher, endPos, startPos, nIcuErr))
diff --git a/i18npool/source/search/textsearch.hxx 
b/i18npool/source/search/textsearch.hxx
index d03a1047769b..0a4da19dfadc 100644
--- a/i18npool/source/search/textsearch.hxx
+++ b/i18npool/source/search/textsearch.hxx
@@ -38,8 +38,6 @@ namespace com::sun::star::i18n { class 
XExtendedTransliteration; }
 namespace com::sun::star::uno { class XComponentContext; }
 
 
-typedef U_ICU_NAMESPACE::UnicodeString IcuUniString;
-
 class WLevDistance;
 typedef ::std::map< sal_Unicode, sal_Int32 > TextSearchJumpTable;
 

Reply via email to