Tizen(Headless) Native API  6.0
ParsePosition

Parse Position is a simple object used by the Format and its subtypes to keep track of the current position during parsing.

Required Header

#include <utils_i18n.h>

Overview

The i18n_format_parse_object() function in the Format types requires a Parse Position object as an argument. By design, as you parse through a string with different formats, you can use the same Parse Position, since the index parameter records the current position.

Functions

int i18n_parse_position_create (i18n_parse_position_h *parse_position)
 Creates a parse position object.
int i18n_parse_position_create_with_index (int32_t new_index, i18n_parse_position_h *parse_position)
 Creates a parse position object with the given initial index.
int i18n_parse_position_destroy (i18n_parse_position_h parse_position)
 Destroys the parse position object.
int i18n_parse_position_clone (i18n_parse_position_h parse_position, i18n_parse_position_h *clone)
 Creates a clone of the given parse_position object.
int i18n_parse_position_get_index (i18n_parse_position_h parse_position, int32_t *index)
 Retrieves the current parse position.
int i18n_parse_position_set_index (i18n_parse_position_h parse_position, int32_t index)
 Sets the current parse position.
int i18n_parse_position_set_error_index (i18n_parse_position_h parse_position, int32_t error_index)
 Sets the index at which a parse error occurred.
int i18n_parse_position_get_error_index (i18n_parse_position_h parse_position, int32_t *error_index)
 Retrieves the index at which an error occurred, or -1 if the error index has not been set.

Typedefs

typedef void * i18n_parse_position_h
 Handle to the object used by the Format and its subtypes to keep track of the current position during parsing.

Typedef Documentation

typedef void* i18n_parse_position_h

Handle to the object used by the Format and its subtypes to keep track of the current position during parsing.

Since :
3.0

Function Documentation

Creates a clone of the given parse_position object.

Since :
3.0
Remarks:
The clone object should be released by the caller with the i18n_parse_position_destroy() function.
Parameters:
[in]parse_positionThe parse position object to be cloned
[out]cloneThe created parse position object
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
I18N_ERROR_OUT_OF_MEMORYOut of memory

Creates a parse position object.

The index is set to position 0.

Since :
3.0
Remarks:
The created object should be released by the caller with the i18n_parse_position_destroy() function.
Parameters:
[out]parse_positionThe created parse position object
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
I18N_ERROR_OUT_OF_MEMORYOut of memory
int i18n_parse_position_create_with_index ( int32_t  new_index,
i18n_parse_position_h parse_position 
)

Creates a parse position object with the given initial index.

Since :
3.0
Remarks:
The created object should be released by the caller with the i18n_parse_position_destroy() function.
Parameters:
[in]new_indexThe new text offset
[out]parse_positionThe parse position object
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
I18N_ERROR_OUT_OF_MEMORYOut of memory

Destroys the parse position object.

Since :
3.0
Parameters:
[in]parse_positionThe parse position object to destroy
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_parse_position_get_error_index ( i18n_parse_position_h  parse_position,
int32_t *  error_index 
)

Retrieves the index at which an error occurred, or -1 if the error index has not been set.

Since :
3.0
Parameters:
[in]parse_positionThe parse position object
[out]error_indexThe index at which an error occurred
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_parse_position_get_index ( i18n_parse_position_h  parse_position,
int32_t *  index 
)

Retrieves the current parse position.

On input to a parse function, this is the index of the character at which parsing will begin; on output, it is the index of the character following the last character parsed.

Since :
3.0
Parameters:
[in]parse_positionThe parse position object
[out]indexThe current index
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_parse_position_set_error_index ( i18n_parse_position_h  parse_position,
int32_t  error_index 
)

Sets the index at which a parse error occurred.

Formatters should set this before returning an error code from their parse_object() function. The default value is -1 if this is not set.

Since :
3.0
Parameters:
[in]parse_positionThe parse position object
[in]error_indexThe error index
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_parse_position_set_index ( i18n_parse_position_h  parse_position,
int32_t  index 
)

Sets the current parse position.

Since :
3.0
Parameters:
[in]parse_positionThe parse position object
[in]indexThe new index
Returns:
0 on success, otherwise a negative error value
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter