Tkrzw
Public Member Functions | Static Public Attributes | List of all members
tkrzw::FlatRecordReader Class Reference

Reader of flat records. More...

#include <tkrzw_file_util.h>

Public Member Functions

 FlatRecordReader (File *file, size_t buffer_size=0)
 Constructor. More...
 
 ~FlatRecordReader ()
 Destructor. More...
 
Status Read (std::string_view *str, FlatRecord::RecordType *rec_type=nullptr)
 Reads a record. More...
 

Static Public Attributes

static constexpr size_t DEFAULT_BUFFER_SIZE = 32768
 The initial size of the input buffer. More...
 

Detailed Description

Reader of flat records.

Constructor & Destructor Documentation

◆ FlatRecordReader()

tkrzw::FlatRecordReader::FlatRecordReader ( File file,
size_t  buffer_size = 0 
)

Constructor.

Parameters
fileA file object to read. Ownership is not taken.
buffer_sizeThe initial size of the buffer. 0 means the default buffer size 32768 is set.

◆ ~FlatRecordReader()

tkrzw::FlatRecordReader::~FlatRecordReader ( )

Destructor.

Member Function Documentation

◆ Read()

Status tkrzw::FlatRecordReader::Read ( std::string_view *  str,
FlatRecord::RecordType rec_type = nullptr 
)

Reads a record.

Parameters
strThe pointer to a string_view object which stores the result. The region is available until this method is called again or this object is deleted.
rec_typeThe pointer to a variable into which the record type is assigned. If it is nullptr, it is ignored.
Returns
The result status. NOT_FOUND_ERROR is returned at the end of file.

Member Data Documentation

◆ DEFAULT_BUFFER_SIZE

constexpr size_t tkrzw::FlatRecordReader::DEFAULT_BUFFER_SIZE = 32768
staticconstexpr

The initial size of the input buffer.