Character boundary analysis allows users to interact with characters as they expect to, for example, when moving the cursor through a text string. Character boundary analysis provides correct navigation through strings regardless of how a character is represented. For example, an accented character might be stored as a base character and a diacritical mark, or a single combined character. What users consider to be a character can differ between languages.
Word boundary analysis is used by search and replace functions, as well as within text editing applications that allow the user to select words with a double click. Word selection provides correct interpretation of punctuation marks within and following words. Characters that are not part of a word, such as symbols or punctuation marks, have word breaks on both sides.
Line boundary analysis determines where a text string can be broken when line-wrapping. The mechanism correctly handles punctuation and hyphenated words.
Sentence boundary analysis allows selection with correct interpretation of periods within numbers and abbreviations, and trailing punctuation marks such as quotation marks and parentheses.
This is the interface for all text boundaries.
Examples:
Print each word of the text in order
void printEachWordForward(const IText& text) {
ITextBoundary* wordBoundary = ITextBoundary::createWordBreak();
words->setText(text);
for (ITextBoundary::offset_type start = wordBoundary->first(),
end = wordBoundary->next();
end != ITextBoundary::kDone;
start = end, end = wordBoundary->next()) {
printf(text.substr(start, end - start));
}
delete wordBoundary;
}
Print each line of the text in reverse order
void printEachLineBackward(const IText& text) {
ITextBoundary* lineBoundary = ITextBoundary::createLineBreak();
lineBoundary->setText(text);
for (ITextBoundary::offset_type end = lineBoundary->last(),
start = lineBoundary->previous();
start != ITextBoundary::kDone;
end = start, start = lineBoundary->previous()) {
printf(text.substr(start, end - start));
}
delete lineBoundary;
}
Constructors & DestructorUse the constructors and destructor in this group to create and destroy objects of class ITextBoundary.
![]() |
public:
virtual ~ITextBoundary()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
ITextBoundary()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Comparing Two ITextBoundary Objects for Equality and InequalityUse the operators in this group to compare the contents of the given ITextBoundary object with the current one for equality or inequality.
![]() |
public:
bool operator !=(const ITextBoundary& rhs) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual bool operator ==(const ITextBoundary&) const = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Getting a Polymorphic CopyUse the function in this group to obtain a polymorphic copy of the ITextBoundary object.
![]() |
public:
virtual ITextBoundary* clone() const = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Getting and Setting the TextUse the functions in this group to get and set the text operated on.
![]() |
public:
virtual void setText(const IText&) = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual IText text() const = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Getting Text Boundary IndexesUse the functions in this group to get indexes to various text boundaries.
![]() |
public:
virtual offset_type current() const = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual offset_type first() = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual offset_type last() = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual offset_type next() = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual offset_type nextAfter(offset_type offset) = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual offset_type nthFromCurrent(int n) = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual offset_type previous() = 0
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Getting the User-Displayable NameUse the function in this group to get the user-displayable name in the locale's language.
![]() |
public:
static IText getDisplayName( const ILocaleKey& objectLocale = ILocaleKey::defaultLocale ( ), const ILocaleKey& displayLocale = ILocaleKey::defaultLocale ( ) )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Locating Line, Word, and Sentance BreaksUse the functions in this group to create instances of ITextBoundary objects that locate sentence, line, and word breaks.
![]() |
public:
static ITextBoundary* createCharacterBreak( const ILocaleKey& locale = ILocaleKey::defaultLocale ( ) )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static ITextBoundary* createLineBreak( const ILocaleKey& locale = ILocaleKey::defaultLocale ( ) )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static ITextBoundary* createSentenceBreak( const ILocaleKey& locale = ILocaleKey::defaultLocale ( ) )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static ITextBoundary* createWordBreak( const ILocaleKey& locale = ILocaleKey::defaultLocale ( ) )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Miscellaneous Members![]() |
public:
static offset_type _IMPORT kDone
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
typedef IText::offset_type offset_type
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |