prg_file_parse_block_count_get()
Abstract
Returns the number of parsed blocks in a parse file data structure.
Syntax
prg_file_parse_block_count_get (parse_ptr, block_type_str)
| Argument | Type | Description |
|---|---|---|
parse_ptr |
PrgT_File_Parse * |
Parse data structure returned by prg_file_parse() or prg_tfile_parse(). |
block_type_str |
const char * |
Type of block for which to get a count. NULL means all blocks. |
Return Type
int
Number of blocks that appear in the parsed file.
Header
prg_file_funcs.h
Details
This function returns the number of blocks that were parsed from a configuration file with prg_file_parse() or prg_tfile_parse(). If the block_type_str argument is NULL, this function returns the total number of blocks in the file. If the argument is non-NULL, the function returns just the number of named blocks that match the block type name. For example, if the file was of the form:
start_A
a : b
end_A
start_A
a2:b2
end_A
start_B
a3:b3
end_B
then
prg_file_parse_block_count_get (parse_ptr, NULL)
would return 3, whereas
prg_file_parse_block_count_get (parse_ptr, "A")
would return 2.