Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
b32651fe
Kaydet (Commit)
b32651fe
authored
Kas 26, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
encapsulate pRegexMatcher->find() to be able to monitor UErrorCode
Change-Id: I73359a4e2c36ffeca71210971ba9be670e0a12ae
üst
d838ea20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
textsearch.cxx
i18npool/source/search/textsearch.cxx
+20
-4
No files found.
i18npool/source/search/textsearch.cxx
Dosyayı görüntüle @
b32651fe
...
...
@@ -766,6 +766,7 @@ void TextSearch::RESrchPrepare( const ::com::sun::star::util::SearchOptions& rOp
pRegexMatcher
=
new
RegexMatcher
(
aIcuSearchPatStr
,
nIcuSearchFlags
,
nIcuErr
);
if
(
nIcuErr
)
{
SAL_INFO
(
"i18npool"
,
"TextSearch::RESrchPrepare UErrorCode "
<<
nIcuErr
);
delete
pRegexMatcher
;
pRegexMatcher
=
NULL
;
}
...
...
@@ -792,6 +793,21 @@ void TextSearch::RESrchPrepare( const ::com::sun::star::util::SearchOptions& rOp
//---------------------------------------------------------------------------
static
bool
lcl_findRegex
(
RegexMatcher
*
pRegexMatcher
,
sal_Int32
nStartPos
,
UErrorCode
&
rIcuErr
)
{
if
(
!
pRegexMatcher
->
find
(
nStartPos
,
rIcuErr
))
{
/* TODO: future versions could pass the UErrorCode or translations
* thereof to the caller, for example to inform the user of
* U_REGEX_TIME_OUT. The strange thing though is that an error is set
* only after the second call that returns immediately and not if
* timeout occurred on the first call?!? */
SAL_INFO
(
"i18npool"
,
"lcl_findRegex UErrorCode "
<<
rIcuErr
);
return
false
;
}
return
true
;
}
SearchResult
TextSearch
::
RESrchFrwrd
(
const
OUString
&
searchStr
,
sal_Int32
startPos
,
sal_Int32
endPos
)
throw
(
RuntimeException
)
...
...
@@ -811,7 +827,7 @@ SearchResult TextSearch::RESrchFrwrd( const OUString& searchStr,
// search until there is a valid match
for
(;;)
{
if
(
!
pRegexMatcher
->
find
(
startPos
,
nIcuErr
))
if
(
!
lcl_findRegex
(
pRegexMatcher
,
startPos
,
nIcuErr
))
return
aRet
;
// #i118887# ignore zero-length matches e.g. "a*" in "bc"
...
...
@@ -863,7 +879,7 @@ SearchResult TextSearch::RESrchBkwrd( const OUString& searchStr,
UErrorCode
nIcuErr
=
U_ZERO_ERROR
;
const
IcuUniString
aSearchTargetStr
(
(
const
UChar
*
)
searchStr
.
getStr
(),
startPos
);
pRegexMatcher
->
reset
(
aSearchTargetStr
);
if
(
!
pRegexMatcher
->
find
(
endPos
,
nIcuErr
))
if
(
!
lcl_findRegex
(
pRegexMatcher
,
endPos
,
nIcuErr
))
return
aRet
;
// find the last match
...
...
@@ -885,7 +901,7 @@ SearchResult TextSearch::RESrchBkwrd( const OUString& searchStr,
bFirst
=
false
;
if
(
nFoundEnd
==
nLastPos
)
++
nFoundEnd
;
}
while
(
pRegexMatcher
->
find
(
nFoundEnd
,
nIcuErr
));
}
while
(
lcl_findRegex
(
pRegexMatcher
,
nFoundEnd
,
nIcuErr
));
// Ignore all zero-length matches except "$" anchor on first match.
if
(
nGoodPos
==
nGoodEnd
)
...
...
@@ -897,7 +913,7 @@ SearchResult TextSearch::RESrchBkwrd( const OUString& searchStr,
}
// find last match again to get its details
pRegexMatcher
->
find
(
nGoodPos
,
nIcuErr
);
lcl_findRegex
(
pRegexMatcher
,
nGoodPos
,
nIcuErr
);
// fill in the details of the last match
const
int
nGroupCount
=
pRegexMatcher
->
groupCount
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment