OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
SndReader Class Reference

#include <SndReader.h>

Public Member Functions

 SndReader ()
 
 SndReader (std::string_view path)
 
 SndReader (Blob blob)
 
 ~SndReader ()
 
void open (std::string_view path)
 
void open (Blob blob)
 
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
 

Private Attributes

Blob _snd
 
std::unordered_map< std::string, SndEntry_files
 

Detailed Description

Reader for Might&Magic SND files.

Note that compression is part of the container format in SND files, unlike in LOD, where it's part of the internal lod-specific file formats. Thus, we're not exposing it as part of the interface, and there is no 'SndFormats' library.

Constructor & Destructor Documentation

◆ SndReader() [1/3]

SndReader::SndReader ( )
default

◆ SndReader() [2/3]

SndReader::SndReader ( std::string_view  path)
explicit

◆ SndReader() [3/3]

SndReader::SndReader ( Blob  blob)
explicit

◆ ~SndReader()

SndReader::~SndReader ( )
default

Member Function Documentation

◆ close()

void SndReader::close ( )

Closes this SND reader & frees all associated resources.

◆ exists()

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

◆ isOpen()

bool SndReader::isOpen ( ) const
inline

◆ ls()

std::vector< std::string > SndReader::ls ( ) const
Returns
List of all files in the SND.

◆ open() [1/2]

void SndReader::open ( Blob  blob)
Parameters
blobSND data.
Exceptions
ExceptionIf there are errors in the provided SND file.

◆ open() [2/2]

void SndReader::open ( std::string_view  path)
Parameters
pathPath to the SND file to open for reading.
Exceptions
ExceptionIf the SND couldn't be opened - e.g., if the file doesn't exist, or if it's not in SND format.

◆ read()

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

Member Data Documentation

◆ _files

std::unordered_map<std::string, SndEntry> SndReader::_files
private

◆ _snd

Blob SndReader::_snd
private

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