openMSX
Public Member Functions | List of all members
openmsx::LocalFileReference Class Reference

Helper class to use files in APIs other than openmsx::File. More...

#include <LocalFileReference.hh>

Public Member Functions

 LocalFileReference ()=default
 
 LocalFileReference (const Filename &filename)
 
 LocalFileReference (const std::string &filename)
 
 LocalFileReference (File &file)
 
 ~LocalFileReference ()
 
 LocalFileReference (const LocalFileReference &)=delete
 
LocalFileReferenceoperator= (const LocalFileReference &)=delete
 
 LocalFileReference (LocalFileReference &&)
 
LocalFileReferenceoperator= (LocalFileReference &&)
 
const std::string & getFilename () const
 Returns path to a local uncompressed version of this file. More...
 

Detailed Description

Helper class to use files in APIs other than openmsx::File.

The openMSX File class has support for (g)zipped files (or maybe in the future files over http, ftp, ...). Sometimes you need to pass a filename to an API that doesn't support this (for example SDL_LoadWav()). This class allows to create a temporary local uncompressed version of such files. Use it like this:

LocalFileReference file(filename); // can be any filename supported // by openmsx::File my_function(file.getFilename()); // my_function() can now work on // a regular local file

Note: In the past this functionality was available in the openmsx::File class. The current implementation of that class always keep an open file reference to the corresponding file. This gave problems on (some versions of) windows if the external function tries to open the file in read-write mode (for example IMG_Load() does this). The implementation of this class does not keep a reference to the file.

Definition at line 30 of file LocalFileReference.hh.

Constructor & Destructor Documentation

◆ LocalFileReference() [1/6]

openmsx::LocalFileReference::LocalFileReference ( )
default

◆ LocalFileReference() [2/6]

openmsx::LocalFileReference::LocalFileReference ( const Filename filename)
explicit

Definition at line 23 of file LocalFileReference.cc.

◆ LocalFileReference() [3/6]

openmsx::LocalFileReference::LocalFileReference ( const std::string &  filename)
explicit

Definition at line 17 of file LocalFileReference.cc.

References openmsx::filename.

◆ LocalFileReference() [4/6]

openmsx::LocalFileReference::LocalFileReference ( File file)
explicit

Definition at line 12 of file LocalFileReference.cc.

◆ ~LocalFileReference()

openmsx::LocalFileReference::~LocalFileReference ( )

Definition at line 44 of file LocalFileReference.cc.

◆ LocalFileReference() [5/6]

openmsx::LocalFileReference::LocalFileReference ( const LocalFileReference )
delete

◆ LocalFileReference() [6/6]

openmsx::LocalFileReference::LocalFileReference ( LocalFileReference &&  other)

Definition at line 28 of file LocalFileReference.cc.

Member Function Documentation

◆ getFilename()

const std::string & openmsx::LocalFileReference::getFilename ( ) const

Returns path to a local uncompressed version of this file.

This path only remains valid as long as this object is in scope.

Definition at line 93 of file LocalFileReference.cc.

Referenced by openmsx::GlobalCommandController::source().

◆ operator=() [1/2]

LocalFileReference& openmsx::LocalFileReference::operator= ( const LocalFileReference )
delete

◆ operator=() [2/2]

LocalFileReference & openmsx::LocalFileReference::operator= ( LocalFileReference &&  other)

Definition at line 35 of file LocalFileReference.cc.


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