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.
Typedef Documentation
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 :
- 2.3.2 and 3.0
- Parameters:
-
[in] | parse_position | The parse position object to be cloned |
[out] | clone | The created parse position object |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
Creates a parse position object.
The index is set to position 0.
- Since :
- 2.3.2 and 3.0
- Parameters:
-
[out] | parse_position | The created parse position object |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
Creates a parse position object with the given initial index.
- Since :
- 2.3.2 and 3.0
- Parameters:
-
[in] | new_index | The new text offset |
[out] | parse_position | The parse position object |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
Destroys the parse position object.
- Since :
- 2.3.2 and 3.0
- Parameters:
-
[in] | parse_position | The parse position object to destroy |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
Retrieves the index at which an error occurred, or -1 if the error index has not been set.
- Since :
- 2.3.2 and 3.0
- Parameters:
-
[in] | parse_position | The parse position object |
[out] | error_index | The index at which an error occurred |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 :
- 2.3.2 and 3.0
- Parameters:
-
[in] | parse_position | The parse position object |
[out] | index | The current index |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 :
- 2.3.2 and 3.0
- Parameters:
-
[in] | parse_position | The parse position object |
[in] | error_index | The error index |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
Sets the current parse position.
- Since :
- 2.3.2 and 3.0
- Parameters:
-
[in] | parse_position | The parse position object |
[in] | index | The new index |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-