Class InputReader
Defined in File input_reader.h
Class Documentation
-
class InputReader
InputReader class used for extracting domains from a file pointer.
This class reads domains seperated by a newline character from a specified file pointer. The class also checks all characters in the domain for validity, only a-z, 0-9, - and . are allowed. Note that uppercase characters are not allowed
Public Functions
-
InputReader(FILE *read_file)
Construct a new Input Reader object using a block size of 1MB.
- Parameters:
read_file – File pointer to read domains from
-
InputReader(FILE *read_file, const size_t block_size)
Construct a new Input Reader object.
See also
block_size
- Parameters:
read_file – File pointer to read domains from
block_size – The block size to use when reading the file,
-
ReadDomainResult GetDomain(DomainInputInfo &domain_info)
Read a new domain from read_file.
- Parameters:
domain_info – Reference to a domain_info object, the caller is responsible for ensuring enough allocated memory is available in domain_info.buf
- Returns:
ReadDomainResult::Success means the domain in domain_info doesn’t contain invalid characters
- Returns:
ReadDomainResult::NotAvailable means there was no new data available from read_file, domain_info should not be used
- Returns:
ReadDomainResult::FileEnd indicates that the input file has been read completely and the InputReader object can be destroyed
- Returns:
ReadDomainResult::NotValid means that the result read into domain_info comtains invalid characters and/or the domain is too long
-
~InputReader()
Destroy the Input Reader object.
-
InputReader(FILE *read_file)