Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE int32_t U_EXPORT2 ubidi_getParagraph ( const UBiDi pBiDi,
int32_t  charIndex,
int32_t *  pParaStart,
int32_t *  pParaLimit,
UBiDiLevel pParaLevel,
UErrorCode pErrorCode 
)

Get a paragraph, given a position within the text. This function returns information about a paragraph.
Note: if the paragraph index is known, it is more efficient to retrieve the paragraph information using ubidi_getParagraphByIndex().

Parameters:
pBiDi is the paragraph or line UBiDi object.
charIndex is the index of a character within the text, in the range [0..ubidi_getProcessedLength(pBiDi)-1].
pParaStart will receive the index of the first character of the paragraph in the text. This pointer can be NULL if this value is not necessary.
pParaLimit will receive the limit of the paragraph. The l-value that you point to here may be the same expression (variable) as the one for charIndex. This pointer can be NULL if this value is not necessary.
pParaLevel will receive the level of the paragraph. This pointer can be NULL if this value is not necessary.
pErrorCode must be a valid pointer to an error code value.
Returns:
The index of the paragraph containing the specified position.
See also:
ubidi_getProcessedLength ICU 3.4

Definition at line 2148 of file ubidi.c.

                                                                          {
    uint32_t paraIndex;

    /* check the argument values */
    /* pErrorCode will be checked by the call to ubidi_getParagraphByIndex */
    RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
    RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
    pBiDi=pBiDi->pParaBiDi;             /* get Para object if Line object */
    RETURN_IF_BAD_RANGE(charIndex, 0, pBiDi->length, *pErrorCode, -1);

    for(paraIndex=0; charIndex>=pBiDi->paras[paraIndex]; paraIndex++);
    ubidi_getParagraphByIndex(pBiDi, paraIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode);
    return paraIndex;
}


Generated by  Doxygen 1.6.0   Back to index