interface XCharacterClassification in module com::sun::star::i18n::

(Global Index)

Syntax

interface XCharacterClassification : com::sun::star::uno::XInterface ;

Method Summary

toUpper

toLower

toTitle

getType

getCharacterDirection

getScript

getCharacterType

getStringType

parseAnyToken Parse a string for a token starting at position nPos .

parsePredefinedToken Parse a string for a token of type nTokenType starting at position nPos .

Known Services Which Export this Interface

com::sun::star::i18n::CharacterClassification

Method Details



toUpper

Syntax

string toUpper (
string Text,
long nPos,
long nCount,
com::sun::star::lang::Locale rLocale );

Parameter nCount

is code point count

toLower

Syntax

string toLower (
string Text,
long nPos,
long nCount,
com::sun::star::lang::Locale rLocale );

toTitle

Syntax

string toTitle (
string Text,
long nPos,
long nCount,
com::sun::star::lang::Locale rLocale );

getType

Syntax

short getType (
string Text,
long nPos );

getCharacterDirection

Syntax

short getCharacterDirection (
string Text,
long nPos );

getScript

Syntax

short getScript (
string Text,
long nPos );

getCharacterType

Syntax

long getCharacterType (
string text,
long nPos,
com::sun::star::lang::Locale rLocale );

Description

Returns

a number with appropriate flag set to indicate the type of the character at position nPos; the flag value is one of KCharacterType values.

getStringType

Syntax

long getStringType (
string text,
long nPos,
long nCount,
com::sun::star::lang::Locale rLocale );

Description

Returns

a number with appropriate flags set to indicate what type of characters the string contains; each flag value may be one of KCharacterType values.

parseAnyToken

Syntax

com::sun::star::i18n::ParseResult parseAnyToken (
string Text,
long nPos,
com::sun::star::lang::Locale rLocale,
long nStartCharFlags,
string userDefinedCharactersStart,
long nContCharFlags,
string userDefinedCharactersCont );

Description

Parse a string for a token starting at position nPos .

A name or identifier must match the KParseTokens criteria passed in nStartCharFlags and nContCharFlags and may additionally contain characters of userDefinedCharactersStart and/or userDefinedCharactersCont .

Returns

ParseResult If no unambigous token could be parsed, ParseResult::TokenType will be set to zero, other fields will contain the values parsed so far.

If a token may represent either a numeric value or a name according to the passed Start/Cont-Flags/Chars, both KParseType::ASC_NUM (or KParseType::UNI_NUM ) and KParseType::IDENTNAME are set in ParseResult::TokenType .

Parameter Text

Text to be parsed.

Parameter nPos

Position where parsing starts.

Parameter rLocale

The locale, e.g., for decimal and group separator or character type determination.

Parameter nStartCharFlags

A set of KParseTokens constants determining the allowed characters a name or identifier may start with.

Parameter userDefinedCharactersStart

A set of additionally allowed characters a name or identifier may start with.

Parameter nContCharFlags

A set of KParseTokens constants determining the allowed characters a name or identifier may continue with.

Parameter userDefinedCharactersCont

A set of additionally allowed characters a name or identifier may continue with.

Example

:C++
 using namespace ::com::sun::star::i18n;
 // First character may be any alphabetic or underscore.
 sal_Int32 nStartFlags = KParseTokens::ANY_ALPHA | KParseTokens::ASC_UNDERSCORE;
 // Continuing characters may be any alphanumeric or underscore or dot.
 sal_Int32 nContFlags = KParseTokens::ANY_ALNUM | KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOT;
 // Parse any token.
 ParseResult rRes = xCC->parseAnyToken( aText, nPos, aLocale,
 nStartFlags, EMPTY_STRING, nContFlags, EMPTY_STRING );
 // Get parsed token.
 if ( rRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER) )
 fValue = rRes.Value;
 if ( rRes.TokenType & KParseType::IDENTNAME )
 aName = aText.Copy( nPos, rRes.EndPos - nPos );
 else if ( rRes.TokenType & KParseType::SINGLE_QUOTE_NAME )
 aName = rRes.DequotedNameOrString;
 else if ( rRes.TokenType & KParseType::DOUBLE_QUOTE_STRING )
 aString = rRes.DequotedNameOrString;
 else if ( rRes.TokenType & KParseType::BOOLEAN )
 aSymbol = aText.Copy( nPos, rRes.EndPos - nPos );
 else if ( rRes.TokenType & KParseType::ONE_SINGLE_CHAR )
 aSymbol = aText.Copy( nPos, rRes.EndPos - nPos );

parsePredefinedToken

Syntax

com::sun::star::i18n::ParseResult parsePredefinedToken (
long nTokenType,
string Text,
long nPos,
com::sun::star::lang::Locale rLocale,
long nStartCharFlags,
string userDefinedCharactersStart,
long nContCharFlags,
string userDefinedCharactersCont );

Description

Parse a string for a token of type nTokenType starting at position nPos .

Other parameters are the same as in parseAnyToken . If the actual token does not match a nTokenType a ParseResult::TokenType is returned.

Parameter nTokenType

One or more of the KParseType constants.

Example

:C++
 // Determine if a given name is a valid name (not quoted) and contains
 // only allowed characters.
 using namespace ::com::sun::star::i18n;
 // First character may be any alphanumeric or underscore.
 sal_Int32 nStartFlags = KParseTokens::ANY_ALNUM | KParseTokens::ASC_UNDERSCORE;
 // Continuing characters may be any alphanumeric or underscore.
 sal_Int32 nContFlags = nStartFlags;
 // Additionally, continuing characters may be a blank.
 String aContChars( RTL_CONSTASCII_USTRINGPARAM(" ") );
 // Parse predefined (must be an IDENTNAME) token.
 rRes = xCC->parsePredefinedToken( KParseType::IDENTNAME, rName, 0, aLocale,
 nStartFlags, EMPTY_STRING, nContFlags, aContChars );
 bValid = (rRes.TokenType & KParseType::IDENTNAME) && rRes.EndPos == rName.Len();
Top of Page