Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Raii::RandomReadFile Class Reference

A file that supports random reads: reads that are based on an offset. More...

#include <random-read-file.h>

Collaboration diagram for Raii::RandomReadFile:
Collaboration graph

Public Member Functions

 RandomReadFile (const char *path)
 Opens a random-read file at the given path. More...
 
char operator[] (size_t Offset) const
 

Private Attributes

File m_file
 
std::vector< char > m_buf
 

Detailed Description

A file that supports random reads: reads that are based on an offset.

This differs from the typical sequential reads that are performed when working with stream-based file APIs. To avoid seeking, this class will store all previously read data in a buffer. This class uses logical constness. Note: this is a header-only class.

Definition at line 36 of file random-read-file.h.

Constructor & Destructor Documentation

Raii::RandomReadFile::RandomReadFile ( const char *  path)
inline

Opens a random-read file at the given path.

Definition at line 42 of file random-read-file.h.

Member Function Documentation

char Raii::RandomReadFile::operator[] ( size_t  Offset) const
inline

Definition at line 47 of file random-read-file.h.

References m_buf, m_file, and Raii::File::ReadChar().

Here is the call graph for this function:

Member Data Documentation

File Raii::RandomReadFile::m_file
mutableprivate

Definition at line 75 of file random-read-file.h.

Referenced by operator[]().

std::vector<char> Raii::RandomReadFile::m_buf
mutableprivate

Definition at line 79 of file random-read-file.h.

Referenced by operator[]().


The documentation for this class was generated from the following file: