InspIRCd  3.0
Public Member Functions | List of all members
FileReader Class Reference

#include <fileutils.h>

Public Member Functions

 FileReader ()
 
 FileReader (const std::string &filename)
 
void Load (const std::string &filename)
 
std::string GetString () const
 
const std::vector< std::string > & GetVector () const
 
unsigned long TotalSize () const
 

Detailed Description

Provides an easy method of reading a text file into memory.

Constructor & Destructor Documentation

◆ FileReader() [1/2]

FileReader::FileReader ( )
inline

Initializes a new file reader.

◆ FileReader() [2/2]

FileReader::FileReader ( const std::string &  filename)

Initializes a new file reader and reads the specified file.

Parameters
filenameThe file to read into memory.

Member Function Documentation

◆ GetString()

std::string FileReader::GetString ( ) const

Retrieves the entire contents of the file cache as a single string.

◆ GetVector()

const std::vector<std::string>& FileReader::GetVector ( ) const
inline

Retrieves the entire contents of the file cache as a vector of strings.

◆ Load()

void FileReader::Load ( const std::string &  filename)

Loads a text file from disk.

Parameters
filenameThe file to read into memory.
Exceptions
CoreExceptionThe file can not be loaded.

◆ TotalSize()

unsigned long FileReader::TotalSize ( ) const
inline

Retrieves the total size in bytes of the file.


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