Logo Search packages:      
Sourcecode: icu version File versions

StringSearch::StringSearch ( const UnicodeString pattern,
CharacterIterator text,
const Locale locale,
BreakIterator breakiter,
UErrorCode status 

Creating a StringSearch instance using the argument locale language rule set. A collator will be created in the process, which will be owned by this instance and will be deleted during destruction

Note: No parsing of the text within the CharacterIterator will be done during searching for this version. The block of text in CharacterIterator will be used as it is.

pattern The text for which this object will search.
text The text iterator in which to search for the pattern.
locale A locale which defines the language-sensitive comparison rules used to determine whether text in the pattern and target matches. User is responsible for the clearing of this object.
breakiter A BreakIterator object used to constrain the matches that are found. Matches whose start and end indices in the target text are not boundaries as determined by the BreakIterator are ignored. If this behavior is not desired, NULL can be passed in instead.
status for errors if any. If either the length of pattern or text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned. ICU 2.0

Definition at line 98 of file stsearch.cpp.

References UnicodeString::getBuffer(), Locale::getName(), UnicodeString::length(), m_collator_, m_pattern_, SearchIterator::m_search_, m_strsrch_, SearchIterator::m_text_, NULL, RuleBasedCollator::setUCollator(), StringSearch(), U_FAILURE, and U_SUCCESS.

                           SearchIterator(text, breakiter),
    if (U_FAILURE(status)) {
        m_strsrch_ = NULL;
    m_strsrch_ = usearch_open(m_pattern_.getBuffer(), m_pattern_.length(),
                              m_text_.getBuffer(), m_text_.length(),
                              locale.getName(), (UBreakIterator *)breakiter,
    m_search_ = NULL;

    if (U_SUCCESS(status)) {
        // Alias the collator
        m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
        // m_search_ has been created by the base SearchIterator class
        m_search_ = m_strsrch_->search;

Generated by  Doxygen 1.6.0   Back to index