Tkrzw
Public Member Functions | Static Public Attributes | List of all members
tkrzw::FlatRecord Class Referencefinal

Flat record structure in the file. More...

#include <tkrzw_file_util.h>

Public Member Functions

 FlatRecord (File *file)
 Constructor. More...
 
 ~FlatRecord ()
 Destructor. More...
 
Status Read (int64_t offset)
 Reads the next data. More...
 
std::string_view GetData ()
 Gets the data. More...
 
size_t GetOffset () const
 Gets the offset of the record. More...
 
size_t GetWholeSize () const
 Gets the whole size of the record. More...
 
Status Write (std::string_view data)
 Writes the record in the file. More...
 

Static Public Attributes

static constexpr uint8_t RECORD_MAGIC = 0xFF
 The magic number of the record. More...
 

Detailed Description

Flat record structure in the file.

Constructor & Destructor Documentation

◆ FlatRecord()

tkrzw::FlatRecord::FlatRecord ( File file)
explicit

Constructor.

Parameters
fileThe pointer to the file object. The ownership is not taken.

◆ ~FlatRecord()

tkrzw::FlatRecord::~FlatRecord ( )

Destructor.

Member Function Documentation

◆ Read()

Status tkrzw::FlatRecord::Read ( int64_t  offset)

Reads the next data.

Parameters
offsetThe offset of the record.
Returns
The result status.

◆ GetData()

std::string_view tkrzw::FlatRecord::GetData ( )

Gets the data.

Returns
The data.

◆ GetOffset()

size_t tkrzw::FlatRecord::GetOffset ( ) const

Gets the offset of the record.

Returns
The offset of the record.

◆ GetWholeSize()

size_t tkrzw::FlatRecord::GetWholeSize ( ) const

Gets the whole size of the record.

Returns
The whole size of the record.

◆ Write()

Status tkrzw::FlatRecord::Write ( std::string_view  data)

Writes the record in the file.

Parameters
dataThe record data.
Returns
The result status.

Member Data Documentation

◆ RECORD_MAGIC

constexpr uint8_t tkrzw::FlatRecord::RECORD_MAGIC = 0xFF
static

The magic number of the record.