the class eols provide a way to detect the presence of string from a list of string in a byte flow
More...
#include <eols.hpp>
|
| eols (const std::deque< std::string > &end_sequences) |
|
| eols (const eols &ref) |
|
| eols (eols &&ref) noexcept=default |
|
eols & | operator= (const eols &ref) |
|
eols & | operator= (eols &&ref)=default |
|
void | add_sequence (const std::string &seq) |
| add a new sequence for End of Line
|
|
void | reset_detection () const |
| reset the detection to be beginning of each EOL sequence
|
|
bool | eol_reached (char next_read_byte, U_I &eol_sequence_length, U_I &after_eol_read_bytes) const |
| check whether we have reach an end of line More...
|
|
|
bool | bypass_or_larger (U_I prog) const |
| set bypass flag for all in_progress of eols_curs that progression is less than or equal 'prog' More...
|
|
bool | all_bypassed_or_matched () const |
|
bool | find_larger_match (U_I &seq_length, U_I &read_after_eol) const |
|
void | copy_from (const eols &ref) |
|
the class eols provide a way to detect the presence of string from a list of string in a byte flow
Definition at line 47 of file eols.hpp.
◆ eols()
libdar::eols::eols |
( |
const eols & |
ref | ) |
|
|
inline |
◆ bypass_or_larger()
bool libdar::eols::bypass_or_larger |
( |
U_I |
prog | ) |
const |
|
private |
set bypass flag for all in_progress of eols_curs that progression is less than or equal 'prog'
- Returns
- true if all elements of eols_curs could be bypassed (none has a larger progression)
◆ eol_reached()
bool libdar::eols::eol_reached |
( |
char |
next_read_byte, |
|
|
U_I & |
eol_sequence_length, |
|
|
U_I & |
after_eol_read_bytes |
|
) |
| const |
check whether we have reach an end of line
- Parameters
-
[in] | next_read_byte | the next byte read from the file |
[out] | eol_sequence_length | if a EOL sequence is matched, the length of the sequence in bytes |
[out] | after_eol_read_bytes | if a EOL sequence is matched, the amount of byte alread read after that sequence. Important! the bytes read after eol must be re-fed to the eols object |
- Returns
- true if a EOL sequence is matched, false else
- Note
- due to the fact the list of sequence can contain sequence that is a substring of another and that whe have to support the list { "\n" , "\n\r" } for backward compatibility, we need to match the longest string. However it may end that a longer string than a one that just matched finally does not match entierely, but to know that we would have read some extra bytes passed the first (shorter but fully matched) sequence: for example with the two strings { "to", "toto" } as EOL, the read sequence "totu" would have to read the 'u' byte to realize that the longest sequence was 'to', thus we read the second 't' (and the 'u') passed the end of line to know that.
◆ operator=()
eols & libdar::eols::operator= |
( |
const eols & |
ref | ) |
|
|
inline |
◆ eols_curs
std::deque<in_progress> libdar::eols::eols_curs |
|
private |
◆ ref_progression
U_I libdar::eols::ref_progression |
|
mutableprivate |
The documentation for this class was generated from the following file: