LibreOffice Module unotools (master) 1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
utl::TextSearch Class Reference

#include <textsearch.hxx>

Public Member Functions

 TextSearch (const SearchParam &rPara, LanguageType nLanguage)
 
 TextSearch (const SearchParam &rPara, const CharClass &rCClass)
 
 TextSearch (const i18nutil::SearchOptions2 &rPara)
 
 ~TextSearch ()
 
bool SearchForward (const OUString &rStr, sal_Int32 *pStart, sal_Int32 *pEnd, css::util::SearchResult *pRes=nullptr)
 
bool searchForward (const OUString &rStr)
 searchForward Search forward beginning from the start to the end of the given text More...
 
bool SearchBackward (const OUString &rStr, sal_Int32 *pStart, sal_Int32 *pEnd, css::util::SearchResult *pRes=nullptr)
 
void SetLocale (const i18nutil::SearchOptions2 &rOpt, const css::lang::Locale &rLocale)
 
void ReplaceBackReferences (OUString &rReplaceStr, std::u16string_view rStr, const css::util::SearchResult &rResult) const
 

Private Member Functions

void Init (const SearchParam &rParam, const css::lang::Locale &rLocale)
 

Static Private Member Functions

static css::uno::Reference< css::util::XTextSearch2 > getXTextSearch (const i18nutil::SearchOptions2 &rPara)
 

Private Attributes

css::uno::Reference< css::util::XTextSearch2 > xTextSearch
 

Detailed Description

Definition at line 154 of file textsearch.hxx.

Constructor & Destructor Documentation

◆ TextSearch() [1/3]

TextSearch::TextSearch ( const SearchParam rPara,
LanguageType  nLanguage 
)

Definition at line 117 of file textsearch.cxx.

References LanguageTag::convertToLocale(), Init(), LANGUAGE_NONE, and LANGUAGE_SYSTEM.

◆ TextSearch() [2/3]

TextSearch::TextSearch ( const SearchParam rPara,
const CharClass rCClass 
)

Definition at line 126 of file textsearch.cxx.

References CharClass::getLanguageTag(), LanguageTag::getLocale(), and Init().

◆ TextSearch() [3/3]

TextSearch::TextSearch ( const i18nutil::SearchOptions2 rPara)

Definition at line 131 of file textsearch.cxx.

References getXTextSearch(), and xTextSearch.

◆ ~TextSearch()

TextSearch::~TextSearch ( )

Definition at line 184 of file textsearch.cxx.

Member Function Documentation

◆ getXTextSearch()

Reference< XTextSearch2 > TextSearch::getXTextSearch ( const i18nutil::SearchOptions2 rPara)
staticprivate

Definition at line 100 of file textsearch.cxx.

References utl::lcl_Equals(), and i18nutil::SearchOptions2::toUnoSearchOptions2().

Referenced by Init(), SetLocale(), and TextSearch().

◆ Init()

void TextSearch::Init ( const SearchParam rParam,
const css::lang::Locale &  rLocale 
)
private

◆ ReplaceBackReferences()

void TextSearch::ReplaceBackReferences ( OUString &  rReplaceStr,
std::u16string_view  rStr,
const css::util::SearchResult &  rResult 
) const

Definition at line 264 of file textsearch.cxx.

References i, and nLength.

◆ SearchBackward()

bool TextSearch::SearchBackward ( const OUString &  rStr,
sal_Int32 *  pStart,
sal_Int32 *  pEnd,
css::util::SearchResult *  pRes = nullptr 
)

Definition at line 234 of file textsearch.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xTextSearch.

◆ searchForward()

bool TextSearch::searchForward ( const OUString &  rStr)

searchForward Search forward beginning from the start to the end of the given text

Parameters
rStrThe text in which we search
Returns
True if the search term is found in the text

Definition at line 224 of file textsearch.cxx.

References SearchForward().

◆ SearchForward()

bool TextSearch::SearchForward ( const OUString &  rStr,
sal_Int32 *  pStart,
sal_Int32 *  pEnd,
css::util::SearchResult *  pRes = nullptr 
)

Definition at line 193 of file textsearch.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xTextSearch.

Referenced by searchForward().

◆ SetLocale()

void TextSearch::SetLocale ( const i18nutil::SearchOptions2 rOpt,
const css::lang::Locale &  rLocale 
)

Definition at line 175 of file textsearch.cxx.

References getXTextSearch(), i18nutil::SearchOptions2::Locale, and xTextSearch.

Member Data Documentation

◆ xTextSearch

css::uno::Reference< css::util::XTextSearch2 > utl::TextSearch::xTextSearch
private

Definition at line 160 of file textsearch.hxx.

Referenced by Init(), SearchBackward(), SearchForward(), SetLocale(), and TextSearch().


The documentation for this class was generated from the following files: