|
Nvwa
1.1
|
Class to allow iteration over all lines of a mmappable file. More...
#include <mmap_line_reader.h>
Classes | |
| class | iterator |
| Iterator that contains the line content. More... | |
Public Types | |
| enum | strip_type { strip_delimiter, no_strip_delimiter } |
| Enumeration of whether the delimiter should be stripped. More... | |
Public Member Functions | |
| mmap_line_reader (const char *path, char delimiter='\n', strip_type strip=strip_delimiter) | |
| Constructor. More... | |
| mmap_line_reader (int fd, char delimiter='\n', strip_type strip=strip_delimiter) | |
| Constructor. More... | |
| ~mmap_line_reader () | |
| Destructor. More... | |
| bool | read (std::string &output, off_t &offset) |
| Reads content from the mmaped file. More... | |
Private Member Functions | |
| void | initialize () |
| Initializes the object. More... | |
Class to allow iteration over all lines of a mmappable file.
|
explicit |
Constructor.
| path | path to the file to open |
| delimiter | the delimiter between text `lines' (default to LF) |
| strip | enumerator about whether to strip the delimiter |
|
explicit |
Constructor.
| path | a file descriptor |
| delimiter | the delimiter between text `lines' (default to LF) |
| strip | enumerator about whether to strip the delimiter |
| nvwa::mmap_line_reader::~mmap_line_reader | ( | ) |
Destructor.
|
private |
Initializes the object.
It gets the file size and mmaps the whole file.
| bool nvwa::mmap_line_reader::read | ( | std::string & | output, |
| off_t & | offset | ||
| ) |
Reads content from the mmaped file.
| [out] | output | string to receive the line |
| [in,out] | offset | offset of reading pos on entry; end offset on exit |
true if line content is returned; false otherwise
1.8.13