Next: , Previous: MinParser, Up: MIN Parser API


4.1.2 MinSectionParser

The purpose of MinSectionParser is to parse the required lines of the section to forward operations.

The main methods of CMinSectionParser are:

MinSectionParser* msp_create(unsigned int length);
Creates a new MinSectionParser.
unsigned int length
The length of the section to be parsed.
Possible errno return values
ENOMEM: No sufficient memory to allocate new struct object.
Return value
MinSectionParser struct object.
void msp_destroy(MinSectionParser** msp)
Destroys previously created MinSectionParser.
MinSectionParser** msp
the reference pointer to MinSectionParser struct component. Returns address of MinItemParser or INITPTR in case of failure.
Possible errno values
ENOMEM: No sufficient memory to allocate new struct object.
Return value
none
MinItemParser* msp_get_item_line(MinSectionParser* msp, const TPtrC* tag, TTagToReturmValue tag_indicator)
Parses the next line for items parsing with a tag.

Returns address of MinItemParser or INITPTR in case of failure.

MinSectionParser* msp
The reference pointer to MinSectionParser struct component.
const TPtrC* tag
Indicates the tag to start with. If start tag is empty the parsing starts begin of the section.
TTagToReturmValue tag_indicator
Idicates if tag will be included to the returned object.
Return value
MinItemParser struct object or INITPTR in case of failure.
MinSectionParser* msp_get_next_item_line(MinSectionParser* msp)
Parses a next line for items parsing.
MinSectionParser* msp
MinSectionParser entity to operate on.
Return value
MinSectionParser construct object.
MinItemParser* msp_get_next_tagged_item_line(MinSectionParser* msp, const TPtrC* tag, TTagToReturnValue tag_indicator)
Parses a next line for items parsing with a tag.

Returns pointer to MinItemParser struct component.

MinSectionParser* msp
MinSectionParser entity to operate on.
const TPtrC* tag
Indicates the tag to start with. If start tag is empty the parsing starts begin of the section.
TTagToReturnValue tag_indicator
Indicates if tag will be included to the returned object.
Return value
MinItemParser struct object.
MinSectionParser* msp_sub_section(TPtrC* start_tag, TPtrC* end_tag, int seeked)
Parses a sub sections from the main section with a start and with an end tag.

Returns pointer to MinSectionParser struct component.

const TPtrC* start_tag
Indicates the tag to start on.
const TPtrC* end_tag
Indicates the tag to end on.
int seeked
The sought parameter indicates subsection that will be parsed.
Return value
MinSectionParser struct object.
MinSectionParser* msp_next_sub_section(MinSectionParser* msp, const TPtrC* start_tag, const TPtrC* end_tag, int seeked)
Parses a next subsection from the main section with a start and with an end tag.

Returns pointer of MinSectionParser or INITPTR in case of failure.

MinSectionParser* msp
MinSectionParser entity to operate on.
const TPtrC* start_tag
Indicates the tag to start on.
const TPtrC* end_tag
Indicates the tag to end on.
int seeked
The sought parameter indicates subsection that will be parsed.
Return value
MinSectionParser struct object.
MinSectionParser* msp_next_sub_section(MinSectionParser* msp, const TPtrC* start_tag, const TPtrC* end_tag, int seeked)
Parses a next subsection from the main section with a start and width an end tag.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
const TPtrC* start_tag
Pointer to start tag string.
const TPtrC* end_tag
Pointer to end tag string.
int seeked
The sought parameter indicates subsection that will be parsed.
Return value
Return pointer to MinSectionParser struct component or INITPTR pointer value in case of failure.
int msp_get_line(MinSectionParser* msp, const TPtrC* tag, TPtrC** line, TTagToReturnValue tag_indicator)
Get a line from section with a tag.
Possible errno values
EINVAL errno value when invalid value was passed as a parameter.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
const TPtrC* tag
Indicates the tag to start with. If start tag is empty the parsing starts begin of the section.
TPtrC** line
Parsed line is returned through this variable.
TTagToReturnValue tag_indicator
Indicates if tag will be included to the returned line.
Return value
Returns 0 in case of success, -1 in case of failure.
int msp_get_next_line(MinSectionParser* msp, TPtrC** line)
Parses next line.
Possible errno values
EINVAL when invalid value was passed as a parameter.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
TPtrC** line
Parsed line is returned through this variable.
Return value
Returns value 0 in case of success, -1 in case of failure.
int msp_get_next_tagged_line(MinSectionParser* msp, const TPtrC* tag, TPtrC** line, TTagToReturnValue tag_indicator)
Get next line with tag.
Possible errno values
EINVAL when invalid value was passed as a parameter.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
const TPtrC* tag
Indicates the tag to start with. If start tag is empty the parsing starts begin of the section.
TPtrC** line
Parsed line is returned through this variable. If line is no found INITPTR pointer value is returned.
TTagToReturnValue tag_indicator
Indicates if tag will be included to the return line.
Return value
Returns value 0 in case of success, -1 in case of failure.
int msp_get_position(MinSectionParser* msp)
Get current position.
Possible errno values
EINVAL when invalid value was passed as a parameter.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
Return value
Returns current parsing position, or value -1 in case of failure.
int msp_set_position(MinSectionParser* msp, unsigned int pos)
Set position. This function can be used to set parsing position, e.g. to rewind back to some old position retrieved with GetPosition.
Possible errno values
EINVAL when invalid value was passed as a parameter.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
unsigned int pos
Indicates the position to which section parser should go.
Return value
Returns error value in case of failure.
void msp_set_data(MinSectionParser* msp, const TPtrC* data, TPtrC* start_pos, unsigned int length)
Create a section.
MinSectionParser* msp
Pointer to the MinSectionParser struct component.
const TPtrC* data
String data which are to be parsed.
TPtrC* start_pos
Position from which parsing should start.
unsigned int length
Length of the data in bytes.
Return value
None
const TPtrC* msp_des(const MinSectionParser* msp)
Returns current section.
const MinSectionParser* msp
Pointer to the MinSectionParser struct component.
Return value
Return pointer to the data that parser is parsing.