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


4.1.1 MinParser

The MinParser component functionality opens and reads test data. The purpose of MinParser is to parse a required section of the test data. The section may be a whole test data file or some part of the data file.

The main functions of MinParser are:

MinParser* mp_create(const TPtrC* path, const TPtrC* file, TCommentType comments)
Creates MinParser with path and file information.
Possible errno return values
ENOENT: invalid path argument.

EACCES: permission denied.

const TPtrC* path
The path to folder where config file located.
const TPtrC* file
The filename of config file.
TCommentType comments
Indication of the comment type.

ENoComments: Comments are included with parsing.

ECStyleComments: The user wants to parse sections without c-style comments.

Return value
MinParser struct object.
MinParser* mp_create_mem(const TPtrC* buffer, TCommentType comments)
Creating a parser with buffer information.
const TPtrC* buffer
The buffer to be parsed.
TCommentType comments
Indication of the comment type.

ENoComments: Comments are included with parsing.

ECStyleComments: The user wants to parse sections without c-style comments.

Return value
MinParser struct object.
void mp_destroy(MinParser** mp)
Destroy MinParser struct component and free allocated memory and resources.
MinParser** mp
Pointer reference to used MinParser struct component.

INITPTR pointer value is returned in mp pointer parameter if destroying operation completed successfully.

Return value
None
MinSectionParser* mp_section(MinParser *mp, const TPtrC* start_tag, const TPtrC* end_tag, int seeked)
Open and read configuration source and parses a required section. If start tag is empty the parsing starts begin of the configuration file.

If end tag is empty the parsing goes end of configuration file.

This function will parse next section after the earlier section if the sought parameter is set to 1.

If configuration file includes several sections with both start and end tags so sought parameter seeks the required section.

Possible errno return values
EINVAL: invalid value was passed to the function.
MinParser *mp
Pointer to MinParser instance.
const TPtrC* start_tag
Start tag name.

If the start tag is empty, the parsing starts at the beginning of the file.

const TPtrC* end_tag
End tag name.

If the end tag is empty, the parsing goes to the end of the file.

int seeked
Indicates the tag on which the parsing ends.
Return value
MinSectionParser struct object.
MinSectionParser* mp_next_section( MinParser *mp, const TPtrC* start_tag, const TPtrC* end_tag, int seeked)
Open and read configuration source and parses a required section. If start tag is empty the parsing starts begin of the configuration file.

If end tag is empty the parsing goes end of configuration file.

This method will parse next section after the earlier section if sought parameter is set to 1.

If configuration file includes several sections with both start and end tags so sought parameter seeks the required section.

Possible errno return values:
EINVAL: Invalid value was passed to the function.
MinParser *mp
Pointer to MinParser instance.
const TPtrC* start_tag
Start tag name.

If the start tag is empty, the parsing starts at the beginning of the file.

const TPtrC* end_tag
End tag name.

If the end tag is empty, the parsing goes to the end of the file.

int seeked
A section indicator.
Return value
MinSectionParser struct object.