Overview | Module | Use | Devguide | Index

Methods' Summary | Methods' Details | Attributes' Summary | Attributes' Details

:: com :: sun :: star :: i18n ::
interface XCharacterClassification
  Base Hierarchy
      ::com::sun::star::uno::XInterface
       |
       +-XCharacterClassification
Description Character classification (upper, lower, digit, letter, number, ...) and generic Unicode enabled parser. Developers Guide 6.2.2 Office Development - Common Application Features - Internationalization - Overview and Using the API - XCharacterClassification 6.2.2 Office Development - Common Application Features - Internationalization - Implementing a New Locale - XCharacterClassification

Methods' Summary
toUpper | Convert lower case alpha to upper case alpha, starting at position nPos for nCount code points.
toLower | Convert upper case alpha to lower case alpha, starting at position nPos for nCount code points.
toTitle | Convert to title case, starting at position nPos for nCount code points.
getType | Get UnicodeType of character at position nPos .
getCharacterDirection | Get DirectionProperty of character at position nPos .
getScript | Get UnicodeScript of character at position nPos .
getCharacterType | Get KCharacterType of character at position nPos .
getStringType | Get accumulated KCharacterType s of string starting at position nPos of length nCount code points.
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 .

Methods' Details
toUpper
string toUpper( | [in] string [in] long [in] long [in] ::com::sun::star::lang::Locale | aText, nPos, nCount, aLocale );
Description Convert lower case alpha to upper case alpha, starting at position nPos for nCount code points.
toLower
string toLower( | [in] string [in] long [in] long [in] ::com::sun::star::lang::Locale | aText, nPos, nCount, aLocale );
Description Convert upper case alpha to lower case alpha, starting at position nPos for nCount code points.
toTitle
string toTitle( | [in] string [in] long [in] long [in] ::com::sun::star::lang::Locale | aText, nPos, nCount, aLocale );
Description Convert to title case, starting at position nPos for nCount code points.
getType
short getType( | [in] string [in] long | aText, nPos );
Description Get UnicodeType of character at position nPos .
getCharacterDirection
short getCharacterDirection( | [in] string [in] long | aText, nPos );
Description Get DirectionProperty of character at position nPos .
getScript
short getScript( | [in] string [in] long | aText, nPos );
Description Get UnicodeScript of character at position nPos .
getCharacterType
long getCharacterType( | [in] string [in] long [in] ::com::sun::star::lang::Locale | aText, nPos, aLocale );
Description Get KCharacterType of character at position nPos .
getStringType
long getStringType( | [in] string [in] long [in] long [in] ::com::sun::star::lang::Locale | aText, nPos, nCount, aLocale );
Description Get accumulated KCharacterType s of string starting at position nPos of length nCount code points. Returns A number with appropriate flags set to indicate what type of characters the string contains, each flag value being one of KCharacterType values.
parseAnyToken
ParseResult parseAnyToken( | [in] string [in] long [in] ::com::sun::star::lang::Locale [in] long [in] string [in] long [in] string | aText, nPos, aLocale, nStartCharFlags, aUserDefinedCharactersStart, nContCharFlags, aUserDefinedCharactersCont );
  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 aUserDefinedCharactersStart and/or aUserDefinedCharactersCont . Returns A filled ParseResult structure. If no unambigous token could be parsed, ParseResult::TokenType will be set to 0 (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 aText Text to be parsed. Parameter nPos Position where parsing starts. Parameter aLocale The locale, for example, 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 aUserDefinedCharactersStart 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 aUserDefinedCharactersCont A set of additionally allowed characters a name or identifier may continue with. Example :C++
       using namespace ::com::sun::star::i18n;
       // First character of an identifier 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;
       // No further characters assumed to be contained in an identifier
       String aEmptyString;
       // Parse any token.
       ParseResult rRes = xCC->parseAnyToken( aText, nPos, aLocale,
       nStartFlags, aEmptyString, nContFlags, aEmptyString );
       // 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
ParseResult parsePredefinedToken( | [in] long [in] string [in] long [in] ::com::sun::star::lang::Locale [in] long [in] string [in] long [in] string | nTokenType, aText, nPos, aLocale, nStartCharFlags, aUserDefinedCharactersStart, nContCharFlags, aUserDefinedCharactersCont );
  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 the passed nTokenType a ParseResult::TokenType set to 0 (zero) 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 of an identifier may be any alphanumeric or underscore.
       sal_Int32 nStartFlags = KParseTokens::ANY_ALNUM | KParseTokens::ASC_UNDERSCORE;
       // No further characters assumed to be contained in an identifier start.
       String aEmptyString;
       // Continuing characters may be any alphanumeric or underscore.
       sal_Int32 nContFlags = nStartFlags;
       // Additionally, continuing characters may contain a blank.
       String aContChars( RTL_CONSTASCII_USTRINGPARAM(" ") );
       // Parse predefined (must be an IDENTNAME) token.
       ParseResult rRes = xCC->parsePredefinedToken( KParseType::IDENTNAME, rName, 0, aLocale,
       nStartFlags, aEmptyString, nContFlags, aContChars );
       // Test if it is an identifier name and if it only is one
       // and no more else is following it.
       bValid = (rRes.TokenType & KParseType::IDENTNAME) && rRes.EndPos == rName.Len();

Top of Page

Copyright © 2003 Sun Microsystems, Inc.