axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
char * axl_stream_get_until ( axlStream stream,
char *  valid_chars,
int *  chunk_matched,
axl_bool  accept_terminator,
int  chunk_num,

Returns the next chunk available on the stream.

This function allows to get next available chunk, validating it with provided valid_chars variable, until the chunk provided are found.

Currently, valid_chars is not used, so, the chunk returned is not validated against the value provided.

As an example if it is required to get the encoding content, you could do the next call:

1 // reference to the allocated result
2 char * result;
4 // chunk matched variable
5 int chunk_matched;
7 // get the next chunk until a " or ' is found
8 result = axl_stream_get_until (stream, NULL, &chunk_matched, AXL_TRUE, 2, "\"", "'");

Value returned from this function mustn't be deallocated. However, because the value returned is dinamically allocated by the function, you can avoid doing a double allocation operation by nullifying the internal reference to the result returned, making the caller the only owner of the reference returned. To do this use: axl_stream_nullify with LAST_CHUNK.

streamThe stream were the chunk will be extracted.
valid_charsThe valid set of characters, to validate content to be returned. Currently this is not implemented, so, you can provide a NULL value.
chunk_matchedAn optional pointer to an integer to notify the chunk matched by the function. Chunk matching notification starts from 0 up to number of chunks to match - 1. If the end of the stream is reached, -2 is returned.
accept_terminatorWhile calling to this function, the terminator detected to stop the operation could also be accepted by the stream, making it not necessary to accept the terminator once the function have ended. However, this could be a problem while performing peeking code. You can provide a AXL_FALSE value to make the function to not accept the terminator found as to be consumed.
chunk_numThe number of chunks to be checked as a valid terminators.
The chunk recognizied, not including the terminator that have made this operation to stop.

References axl_stream_get_untilv().

Referenced by axl_dtd_check_entity_ref_and_expand().