OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
LodReader Class Referencefinal

#include <LodReader.h>

Classes

struct  LodRegion
 

Public Member Functions

 LodReader ()
 
 LodReader (std::string_view path, LodOpenFlags openFlags=0)
 
 LodReader (Blob blob, LodOpenFlags openFlags=0)
 
 ~LodReader ()
 
void open (std::string_view path, LodOpenFlags openFlags=0)
 
void open (Blob blob, LodOpenFlags openFlags=0)
 
void close ()
 
bool isOpen () const
 
bool exists (std::string_view filename) const
 
Blob read (std::string_view filename) const
 
std::vector< std::string > ls () const
 
const LodInfoinfo () const
 

Private Attributes

Blob _lod
 
LodInfo _info
 
std::unordered_map< std::string, LodRegion_files
 

Detailed Description

A single stop shop to read LOD files. Even though LODs support a multi-directory structure, in reality vanilla games only ever had a single directory each.

Given that we don't plan to expand the LOD format support, when resolving the files this class always looks into the first available directory, which is consistent with the vanilla behaviour.

Constructor & Destructor Documentation

◆ LodReader() [1/3]

LodReader::LodReader ( )
default

◆ LodReader() [2/3]

LodReader::LodReader ( std::string_view  path,
LodOpenFlags  openFlags = 0 
)

◆ LodReader() [3/3]

LodReader::LodReader ( Blob  blob,
LodOpenFlags  openFlags = 0 
)

◆ ~LodReader()

LodReader::~LodReader ( )

Member Function Documentation

◆ close()

void LodReader::close ( )

Closes this LOD reader & frees all associated resources.

◆ exists()

bool LodReader::exists ( std::string_view  filename) const
Parameters
filenameName of the LOD file entry.
Returns
Whether the file exists inside the LOD. The check is case-insensitive.

◆ info()

const LodInfo & LodReader::info ( ) const
Returns
LOD info, containing LOD version, description of this LOD file as specified in the LOD header, and a name of the single folder inside this LOD file.

◆ isOpen()

bool LodReader::isOpen ( ) const
inline

◆ ls()

std::vector< std::string > LodReader::ls ( ) const
Returns
List of all files in a LOD.

◆ open() [1/2]

void LodReader::open ( Blob  blob,
LodOpenFlags  openFlags = 0 
)
Parameters
blobLOD data.
openFlagsOpen flags.
Exceptions
ExceptionIf there are errors in the provided LOD file.

◆ open() [2/2]

void LodReader::open ( std::string_view  path,
LodOpenFlags  openFlags = 0 
)
Parameters
pathPath to the LOD file to open for reading.
openFlagsOpen flags.
Exceptions
ExceptionIf the LOD couldn't be opened - e.g., if the file doesn't exist, or if it's not a LOD.

◆ read()

Blob LodReader::read ( std::string_view  filename) const
Parameters
filenameName of the LOD file entry.
Returns
Contents of the file inside the LOD as a Blob.
Exceptions
ExceptionIf file doesn't exist inside the LOD.

Member Data Documentation

◆ _files

std::unordered_map<std::string, LodRegion> LodReader::_files
private

◆ _info

LodInfo LodReader::_info
private

◆ _lod

Blob LodReader::_lod
private

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