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

This class represents a filename. More...

#include <Filename.hh>

Public Member Functions

 Filename ()=default
 Filename (std::string filename)
 Filename (std::string filename, const FileContext &context)
const std::string & getOriginal () const
const std::string & getResolved () const
void updateAfterLoadState ()
 After a loadstate we prefer to use the exact same file as before savestate. More...
bool empty () const
 Convenience method to test for empty filename. More...
void setResolved (const std::string &resolved)
 Change the resolved part of this filename E.g. More...
bool operator== (const Filename &other) const
bool operator!= (const Filename &other) const
template<typename Archive >
void serialize (Archive &ar, unsigned version)

Detailed Description

This class represents a filename.

A filename is resolved in a certain context. It is possible to query both the resolved and unresolved filename.

Most file operations will want the resolved name, but for example for savestates we (also) want the unresolved name.

Definition at line 17 of file Filename.hh.

Constructor & Destructor Documentation

◆ Filename() [1/3]

openmsx::Filename::Filename ( )

◆ Filename() [2/3]

openmsx::Filename::Filename ( std::string  filename)

Definition at line 12 of file

◆ Filename() [3/3]

openmsx::Filename::Filename ( std::string  filename,
const FileContext context 

Definition at line 18 of file

Member Function Documentation

◆ empty()

bool openmsx::Filename::empty ( ) const

◆ getOriginal()

const std::string& openmsx::Filename::getOriginal ( ) const

◆ getResolved()

const std::string& openmsx::Filename::getResolved ( ) const

◆ operator!=()

bool openmsx::Filename::operator!= ( const Filename other) const

Definition at line 54 of file Filename.hh.

References serialize().

◆ operator==()

bool openmsx::Filename::operator== ( const Filename other) const

Definition at line 51 of file Filename.hh.

◆ serialize()

template<typename Archive >
void openmsx::Filename::serialize ( Archive &  ar,
unsigned  version 

Definition at line 45 of file

Referenced by operator!=().

◆ setResolved()

void openmsx::Filename::setResolved ( const std::string &  resolved)

Change the resolved part of this filename E.g.

on loadstate when we didn't find the original file, but another file with a matching checksum.

Definition at line 46 of file Filename.hh.

Referenced by openmsx::CassettePlayer::serialize().

◆ updateAfterLoadState()

void openmsx::Filename::updateAfterLoadState ( )

After a loadstate we prefer to use the exact same file as before savestate.

But if that file is not available (possibly because snapshot is loaded on a different host machine), we fallback to the original filename.

Definition at line 25 of file

References empty(), openmsx::FileOperations::exists(), openmsx::FileOperations::getAbsolutePath(), and openmsx::userFileContext().

Referenced by getResolved(), openmsx::HD::serialize(), openmsx::CassettePlayer::serialize(), and openmsx::DiskName::updateAfterLoadState().

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